Keyboard question

I’ve been tasked with writing a driver that will listen to data coming in
from a USB device, do some processing on it then send some data out as if it
was typed on a keyboard. (The USB device is NOT a keyboard class HID
device). I’ve searched the archives and found some interesting posts about
the kbdclass driver and the like, but I have no clue where I should even
start on this. I’ve created a dummy driver that currently doesn’t do
anything, and I setup the inf with the correct USB id’s that installs it as
a keyboard device in device manager,. My question is rather simple. how do
I get data to the keyboard class driver? do I need to write my own? and if
that is the case would it replace the standard windows driver? (that’s bad
right?). Sorry for my ignorance on this, but I have limited experience with
doing kernel drivers, but you have to start somewhere right? =)

Thanks!

-Jeff

Write a filter based on KBDFILTR sample.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jeff Lange”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, March 16, 2005 5:30 PM
Subject: [ntdev] Keyboard question

> I’ve been tasked with writing a driver that will listen to data coming in
> from a USB device, do some processing on it then send some data out as if it
> was typed on a keyboard. (The USB device is NOT a keyboard class HID
> device). I’ve searched the archives and found some interesting posts about
> the kbdclass driver and the like, but I have no clue where I should even
> start on this. I’ve created a dummy driver that currently doesn’t do
> anything, and I setup the inf with the correct USB id’s that installs it as
> a keyboard device in device manager,. My question is rather simple. how do
> I get data to the keyboard class driver? do I need to write my own? and if
> that is the case would it replace the standard windows driver? (that’s bad
> right?). Sorry for my ignorance on this, but I have limited experience with
> doing kernel drivers, but you have to start somewhere right? =)
>
> Thanks!
>
> -Jeff
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

The only problem with that solution is that I can’t guarantee that there will be another keyboard device on the system to filter.

-Jeff

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, March 16, 2005 10:43 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Keyboard question

Write a filter based on KBDFILTR sample.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jeff Lange”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, March 16, 2005 5:30 PM
Subject: [ntdev] Keyboard question

> I’ve been tasked with writing a driver that will listen to data coming in
> from a USB device, do some processing on it then send some data out as if it
> was typed on a keyboard. (The USB device is NOT a keyboard class HID
> device). I’ve searched the archives and found some interesting posts about
> the kbdclass driver and the like, but I have no clue where I should even
> start on this. I’ve created a dummy driver that currently doesn’t do
> anything, and I setup the inf with the correct USB id’s that installs it as
> a keyboard device in device manager,. My question is rather simple. how do
> I get data to the keyboard class driver? do I need to write my own? and if
> that is the case would it replace the standard windows driver? (that’s bad
> right?). Sorry for my ignorance on this, but I have limited experience with
> doing kernel drivers, but you have to start somewhere right? =)
>
> Thanks!
>
> -Jeff
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@ultimatetechnology.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

I believe this will work: make kbdclass an upper filter on your device,
and make sure to handle the IOCTL that tells you the service callback.
Call the service callback when you need to send a keystroke.

If you’re a filter on some other driver, or for some other reason you
can’t set kbdclass as your upper filter, then the second easiest thing
is probably to make this a HID mini-driver (see the DDK for an example).

Jeff Lange wrote:

I’ve been tasked with writing a driver that will listen to data coming in
from a USB device, do some processing on it then send some data out as if it
was typed on a keyboard. (The USB device is NOT a keyboard class HID
device). I’ve searched the archives and found some interesting posts about
the kbdclass driver and the like, but I have no clue where I should even
start on this. I’ve created a dummy driver that currently doesn’t do
anything, and I setup the inf with the correct USB id’s that installs it as
a keyboard device in device manager,. My question is rather simple. how do
I get data to the keyboard class driver? do I need to write my own? and if
that is the case would it replace the standard windows driver? (that’s bad
right?). Sorry for my ignorance on this, but I have limited experience with
doing kernel drivers, but you have to start somewhere right? =)

Thanks!

-Jeff


…/ray..

Please remove “.spamblock” from my email address if you need to contact
me outside the newsgroup.

Lange, Jeff wrote:

The only problem with that solution is that I can’t guarantee that there will be another keyboard device on the system to filter.

You can make your driver be HID class even if the device you are
supporting is not.

If no other component needs to open your driver and talk to it, your
driver should be a keyboard *port* driver, not a filter driver. You
basically need to support the following IOCTLs:
IOCTL_INTERNAL_KEYBOARD_CONNECT

IOCTL_KEYBOARD_QUERY_ATTRIBUTES

IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION

IOCTL_KEYBOARD_QUERY_INDICATORS
IOCTL_KEYBOARD_SET_INDICATORS

IOCTL_KEYBOARD_QUERY_TYPEMATIC
IOCTL_KEYBOARD_SET_TYPEMATIC

And then call the service callback routine (which is set in
IOCTL_INTERNAL_KEYBOARD_CONNECT) at DISPATCH_LEVEL every time you have
data to report. The data is reported in the form of an array of
KEYBOARD_INPUT_DATA structures.

Look at the DDK example pnpi8042. there is a lot there b/c it has both
a mouse and keyboard device object, but for a head start on the IOCTLs,
look at i8042cmn.c, I8xInternalDeviceControl().

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lange, Jeff
Sent: Wednesday, March 16, 2005 7:51 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Keyboard question

The only problem with that solution is that I can’t guarantee that there
will be another keyboard device on the system to filter.

-Jeff

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, March 16, 2005 10:43 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Keyboard question

Write a filter based on KBDFILTR sample.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jeff Lange”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, March 16, 2005 5:30 PM
Subject: [ntdev] Keyboard question

> I’ve been tasked with writing a driver that will listen to data coming
in
> from a USB device, do some processing on it then send some data out as
if it
> was typed on a keyboard. (The USB device is NOT a keyboard class HID
> device). I’ve searched the archives and found some interesting posts
about
> the kbdclass driver and the like, but I have no clue where I should
even
> start on this. I’ve created a dummy driver that currently doesn’t do
> anything, and I setup the inf with the correct USB id’s that installs
it as
> a keyboard device in device manager,. My question is rather simple.
how do
> I get data to the keyboard class driver? do I need to write my own?
and if
> that is the case would it replace the standard windows driver? (that’s
bad
> right?). Sorry for my ignorance on this, but I have limited
experience with
> doing kernel drivers, but you have to start somewhere right? =)
>
> Thanks!
>
> -Jeff
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@ultimatetechnology.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

One more detail. For this to work, you need to install your driver
under the Keyboard Port device class. That is how kbdclass will be
automatically loaded on top of your driver.

d

-----Original Message-----
From: Doron Holan
Sent: Wednesday, March 16, 2005 9:44 AM
To: ‘Windows System Software Devs Interest List’
Subject: RE: [ntdev] Keyboard question

If no other component needs to open your driver and talk to it, your
driver should be a keyboard *port* driver, not a filter driver. You
basically need to support the following IOCTLs:
IOCTL_INTERNAL_KEYBOARD_CONNECT

IOCTL_KEYBOARD_QUERY_ATTRIBUTES

IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION

IOCTL_KEYBOARD_QUERY_INDICATORS
IOCTL_KEYBOARD_SET_INDICATORS

IOCTL_KEYBOARD_QUERY_TYPEMATIC
IOCTL_KEYBOARD_SET_TYPEMATIC

And then call the service callback routine (which is set in
IOCTL_INTERNAL_KEYBOARD_CONNECT) at DISPATCH_LEVEL every time you have
data to report. The data is reported in the form of an array of
KEYBOARD_INPUT_DATA structures.

Look at the DDK example pnpi8042. there is a lot there b/c it has both
a mouse and keyboard device object, but for a head start on the IOCTLs,
look at i8042cmn.c, I8xInternalDeviceControl().

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lange, Jeff
Sent: Wednesday, March 16, 2005 7:51 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Keyboard question

The only problem with that solution is that I can’t guarantee that there
will be another keyboard device on the system to filter.

-Jeff

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, March 16, 2005 10:43 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Keyboard question

Write a filter based on KBDFILTR sample.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jeff Lange”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, March 16, 2005 5:30 PM
Subject: [ntdev] Keyboard question

> I’ve been tasked with writing a driver that will listen to data coming
in
> from a USB device, do some processing on it then send some data out as
if it
> was typed on a keyboard. (The USB device is NOT a keyboard class HID
> device). I’ve searched the archives and found some interesting posts
about
> the kbdclass driver and the like, but I have no clue where I should
even
> start on this. I’ve created a dummy driver that currently doesn’t do
> anything, and I setup the inf with the correct USB id’s that installs
it as
> a keyboard device in device manager,. My question is rather simple.
how do
> I get data to the keyboard class driver? do I need to write my own?
and if
> that is the case would it replace the standard windows driver? (that’s
bad
> right?). Sorry for my ignorance on this, but I have limited
experience with
> doing kernel drivers, but you have to start somewhere right? =)
>
> Thanks!
>
> -Jeff
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@ultimatetechnology.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

You can see sample of keyboard filter driver :
http://www.sysinternals.com/ntw2k/source/ctrl2cap.shtml
Mark

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com]On Behalf Of Jeff Lange
Sent: Wednesday, March 16, 2005 4:31 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Keyboard question

I’ve been tasked with writing a driver that will listen to data coming in
from a USB device, do some processing on it then send some data out as if it
was typed on a keyboard. (The USB device is NOT a keyboard class HID
device). I’ve searched the archives and found some interesting posts about
the kbdclass driver and the like, but I have no clue where I should even
start on this. I’ve created a dummy driver that currently doesn’t do
anything, and I setup the inf with the correct USB id’s that installs it as
a keyboard device in device manager,. My question is rather simple. how do
I get data to the keyboard class driver? do I need to write my own? and if
that is the case would it replace the standard windows driver? (that’s bad
right?). Sorry for my ignorance on this, but I have limited experience with
doing kernel drivers, but you have to start somewhere right? =)

Thanks!

-Jeff


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@arx.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Doron,
I have my driver properly registering with the keyboard class, and getting
the callback routine in the IOCTL. I setup a simple function that will just
try to stuff some fake keys into the driver just to see if things are
working. The call completes ok and says it consumed all the data I passed
it, but no keystrokes ever come out. Any ideas as to what’s happening here?

VOID sendKeyStrokes(PKBDSIM_DEVICE_EXT devExt)
{
PVOID classService;
PVOID classDeviceObject;
ULONG inputDataConsumed = 0;
KIRQL irql;

devExt->testData[0].MakeCode = 0x15;
devExt->testData[0].Flags = KEY_MAKE;
devExt->testData[1].MakeCode = 0x15;
devExt->testData[2].Flags = KEY_BREAK;

classDeviceObject = devExt->ConnectData.ClassDeviceObject;
classService = devExt->ConnectData.ClassService;

ASSERT(classService != NULL);

irql = KeRaiseIrqlToDpcLevel();
(*(PSERVICE_CALLBACK_ROUTINE) classService)(
classDeviceObject,
&devExt->testData[0],
&devExt->testData[2],
&inputDataConsumed
);
KeLowerIrql(irql);
DbgPrint(“callback consumed %d items\n”, inputDataConsumed);
}

Thanks in advance!

-Jeff

“Doron Holan” wrote in message
news:xxxxx@ntdev…
One more detail. For this to work, you need to install your driver
under the Keyboard Port device class. That is how kbdclass will be
automatically loaded on top of your driver.

d

-----Original Message-----
From: Doron Holan
Sent: Wednesday, March 16, 2005 9:44 AM
To: ‘Windows System Software Devs Interest List’
Subject: RE: [ntdev] Keyboard question

If no other component needs to open your driver and talk to it, your
driver should be a keyboard port driver, not a filter driver. You
basically need to support the following IOCTLs:
IOCTL_INTERNAL_KEYBOARD_CONNECT

IOCTL_KEYBOARD_QUERY_ATTRIBUTES

IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION

IOCTL_KEYBOARD_QUERY_INDICATORS
IOCTL_KEYBOARD_SET_INDICATORS

IOCTL_KEYBOARD_QUERY_TYPEMATIC
IOCTL_KEYBOARD_SET_TYPEMATIC

And then call the service callback routine (which is set in
IOCTL_INTERNAL_KEYBOARD_CONNECT) at DISPATCH_LEVEL every time you have
data to report. The data is reported in the form of an array of
KEYBOARD_INPUT_DATA structures.

Look at the DDK example pnpi8042. there is a lot there b/c it has both
a mouse and keyboard device object, but for a head start on the IOCTLs,
look at i8042cmn.c, I8xInternalDeviceControl().

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lange, Jeff
Sent: Wednesday, March 16, 2005 7:51 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Keyboard question

The only problem with that solution is that I can’t guarantee that there
will be another keyboard device on the system to filter.

-Jeff

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, March 16, 2005 10:43 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Keyboard question

Write a filter based on KBDFILTR sample.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jeff Lange”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, March 16, 2005 5:30 PM
Subject: [ntdev] Keyboard question

> I’ve been tasked with writing a driver that will listen to data coming
in
> from a USB device, do some processing on it then send some data out as
if it
> was typed on a keyboard. (The USB device is NOT a keyboard class HID
> device). I’ve searched the archives and found some interesting posts
about
> the kbdclass driver and the like, but I have no clue where I should
even
> start on this. I’ve created a dummy driver that currently doesn’t do
> anything, and I setup the inf with the correct USB id’s that installs
it as
> a keyboard device in device manager,. My question is rather simple.
how do
> I get data to the keyboard class driver? do I need to write my own?
and if
> that is the case would it replace the standard windows driver? (that’s
bad
> right?). Sorry for my ignorance on this, but I have limited
experience with
> doing kernel drivers, but you have to start somewhere right? =)
>
> Thanks!
>
> -Jeff
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@ultimatetechnology.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

This:
devExt->testData[2].Flags = KEY_BREAK;

should be
devExt->testData[1].Flags = KEY_BREAK;
^

Afterwards, inputDataConsumed == 2 right?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: Monday, March 21, 2005 9:39 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Keyboard question

Doron,
I have my driver properly registering with the keyboard class, and
getting
the callback routine in the IOCTL. I setup a simple function that will
just
try to stuff some fake keys into the driver just to see if things are
working. The call completes ok and says it consumed all the data I
passed
it, but no keystrokes ever come out. Any ideas as to what’s happening
here?

VOID sendKeyStrokes(PKBDSIM_DEVICE_EXT devExt)
{
PVOID classService;
PVOID classDeviceObject;
ULONG inputDataConsumed = 0;
KIRQL irql;

devExt->testData[0].MakeCode = 0x15;
devExt->testData[0].Flags = KEY_MAKE;
devExt->testData[1].MakeCode = 0x15;
devExt->testData[2].Flags = KEY_BREAK;

classDeviceObject = devExt->ConnectData.ClassDeviceObject;
classService = devExt->ConnectData.ClassService;

ASSERT(classService != NULL);

irql = KeRaiseIrqlToDpcLevel();
(*(PSERVICE_CALLBACK_ROUTINE) classService)(
classDeviceObject,
&devExt->testData[0],
&devExt->testData[2],
&inputDataConsumed
);
KeLowerIrql(irql);
DbgPrint(“callback consumed %d items\n”, inputDataConsumed);
}

Thanks in advance!

-Jeff

“Doron Holan” wrote in message
news:xxxxx@ntdev…
One more detail. For this to work, you need to install your driver
under the Keyboard Port device class. That is how kbdclass will be
automatically loaded on top of your driver.

d

-----Original Message-----
From: Doron Holan
Sent: Wednesday, March 16, 2005 9:44 AM
To: ‘Windows System Software Devs Interest List’
Subject: RE: [ntdev] Keyboard question

If no other component needs to open your driver and talk to it, your
driver should be a keyboard port driver, not a filter driver. You
basically need to support the following IOCTLs:
IOCTL_INTERNAL_KEYBOARD_CONNECT

IOCTL_KEYBOARD_QUERY_ATTRIBUTES

IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION

IOCTL_KEYBOARD_QUERY_INDICATORS
IOCTL_KEYBOARD_SET_INDICATORS

IOCTL_KEYBOARD_QUERY_TYPEMATIC
IOCTL_KEYBOARD_SET_TYPEMATIC

And then call the service callback routine (which is set in
IOCTL_INTERNAL_KEYBOARD_CONNECT) at DISPATCH_LEVEL every time you have
data to report. The data is reported in the form of an array of
KEYBOARD_INPUT_DATA structures.

Look at the DDK example pnpi8042. there is a lot there b/c it has both
a mouse and keyboard device object, but for a head start on the IOCTLs,
look at i8042cmn.c, I8xInternalDeviceControl().

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lange, Jeff
Sent: Wednesday, March 16, 2005 7:51 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Keyboard question

The only problem with that solution is that I can’t guarantee that there
will be another keyboard device on the system to filter.

-Jeff

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, March 16, 2005 10:43 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Keyboard question

Write a filter based on KBDFILTR sample.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jeff Lange”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, March 16, 2005 5:30 PM
Subject: [ntdev] Keyboard question

> I’ve been tasked with writing a driver that will listen to data coming
in
> from a USB device, do some processing on it then send some data out as
if it
> was typed on a keyboard. (The USB device is NOT a keyboard class HID
> device). I’ve searched the archives and found some interesting posts
about
> the kbdclass driver and the like, but I have no clue where I should
even
> start on this. I’ve created a dummy driver that currently doesn’t do
> anything, and I setup the inf with the correct USB id’s that installs
it as
> a keyboard device in device manager,. My question is rather simple.
how do
> I get data to the keyboard class driver? do I need to write my own?
and if
> that is the case would it replace the standard windows driver? (that’s
bad
> right?). Sorry for my ignorance on this, but I have limited
experience with
> doing kernel drivers, but you have to start somewhere right? =)
>
> Thanks!
>
> -Jeff
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@ultimatetechnology.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

OK, that was a dumb typo on my part… =(
I also realized that I needed to fully implement the set_typematic and other
ioctls in order for it to work.

Thanks for all your help.

-Jeff

“Doron Holan” wrote in message
news:xxxxx@ntdev…
This:
devExt->testData[2].Flags = KEY_BREAK;

should be
devExt->testData[1].Flags = KEY_BREAK;
^

Afterwards, inputDataConsumed == 2 right?

D

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jeff Lange
Sent: Monday, March 21, 2005 9:39 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Keyboard question

Doron,
I have my driver properly registering with the keyboard class, and
getting
the callback routine in the IOCTL. I setup a simple function that will
just
try to stuff some fake keys into the driver just to see if things are
working. The call completes ok and says it consumed all the data I
passed
it, but no keystrokes ever come out. Any ideas as to what’s happening
here?

VOID sendKeyStrokes(PKBDSIM_DEVICE_EXT devExt)
{
PVOID classService;
PVOID classDeviceObject;
ULONG inputDataConsumed = 0;
KIRQL irql;

devExt->testData[0].MakeCode = 0x15;
devExt->testData[0].Flags = KEY_MAKE;
devExt->testData[1].MakeCode = 0x15;
devExt->testData[2].Flags = KEY_BREAK;

classDeviceObject = devExt->ConnectData.ClassDeviceObject;
classService = devExt->ConnectData.ClassService;

ASSERT(classService != NULL);

irql = KeRaiseIrqlToDpcLevel();
(*(PSERVICE_CALLBACK_ROUTINE) classService)(
classDeviceObject,
&devExt->testData[0],
&devExt->testData[2],
&inputDataConsumed
);
KeLowerIrql(irql);
DbgPrint(“callback consumed %d items\n”, inputDataConsumed);
}

Thanks in advance!

-Jeff

“Doron Holan” wrote in message
news:xxxxx@ntdev…
One more detail. For this to work, you need to install your driver
under the Keyboard Port device class. That is how kbdclass will be
automatically loaded on top of your driver.

d

-----Original Message-----
From: Doron Holan
Sent: Wednesday, March 16, 2005 9:44 AM
To: ‘Windows System Software Devs Interest List’
Subject: RE: [ntdev] Keyboard question

If no other component needs to open your driver and talk to it, your
driver should be a keyboard port driver, not a filter driver. You
basically need to support the following IOCTLs:
IOCTL_INTERNAL_KEYBOARD_CONNECT

IOCTL_KEYBOARD_QUERY_ATTRIBUTES

IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION

IOCTL_KEYBOARD_QUERY_INDICATORS
IOCTL_KEYBOARD_SET_INDICATORS

IOCTL_KEYBOARD_QUERY_TYPEMATIC
IOCTL_KEYBOARD_SET_TYPEMATIC

And then call the service callback routine (which is set in
IOCTL_INTERNAL_KEYBOARD_CONNECT) at DISPATCH_LEVEL every time you have
data to report. The data is reported in the form of an array of
KEYBOARD_INPUT_DATA structures.

Look at the DDK example pnpi8042. there is a lot there b/c it has both
a mouse and keyboard device object, but for a head start on the IOCTLs,
look at i8042cmn.c, I8xInternalDeviceControl().

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Lange, Jeff
Sent: Wednesday, March 16, 2005 7:51 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Keyboard question

The only problem with that solution is that I can’t guarantee that there
will be another keyboard device on the system to filter.

-Jeff

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Wednesday, March 16, 2005 10:43 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Keyboard question

Write a filter based on KBDFILTR sample.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Jeff Lange”
Newsgroups: ntdev
To: “Windows System Software Devs Interest List”
Sent: Wednesday, March 16, 2005 5:30 PM
Subject: [ntdev] Keyboard question

> I’ve been tasked with writing a driver that will listen to data coming
in
> from a USB device, do some processing on it then send some data out as
if it
> was typed on a keyboard. (The USB device is NOT a keyboard class HID
> device). I’ve searched the archives and found some interesting posts
about
> the kbdclass driver and the like, but I have no clue where I should
even
> start on this. I’ve created a dummy driver that currently doesn’t do
> anything, and I setup the inf with the correct USB id’s that installs
it as
> a keyboard device in device manager,. My question is rather simple.
how do
> I get data to the keyboard class driver? do I need to write my own?
and if
> that is the case would it replace the standard windows driver? (that’s
bad
> right?). Sorry for my ignorance on this, but I have limited
experience with
> doing kernel drivers, but you have to start somewhere right? =)
>
> Thanks!
>
> -Jeff
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
>
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@ultimatetechnology.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to xxxxx@lists.osr.com