Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

How is KEYBD implemented? (I want to send a RESET command to the keyboard).

Nov
339
7
KEYBD can programmatically set the three lock lights and disable/enable the keyboard.

I've spent a while looking up the PS/2 keyboard protocol for an issue I am dealing with, and I would bet good $$$ that KEYBD is sending the ED, F4 and F5 host-to-keyboard commands. Turs out that FF is the "keyboard reset" command... I'd like to be able to do exactly that.

Now, I am not asking to incorporate this to the KEYBD command (this is a niche thing I've run into now, and it may well be that programmatically resetting the keyboard still doesn't help me) — a plugin command would suffice. But to get there, I need first to get confirmation that what I've described is indeed what's happening (and therefore making a plugin command to send that reset byte would be easily doable).


See PS/2 Controller for reference.
 
I wouldn't be surprised if KEYBD uses the DeviceIoControl() function with dwIoControlCode equal to IOCTL_KEYBOARD_SET_INDICATORS (but that doesn't explain the /K switch). I didn't find a "canned" way to reset the keyboard.

The kernel driver "i8042prt" handles PS/2 kb and mouse. I wonder if stopping/starting it (with SC.EXE) would accomplish your goal.

Code:
d:\tc31> sc query i8042prt

SERVICE_NAME: i8042prt
        TYPE               : 1  KERNEL_DRIVER
        STATE              : 4  RUNNING
                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)
        WIN32_EXIT_CODE    : 0  (0x0)
        SERVICE_EXIT_CODE  : 0  (0x0)
        CHECKPOINT         : 0x0
        WAIT_HINT          : 0x0
 
Although SC.EXE says it's stoppable, it apparently isn't.

Code:
d:\tc31> sc stop i8042prt & delay 2 & sc start i8042prt
[SC] ControlService FAILED 1052:

The requested control is not valid for this service.

[SC] StartService FAILED 1056:

An instance of the service is already running.
 
Back
Top