reading raw data from USB device using HAL

Vikas N Kumar vikasnkumar at users.sourceforge.net
Wed Sep 24 08:01:45 PDT 2008


Hi

My HAL version is 0.5.10 and D-BUS version is 1.1.20.

I am trying to write an application that reads raw data from a custom
USB device  using HAL and/or D-BUS. The device has been made by me as
a part of a project, and I am trying to write a front end application
for it, that can access the raw packets/reports from the USB device
without the user having to modify his udev rules or doing anything
that needs root permissions. Currently I use libusb, but the problem
with my kernel 2.6.26.2 or any other 2.6.* kernel is that my device
gets the permission 0640 when loaded by the kernel, which makes any
user program need to do a sudo or run as root, or explicitly modify
udev.rules to change the 0640 to 0644, to be able to
read/claim-interface on the USB device. If I want to test the device
on multiple Linux machines/distributions, it is painful to do udev
changes everywhere and I do not think that it is ideal. I decided to
use the HAL/D-BUS combination to see if I can do something.

So far I have reached the point where HAL identifies the device when
plugged in and I can retrieve all the property sets for the multiple
interfaces on my USB device. However, I do not know how to read data
from the USB device. Also how would I claim the USB interface ? I see
that HAL has a libhal_device_claim_interface() but what should go in
"introspection_xml" variable. I was not able to find any good example
for USB data reading using HAL in the archives, since most were for
storage devices.

HAL also gives me the device file in linux.device_file which I would
like to open and start reading, but does HAL/D-BUS give an API to do
all this or will I have to use the low-level ioctl() or libusb calls ?

If anyone can point me in the right direction, I will be grateful.

Thanks & regards
Vikas Kumar




-- 
http://www.vikaskumar.org/


More information about the hal mailing list