[libhid-discuss] example program kills hiddev device node

Tino Keitel tino.keitel at tikei.de
Sun Nov 11 23:17:41 UTC 2007


On Sun, Nov 11, 2007 at 23:20:43 +0100, Tino Keitel wrote:
> On Sun, Nov 11, 2007 at 17:05:58 -0500, Charles Lepple wrote:
> > [Please don't cross-post. Thanks.]
> >
> > On Nov 11, 2007, at 4:17 PM, Tino Keitel wrote:
> >
> >> I tried to use a tool called hidmon to control man TFT over USB. That
> >> worked a few times, but now I noticed that the hiddev device node in
> >> /dev/usb/ went away. I didn't kow why. I rebooted the computer, changed
> >> from Linux 2.6.23.1 to 2.6.22, powercycled the TFT, without luck. As
> >> soon as I use hidmon, the device node is gone.
> >>
> >> Now I compiled the libhid test program test_libhid.c and got the same
> >> effect. It seems like hid_force_open() kills the device, as udev
> >> receives a remote udevent.
> >
> > This is intentional. libhid is a cross-platform alternative to the Linux 
> > hiddev API, and as such, it detaches the kernel hiddev driver from the 
> > device (technically, from the HID interface, but USB devices often only 
> > have one interface). This is necessary for libhid or libusb to claim the 
> > device exclusively. Since the kernel hiddev driver no longer sees the 
> > device, udev removes the device node. (The usbdevfs node still remains, and 
> > that is what libusb and libhid use to communicate with the device.)
> 
> Yes, my fault, sorry.
> 
> Meanwhile, I found out that libhid has to detatch the device from the
> driver.
> 
> However, test_libhid, which works with 2.6.22, doesn't work anymore
> with 2.6.23.1. The tool that I initially wanted to use (hidmon) also
> works with 2.6.22, but not with 2.6.23.

Sorry again. Now it works with 2.6.23, too. I changed nothing, just
rebooted to the same 2.6.23 kernel that I used before when it didn't
work. I guess it will refuse to work again when I really need it.

Regards,
Tino



More information about the libhid-discuss mailing list