[libhid-discuss] Talking to an HID device from user account in Linux

Ali Asad Asad.Ali at gemalto.com
Tue Mar 31 04:24:48 UTC 2009


Xiaofan Chen wrote:
> You need to use udev rules.
> Ubuntu is quite consistent in terms of udev rules.
> http://piklab.wiki.sourceforge.net/USB+Port+Problems

Thanks for the pointer. The first paragraph at this link states ...

"You need to have read and write access to the port (serial, parallel or USB).
Some distributions do not grant read/write access to regular users by default ..."

I understand that the end user would have to use udev rules before they can use the HID device. However, these distributions do allow HID devices to be connected and used without the user doing anything. For example, you can connect a USB mouse (a HID device) without requiring root access or forcing the user to use udev rules.

How are user mode applications able to talk to such HID devices? Is that through some generic/universal HID device driver supported by the Linux kernal (say uhid)? If so how do user applications use this universal HID driver? This technique would be orthogonal to the approach of using libhid to create our own device driver, but I want to explore all options.

regards,
--- asad



-----Original Message-----
From: Xiaofan Chen [mailto:xiaofanc at gmail.com]
Sent: Monday, March 30, 2009 6:41 PM
To: Ali Asad
Cc: libhid-discuss at lists.alioth.debian.org
Subject: Re: [libhid-discuss] Talking to an HID device from user account in Linux

2009/3/31 Ali Asad <Asad.Ali at gemalto.com>:
> As I understand it, the use of libhid requires root access in order to
> read-write from the device, right? This is how I have tested my application.
> Is there another way to talk to the HID device so that root access is
> not required? If so what would I need to do from my application, and
> more importantly, what would the end-user have to do on their Linux
> machines in order to run this application? I am targeting the Ubuntu distribution.
>

You need to use udev rules.
Ubuntu is quite consistent in terms of udev rules.
http://piklab.wiki.sourceforge.net/USB+Port+Problems

Regards,
Xiaofan



More information about the libhid-discuss mailing list