Discussion:
[libhid-discuss] Using libhid with composit device
Ali Asad
2009-03-12 00:15:38 UTC
Permalink
Hi,

I have two somewhat related questions regarding libhid on Linux (Ubuntu).

1. What is the difference betweeen hid_force_open() and hid_open()?
I read from the documentation and code comments that "force" version attempts to unmount the device to take control away from Linux hiddev driver. Is this step necessary? I say this because it may be related to the my second questions.

2. Is is possible to unmount only the HID enumeration of a device and leave any additional enunmerations still mounted? In my case, I have a USB memory stick that enumerates as a USB composite device: a mass storage device, and an HID device. When I call hid_force_open(), the mass storage drives on this device disappear. I assume the unmount call in hid_force_open() does this.

So, is there a way for me to access the HID part of the device through libhid without unmounting the complete device, or have I reached a dead-end in terms of supporting this device on Linux.

Best regards, and thanks for your help,
--- Asad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20090312/94509899/attachment.htm
Peter Stuge
2009-03-12 00:33:01 UTC
Permalink
Post by Ali Asad
2. Is is possible to unmount only the HID enumeration of a device
and leave any additional enunmerations still mounted?
Yes.
Post by Ali Asad
So, is there a way for me to access the HID part of the device
through libhid without unmounting the complete device, or have I
reached a dead-end in terms of supporting this device on Linux.
I think neither is the case.

Linux certainly allows userspace programs to detach only a single
interface out of several implemented.

But, you may have to program libusb or even usbfs directly, and not
use libhid.

But it may also be a simple fix for libhid, allowing you to continue
using libhid.


//Peter
Ali Asad
2009-03-12 00:50:19 UTC
Permalink
Peter, thanks for the prompt & to-the-point reply, and for keeping my hopes up. I will investigate further and see if using libusb provides a faster path for me.

regards,
--- asad

-----Original Message-----
From: libhid-discuss-bounces+asad.ali=gemalto.com at lists.alioth.debian.org [mailto:libhid-discuss-bounces+asad.ali=gemalto.com at lists.alioth.debian.org] On Behalf Of Peter Stuge
Sent: Wednesday, March 11, 2009 7:33 PM
To: libhid-discuss at lists.alioth.debian.org
Subject: Re: [libhid-discuss] Using libhid with composit device
Post by Ali Asad
2. Is is possible to unmount only the HID enumeration of a device and
leave any additional enunmerations still mounted?
Yes.
Post by Ali Asad
So, is there a way for me to access the HID part of the device through
libhid without unmounting the complete device, or have I reached a
dead-end in terms of supporting this device on Linux.
I think neither is the case.

Linux certainly allows userspace programs to detach only a single interface out of several implemented.

But, you may have to program libusb or even usbfs directly, and not use libhid.

But it may also be a simple fix for libhid, allowing you to continue using libhid.


//Peter

Loading...