Opened 13 years ago

Closed 13 years ago

#951 closed bug (fixed)

PS/2 keyboard not recognized by input_server

Reported by: wkornewald Owned by: marcusoverhagen
Priority: critical Milestone: R1
Component: Drivers/Keyboard/PS2 Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

The keyboard is detected correctly and input is received by the PS/2 bus manager, but it's dropped because the device isn't opened. This must be a bug in the input_server add-on.

Attachments (11)

keyboard_device_log.log (395 bytes ) - added by wkornewald 13 years ago.
probably useless keyboard input_server device log
syslog (98.8 KB ) - added by wkornewald 13 years ago.
syslog with DEBUG=1 for ps/2 driver, input_server, and input_server add-on
syslog_command_a8 (88.1 KB ) - added by wkornewald 13 years ago.
(a)
syslog_write_data_00 (86.3 KB ) - added by wkornewald 13 years ago.
(b)
syslog_write_data_F6 (86.3 KB ) - added by wkornewald 13 years ago.
(c)
syslog_write_data_FF (86.2 KB ) - added by wkornewald 13 years ago.
(d)
syslog_command_93_ (23.9 KB ) - added by wkornewald 13 years ago.
worked
syslog_command_93__with_mouse (85.5 KB ) - added by wkornewald 13 years ago.
worked
syslog_command_93_ff (17.7 KB ) - added by wkornewald 13 years ago.
worked
syslog_command_93_ff_with_mouse (44.0 KB ) - added by wkornewald 13 years ago.
worked
syslog_after_removal (85.1 KB ) - added by wkornewald 13 years ago.
worked

Download all attachments as: .zip

Change History (23)

by wkornewald, 13 years ago

Attachment: keyboard_device_log.log added

probably useless keyboard input_server device log

comment:1 by wkornewald, 13 years ago

This bug is probably related to #155, but my keyboard is never recognized. I'm using a Sony laptop (VGN-FS115M). After boot the keyboard LEDs are off and can't be changed (it's like the keyboard is dead). In the syslog you will see that I pressed the following keys: CapsLock, NumLock, a, b, c, CTRL, ALT Nothing ever happened.

Is there anything else you need?

by wkornewald, 13 years ago

Attachment: syslog added

syslog with DEBUG=1 for ps/2 driver, input_server, and input_server add-on

comment:2 by wkornewald, 13 years ago

I've remove the syslog mouse movement output to be more useful.

comment:3 by marcusoverhagen, 13 years ago

Status: newassigned

It looks like the keyboard controller ignores the a8 command, so the ff (reset) command goes to the mouse 3 instead of keybaord. I'll try to find a workaround.

The important stuff:

1223 KERN: ps2: active multiplexing v1.1 enabled 1224 KERN: ps2: ps2_command cmd 0xa8, out 0, in 0 1225 KERN: ps2_write_ctrl 0xa8 1226 KERN: ps2: ps2_command result 0x00000000 1227 KERN: ps2: ps2_command cmd 0x90, out 0, in 0 1228 KERN: ps2_write_ctrl 0x90 1229 KERN: ps2: ps2_command result 0x00000000 1230 KERN: ps2: ps2_command cmd 0xa8, out 0, in 0 1231 KERN: ps2_write_ctrl 0xa8 1232 KERN: ps2: ps2_command result 0x00000000 1233 KERN: ps2: ps2_command cmd 0x91, out 0, in 0 1234 KERN: ps2_write_ctrl 0x91 1235 KERN: ps2: ps2_command result 0x00000000 1236 KERN: ps2: ps2_command cmd 0xa8, out 0, in 0 1237 KERN: ps2_write_ctrl 0xa8 1238 KERN: ps2: ps2_command result 0x00000000 1239 KERN: ps2: ps2_command cmd 0x92, out 0, in 0 1240 KERN: ps2_write_ctrl 0x92 1241 KERN: ps2: ps2_command result 0x00000000 1242 KERN: ps2: ps2_command cmd 0xa8, out 0, in 0 1243 KERN: ps2_write_ctrl 0xa8 1244 KERN: ps2: ps2_command result 0x00000000 1245 KERN: ps2: ps2_command cmd 0x93, out 0, in 0 1246 KERN: ps2_write_ctrl 0x93 (redirect to mouse 3) 1247 KERN: ps2: ps2_command result 0x00000000 1248 KERN: ps2: ps2_command cmd 0xa8, out 0, in 0 1249 KERN: ps2_write_ctrl 0xa8 (enable mouse 3) 1250 KERN: ps2: ps2_command result 0x00000000 [...] 1325 KERN: ps2: keyboard_open input/keyboard/at/0 1326 KERN: ps2: ps2_dev_command cmd 0xff, out 0, in 1, dev input/keyboard/at/0 1327 KERN: ps2_write_data 0xff (reset) 1328 KERN: ps2_interrupt: ctrl 0xf1, data 0xfa (mouse 3) 1329 KERN: ps2: input/mouse/ps2/3 not enabled, data 0xfa dropped 1345 KERN: ps2_interrupt: ctrl 0xf1, data 0xaa (mouse 3) 1346 KERN: ps2: input/mouse/ps2/3 not enabled, data 0xaa dropped 1347 KERN: ps2_interrupt: ctrl 0xf1, data 0x00 (mouse 3) [...]

compare this to a mouse reset that is on purpose

1470 KERN: ps2: ps2_dev_command cmd 0xff, out 0, in 2, dev input/mouse/ps2/3 1471 KERN: ps2_write_ctrl 0x93 (redirect to mouse 3) 1472 KERN: ps2_write_data 0xff (reset) 1473 KERN: ps2_interrupt: ctrl 0xf1, data 0xfa (mouse 3) 1474 KERN: ps2: ps2_dev_command wait for ack res 0x00000000, wait-time 2846 1475 KERN: ps2: ps2_dev_command got ACK 1476 KERN: ps2_interrupt: ctrl 0xf1, data 0xaa (mouse 3) 1477 KERN: ps2_interrupt: ctrl 0xf1, data 0x00 (mouse 3) 1478 KERN: ps2: ps2_dev_command wait for input res 0x00000000, wait-time 399045 1479 KERN: ps2: ps2_dev_command in 0xaa 1480 KERN: ps2: ps2_dev_command in 0x00 1481 KERN: ps2: ps2_dev_command result 0x00000000

comment:4 by marcusoverhagen, 13 years ago

specification:

The routing prefix (90h, 91h, 92h, or 93h) is written to output port 64h, followed by any of the following host actions:

Routing prefix + output A8h to port 64h This command enables the selected AUX port [...]

Routing prefix + output a byte to port 60h This command sends the indicated byte to the AUX port selected by the routing prefix.

(port 64 is ctrl, port 60 is data)

comment:5 by marcusoverhagen, 13 years ago

Please try this:

modify src/add-ons/kernel/bus_managers/ps2/ps2_common.c, function ps2_setup_active_multiplexing

and insert at:

ps2_command(0x93, NULL, 0, NULL, 0); ps2_command(0xa8, NULL, 0, NULL, 0);

->> here

*enabled = true; return B_OK;

one of the following:

a) ps2_command(0xa8, NULL, 0, NULL, 0); b) ps2_write_data(0x00); c) ps2_write_data(0xF6); d) ps2_write_data(0xFF);

I would like to see both syslogs of testing using a) and b), if none of them works, please also test c) and d).

by wkornewald, 13 years ago

Attachment: syslog_command_a8 added

(a)

by wkornewald, 13 years ago

Attachment: syslog_write_data_00 added

(b)

by wkornewald, 13 years ago

Attachment: syslog_write_data_F6 added

(c)

by wkornewald, 13 years ago

Attachment: syslog_write_data_FF added

(d)

comment:6 by wkornewald, 13 years ago

Unfortunately, nothing worked.

comment:7 by marcusoverhagen, 13 years ago

Please try this instead

ps2_command(0x93, (const uint8 *)"", 1, NULL, 0);

If that still doesn't work, try

ps2_command(0x90, (const uint8 *)"\xff", 1, NULL, 0);

As last resort, insert all these:

ps2_command(0x93, (const uint8 *)"\xff", 1, NULL, 0); ps2_command(0x92, (const uint8 *)"\xff", 1, NULL, 0); ps2_command(0x91, (const uint8 *)"\xff", 1, NULL, 0); ps2_command(0x90, (const uint8 *)"\xff", 1, NULL, 0);

by wkornewald, 13 years ago

Attachment: syslog_command_93_ added

worked

by wkornewald, 13 years ago

worked

by wkornewald, 13 years ago

Attachment: syslog_command_93_ff added

worked

by wkornewald, 13 years ago

worked

in reply to:  7 comment:8 by wkornewald, 13 years ago

Replying to marcusoverhagen:

Please try this instead

ps2_command(0x93, (const uint8 *)"", 1, NULL, 0);

That worked, thanks!

Just for the sake of testing I also tried: ps2_command(0x93, (const uint8 *)"\xff", 1, NULL, 0); This worked, too. Both syslogs are attached.

If that still doesn't work, try

ps2_command(0x90, (const uint8 *)"\xff", 1, NULL, 0);

Haiku seemed to not have crashed, but all input devices (including my USB mouse) stopped working. That rented my laptop unbootable. I had to remove the battery to make it boot, again.

As last resort, insert all these:

ps2_command(0x93, (const uint8 *)"\xff", 1, NULL, 0); ps2_command(0x92, (const uint8 *)"\xff", 1, NULL, 0); ps2_command(0x91, (const uint8 *)"\xff", 1, NULL, 0); ps2_command(0x90, (const uint8 *)"\xff", 1, NULL, 0);

Same crashing behavior.

I also tried the following with the same results: ps2_command(0x93, (const uint8 *)"", 1, NULL, 0); ps2_command(0x92, (const uint8 *)"", 1, NULL, 0); ps2_command(0x91, (const uint8 *)"", 1, NULL, 0); ps2_command(0x90, (const uint8 *)"", 1, NULL, 0);

Don't know if that's useful.

comment:9 by wkornewald, 13 years ago

Do you think the problem was fixed correctly, now? Or do you want to test something else before committing anything?

comment:10 by marcusoverhagen, 13 years ago

The results indicate that your keyboard still doing something erattic, and I really don't like the current "solution".

According to the PS/2 active multiplexing specification, (available at http://www.synaptics.com/decaf/utilities/ps2-mux.PDF ) the default of the AUX port is supposed to be disabled=0 after switching to multiplexing.

This means we can hopefully drop the enable sequence completely.

Please modify ps2_setup_active_multiplexing() and remove the lines below the dprintf, then compile test and attach a syslog.

[...]
dprintf("ps2: active multiplexing v%d.%d enabled\n", (in >> 4), in & 0xf);
// remove everything that was at this place
*enabled = true;
return B_OK;
[...]

by wkornewald, 13 years ago

Attachment: syslog_after_removal added

worked

comment:11 by wkornewald, 13 years ago

I hope this helps. Sorry that it took so long...

comment:12 by marcusoverhagen, 13 years ago

Resolution: fixed
Status: assignedclosed

Fixed in hrev19566

Note: See TracTickets for help on using tickets.