Re: Keyboard filter driver for the multimedia and power keys on a usb keyboard.
- From: "Doron Holan [MS]" <doronh@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 27 Jan 2006 18:29:31 -0800
you would filter the appropriate collections based on the hw ID
(HID_DEVICE_SYSTEM_CONSUMER for the app buttons, i don't have the pwr button
offhand). you would install yourself as an upper filter or the service on
both collecitons. for the power button, you should do the same as PS2
(clear out the flags in the ioctl). as for the consumer controls, you would
have to open the collection for exclusive access so that hidserv cannot open
them. once either collection is open, you would continuously polll the
collection by always haveing a read irp pending. what you do with the
results is up to you. see the firefly example for how a HID driver can open
itself up.
d
--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"lichtf" <lichtf@xxxxxxxxx> wrote in message
news:1138387035.041921.30300@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Robert,
>
> Thank you for your response.
>
> I actually need to suppress the keys for all applications, not only my
> own.
> What I have is a keyboard with the multi-media keys. These keys have
> different pictures and labels on them that link to my application. So
> I need to prevent these keys from doing what they normally do, by
> eating them, and I need to notify my application when they are pressed.
> If my application isn't running I still need to eat them. Is there a
> way I can do this before the service gets them and posts the
> WM_APPCOMMAND?
>
> Another problem is the Power buttons. Even in PS/2 if I ate the keys
> they still ended up working, ie. shut down the machine. I found a way
> to disable them by using the following code in the
> IRP_MJ_DEVICE_CONTROL function on the IOCTL_GET_SYS_BUTTON_CAPS control
> code:
>
> ULONG caps;
>
> caps = 0x0;
>
> if(Irp->PendingReturned)
> IoMarkIrpPending(Irp);
>
> //
> // Get the current value.
> //
> caps = *(PULONG) Irp->AssociatedIrp.SystemBuffer;
> //
> // Clear all the bits related to power.
> //
> caps &= ~(SYS_BUTTON_SLEEP | SYS_BUTTON_POWER | SYS_BUTTON_WAKE);
>
> //
> // Set the new value.
> //
> *(PULONG) Irp->AssociatedIrp.SystemBuffer = caps;
>
> Do you know if there is a way that I can disable the power buttons
> functionality, but still get notified about them, for a USB keyboard?
>
> Thanks for the help.
>
.
- Follow-Ups:
- References:
- Prev by Date: Re: Sending URBs from an upper function filter
- Next by Date: Re: How to check if a spin lock has been freed or released?
- Previous by thread: Re: Keyboard filter driver for the multimedia and power keys on a usb keyboard.
- Next by thread: Re: Keyboard filter driver for the multimedia and power keys on a usb keyboard.
- Index(es):