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

Ali Asad Asad.Ali at gemalto.com
Wed Apr 1 23:28:36 UTC 2009


Xiaofan Chen wrote:
> You may still need to write a udev rule even if you use the hiddev
> or hidraw interface unless the system has already udev rules
> in place.

I created the udev rule for my device and copied it to the /etc/udev/rules.d directory. Had to do it using root access (no surprises there), but I can now talk to my Hid device from user mode; which is good news.

I am now looking for a 'seamless' way for the end-users of this device to apply this udev rule on their Linux systems. They do this once and on each subsequent use the application works from use account. I can have my application write the rules file to /etc/udev/rules.d directory but for this I would need root access. What is the best way for a C application to ask user to type the root password and then use it to gain root access. Once this is done, the application can then write the rules file.

Best regards, and many thanks for your continued help.

--- 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 Xiaofan Chen
Sent: Tuesday, March 31, 2009 12:15 AM
To: libhid-discuss at lists.alioth.debian.org
Subject: Re: [libhid-discuss] Talking to an HID device from user account in Linux

On Tue, Mar 31, 2009 at 12:47 PM, Peter Stuge <stuge-libhid at cdy.org> wrote:
>> This technique would be orthogonal to the approach of using libhid
>> to create our own device driver, but I want to explore all options.
>
> Then you could also look into hiddev and/or hidraw. They can be used
> to communicate with HID devices at a higher level than USB.
>
> CONFIG_HID_DEV /usr/src/linux/Documentation/usb/hiddev.txt
> CONFIG_HIDRAW http://cateee.net/lkddb/web-lkddb/HIDRAW.html (brief)
>
> hiddev may come with restrictions on which non-HID-class things your
> device can do however - but still worth looking into.

You may still need to write a udev rule even if you use the hiddev
or hidraw interface unless the system has already udev rules
in place.

I am not familiar with hiddev but there is an example here.
http://openprog.altervista.org/OP_eng.html

Last time it is said that hiddev is not a good option for generic
HID device but hidraw might be an option.
http://osdir.com/ml/lib.libusb.devel.general/2007-04/msg00233.html

Xiaofan

_______________________________________________
libhid-discuss mailing list
libhid-discuss at lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss
http://libhid.alioth.debian.org/



More information about the libhid-discuss mailing list