From: tamar on
I'm working on a keyboard class upper filter driver, based on the DDK
kbfiltr sample.
Succeed to get data send from the controller through i8042.

Now I want to send commands to the keyboard controller from my filter
driver, meaning send data to be written to port 60\64.
can it be done?
which IRP i should use?

10X in advance
Tamar.

From: Ray Trent on
Use IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER to write commands to the
keyboard via the data port (and use the ISR callback to receive the
responses).

There's no officially supported way to write to the command port. If
you're excruciatingly careful it's technically possible to write to the
command port directly using WRITE_PORT_UCHAR while synchronized with the
i8042prt ISR, but this can lead to numerous problems and should be
avoided unless absolutely necessary.

You can also use an initialization callback routine and write to the
keyboard in that context with PI8042_SYNCH_WRITE_PORT.

All of this is documented in the DDK.

Note, however, that i8042 doesn't provide any mechanism to write atomic
sequences of commands to the port that have responses. You can spew a
sequence of bytes atomically, but multiple calls are needed to send a
command, get a response, send another command and get another response.
This defeats the synchronization mechanism, so you're susceptible to
interference from other drivers including i8042prt itself.

tamar wrote:
> I'm working on a keyboard class upper filter driver, based on the DDK
> kbfiltr sample.
> Succeed to get data send from the controller through i8042.
>
> Now I want to send commands to the keyboard controller from my filter
> driver, meaning send data to be written to port 60\64.
> can it be done?
> which IRP i should use?
>
> 10X in advance
> Tamar.
>


--
.../ray\..
From: tamar on
Thanks for your answer.

I try to get a "pointer" to i8042 using IoGetDeviceObjectPointer , it
fail , return status = 34 (STATUS_OBJECT_NAME_NOT_FOUND)



RtlInitUnicodeString(&ObjectName, "\\Device\\i8042prt");

status = IoGetDeviceObjectPointer(&ObjectName, FILE_READ_DATA ,
&pFileObj, &pDeviceObj);

where i go wrong?

Thanks
Tamar

From: Maxim S. Shatskih on
For what? Use the KBDFILTR-style filter instead.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim(a)storagecraft.com
http://www.storagecraft.com

"tamar" <tamarlev(a)hotmail.com> wrote in message
news:1120663707.630444.228930(a)g14g2000cwa.googlegroups.com...
> Thanks for your answer.
>
> I try to get a "pointer" to i8042 using IoGetDeviceObjectPointer , it
> fail , return status = 34 (STATUS_OBJECT_NAME_NOT_FOUND)
>
>
>
> RtlInitUnicodeString(&ObjectName, "\\Device\\i8042prt");
>
> status = IoGetDeviceObjectPointer(&ObjectName, FILE_READ_DATA ,
> &pFileObj, &pDeviceObj);
>
> where i go wrong?
>
> Thanks
> Tamar
>


From: Ray Trent on
If you're an upper filter, you should have gotten a PDO in AddDevice
that you pass to IoAttachDeviceToDeviceStack, which returns a pointer to
the driver you want to send all your IOCTLs too.

Even if you were able to get a direct i8042prt pointer, you wouldn't
want to bypass any other filters that might be attached between it and you.

tamar wrote:
> Thanks for your answer.
>
> I try to get a "pointer" to i8042 using IoGetDeviceObjectPointer , it
> fail , return status = 34 (STATUS_OBJECT_NAME_NOT_FOUND)
>
>
>
> RtlInitUnicodeString(&ObjectName, "\\Device\\i8042prt");
>
> status = IoGetDeviceObjectPointer(&ObjectName, FILE_READ_DATA ,
> &pFileObj, &pDeviceObj);
>
> where i go wrong?
>
> Thanks
> Tamar
>


--
.../ray\..