Jason Kotzin | 1 Feb 2010 20:59
Picon
Gravatar

Filter Driver for Single Devices

Libusb Community - 

I'm working on a project where I appear to the host as a USB hid keyboard.  I need the ability to send control
messages down to the device.  I have made a custom device driver, however, once this custom libusb device
driver is installed, windows no longer recognizes the device as a keyboard, I can no longer send keyboard keys.

I believe the correct solution is having a filter driver for the HID Keyboard device.  So here is my question:

Is there a way I can only use the filter driver on my device?  I don't want users to install this filter driver
for every usb device on their computer, only mine.  I would like to do this with a custom installer (similar
to the example included in libusb-win32-device-bin).  Is that possible?  If it is, can anyone provide some
details on how to do so? 

Thanks so much for your help, greatly appreciate it,
Jason

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Xiaofan Chen | 2 Feb 2010 00:57
Picon

Re: Filter Driver for Single Devices

On Tue, Feb 2, 2010 at 3:59 AM, Jason Kotzin <jasonkotzin <at> gmail.com> wrote:

> I believe the correct solution is having a filter driver for the HID
> Keyboard device.  So here is my question:
>
> Is there a way I can only use the filter driver on my device?
> I don't want users to install this filter driver for every usb device on
> their computer, only mine.

As far as I know, this is not possible. Please also take note
that the author once says that the filter driver will be deprecated
as it caused problems for Vista and Windows 7, even sometimes
XP.

--

-- 
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Jason Kotzin | 2 Feb 2010 01:02
Picon
Gravatar

Re: Filter Driver for Single Devices

Thanks so much for such a quick response, I really appreciate it.

Hypothetical question.  If I didn't use libusb, and I left the device as a windows HID device and default
driver, can I send down custom control messages with hidraw?  

How about libusb 1.0.  I read in some forums they have support (or better support) for HID devices?

If none of the above are possible, how can I talk to my HID keyboard in windows?  With setReports?  Last time I
tried that, windows locked the device and didn't let me do anything with it.

Thank you again so much for your help.

Jason

On Feb 1, 2010, at 3:57 PM, Xiaofan Chen wrote:

> On Tue, Feb 2, 2010 at 3:59 AM, Jason Kotzin <jasonkotzin <at> gmail.com> wrote:
> 
>> I believe the correct solution is having a filter driver for the HID
>> Keyboard device.  So here is my question:
>> 
>> Is there a way I can only use the filter driver on my device?
>> I don't want users to install this filter driver for every usb device on
>> their computer, only mine.
> 
> As far as I know, this is not possible. Please also take note
> that the author once says that the filter driver will be deprecated
> as it caused problems for Vista and Windows 7, even sometimes
> XP.
> 
(Continue reading)

Xiaofan Chen | 2 Feb 2010 02:12
Picon

Re: Filter Driver for Single Devices

On Tue, Feb 2, 2010 at 8:02 AM, Jason Kotzin <jasonkotzin <at> gmail.com> wrote:
> Hypothetical question.  If I didn't use libusb, and I left the device as
> a windows HID device and default driver, can I send down custom control
> messages with hidraw?

I think this is ok. You can use the Raw Input API.
http://www.lvr.com/hidfaq.htm
http://msdn.microsoft.com/en-us/library/ms645536(VS.85).aspx

************** Quote the LVR HID FAQ Page ************
1) Why do I receive "Access denied" when attempting to access my HID?

Windows 2000 and later have exclusive read/write access to HIDs that
are configured as a system keyboards or mice. An application can obtain
a handle to a system keyboard or mouse by not requesting READ or
WRITE access with CreateFile. Applications can then use HidD_SetFeature
and HidD_GetFeature (if the device supports Feature reports).

2) How can applications receive Input reports from a system mouse or keyboard?

The Windows raw input API enables applications to read Input reports
when communicating with system mice and keyboards.

3) On a system with multiple keyboards, mice, or joysticks how can my
application determine which device is sending data?

Use raw input (see previous question).
**************************

So one way is to support feature report in your device firmware.
(Continue reading)

Jason Kotzin | 2 Feb 2010 03:08
Picon
Gravatar

Re: Filter Driver for Single Devices

Great, thanks so much for your help and support, greatly appreciate it.


Jason


On Mon, Feb 1, 2010 at 5:12 PM, Xiaofan Chen <xiaofanc <at> gmail.com> wrote:
On Tue, Feb 2, 2010 at 8:02 AM, Jason Kotzin <jasonkotzin <at> gmail.com> wrote:
> Hypothetical question.  If I didn't use libusb, and I left the device as
> a windows HID device and default driver, can I send down custom control
> messages with hidraw?

I think this is ok. You can use the Raw Input API.
http://www.lvr.com/hidfaq.htm
http://msdn.microsoft.com/en-us/library/ms645536(VS.85).aspx

************** Quote the LVR HID FAQ Page ************
1) Why do I receive "Access denied" when attempting to access my HID?

Windows 2000 and later have exclusive read/write access to HIDs that
are configured as a system keyboards or mice. An application can obtain
a handle to a system keyboard or mouse by not requesting READ or
WRITE access with CreateFile. Applications can then use HidD_SetFeature
and HidD_GetFeature (if the device supports Feature reports).

2) How can applications receive Input reports from a system mouse or keyboard?

The Windows raw input API enables applications to read Input reports
when communicating with system mice and keyboards.

3) On a system with multiple keyboards, mice, or joysticks how can my
application determine which device is sending data?

Use raw input (see previous question).
**************************

So one way is to support feature report in your device firmware.
Then you can use Control Transfer to get the feature report.

>
> How about libusb 1.0.  I read in some forums they have support
> (or better support) for HID devices?

If it is a keyboard or mouse, it is the same for libusb 1.0 Windows
backend. You can use control transfer to talk to the HID device.
Please refer to the example xusb.c. But I have not tested the
HID backend. The WinUSB backend seems to work fine now.

http://git.libusb.org/?p=libusb-pbatard.git;a=blob;f=examples/xusb.c;h=9925f07f0679a0cde379319915fd44b0eb3646ed;hb=master

>
> If none of the above are possible, how can I talk to my HID
> keyboard in windows?  With setReports?  Last time I tried that,
> windows locked the device and didn't let me do anything with it.
>
Please refer to the above LVR HID FAQ answer.



--
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Libusb-win32-devel mailing list
Libusb-win32-devel <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusb-win32-devel
Gerhard Tüchler | 3 Feb 2010 08:40

usb_set_configuration blocks

Hello,

I'm trying to communicate with a Cypress USB chip using libusb on
windows xp.
usb_claim_interface(handle, 0) reports an error (invalid configuration 0)
But when calling usb_set_configuration(handle, 1), the function doesn't
return, the application blocks and even task manager can not kill it.

Can somebody help me.

Thanks in advance,
Gerhard

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Xiaofan Chen | 3 Feb 2010 11:41
Picon

Re: usb_set_configuration blocks

2010/2/3 Gerhard Tüchler <g.tuechler <at> consulting-ht.com>:
> I'm trying to communicate with a Cypress USB chip using libusb on
> windows xp.
> usb_claim_interface(handle, 0) reports an error (invalid configuration 0)
> But when calling usb_set_configuration(handle, 1), the function doesn't
> return, the application blocks and even task manager can not kill it.

Are you using the libusb-win32 device driver to replace the stock
Cypress driver?

--

-- 
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Gerhard Tüchler | 3 Feb 2010 11:51

Re: usb_set_configuration blocks

Xiaofan Chen schrieb:
> 2010/2/3 Gerhard Tüchler <g.tuechler <at> consulting-ht.com>:
>   
>> I'm trying to communicate with a Cypress USB chip using libusb on
>> windows xp.
>> usb_claim_interface(handle, 0) reports an error (invalid configuration 0)
>> But when calling usb_set_configuration(handle, 1), the function doesn't
>> return, the application blocks and even task manager can not kill it.
>>     
>
> Are you using the libusb-win32 device driver to replace the stock
> Cypress driver?
>
>
>   

No, I do not even have this cypress driver.
The device is recognized as USB-HID and a windows HID driver is loaded 
in windows xp.

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Xiaofan Chen | 3 Feb 2010 11:57
Picon

Re: usb_set_configuration blocks

2010/2/3 Gerhard Tüchler <g.tuechler <at> consulting-ht.com>:
> No, I do not even have this cypress driver.
> The device is recognized as USB-HID and a windows HID driver is loaded
> in windows xp.

I see. In that case, you have to replace the Windows HID driver
with libusb-win32 device driver.

I know this is a hassle. libusb-win32 1.0 has the HID backend
but the development has not progressed for some time.

You can try the libusb 1.0 Windows backend if you want.
It has the working WinUSB backend. It also has the
HID backend waiting for more tests.

--

-- 
Xiaofan http://mcuee.blogspot.com

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
Gerhard Tüchler | 3 Feb 2010 13:10

Re: usb_set_configuration blocks

Xiaofan Chen schrieb:
> 2010/2/3 Gerhard Tüchler <g.tuechler <at> consulting-ht.com>:
>   
>> No, I do not even have this cypress driver.
>> The device is recognized as USB-HID and a windows HID driver is loaded
>> in windows xp.
>>     
>
> I see. In that case, you have to replace the Windows HID driver
> with libusb-win32 device driver.
>   
Where can I get that libusb-win32 device driver?
> I know this is a hassle. libusb-win32 1.0 has the HID backend
> but the development has not progressed for some time.
>
> You can try the libusb 1.0 Windows backend if you want.
> It has the working WinUSB backend. It also has the
> HID backend waiting for more tests.
>   
How can I change to WinUSB backend?

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

Gmane