On Fri, 13 Apr 2007, John Wojnaroski wrote:

> I'm writing a simple little driver to read three bytes from a hid device 
> when plugged in it reports as hiddev96:__________--usb-0000:00:1d.0-2 
> and shows up in /dev/usb/hiddev0 and is enumerated in 
> /proc/bus/usb/devices. Thinking a simple usb_control_msg will be good 
> and simple enough to have the device send the three bytes

Hi John,

there have been various discussions lately about many topics related to 
your question - please crawl through the list archives if interested (the 
best keywords probably are "hid bus", "hiddev", "hidraw").

> Is there a way to do that with the hid interface using ioctl 
> open/read/write functions or will it be necessary to use the 
> usb_control_msg(...)  call directly?

What you describe is unfortunately not doable (in a trivial way) through 
hiddev - hiddev works in a way that it parses the reports based on the 
information obtained from the device's report descriptor, and processess 
the fields for outgoing reports also in this respect.

Therefore it is not well suitable for straigforward submission of 'raw' 
HID data. Unfortunately, it's often what userland applications want most - 
they are willing to send the raw hid data to the device and don't want the 
kernel to tamper it in any way. There may be many reasons for them doing 
so, the most significant is broken/undocumented devices which have report 
descriptor that confuses the in-kernel HID layer and it parses 
reports/fields incorrectly.

This is why many applications chose to use libhid/libusb instead. This 
passes the data directly to the USB transport layer, without letting the 
HID layer to touch it.
And this is also the reason for the new 'hidraw' interface being created - 
the current prototype of mostly-feature-less version is in current -mm 
kernels, and also in the HID git tree.
It's possible that both the API and the internals of the hidraw interface 
will change before being merged into mainline - most importantly there is 
a hid bus coming soon (hopefully), which might change things. But it might 
be interesting for you to look at.

To sum things up - currently, hiddev doesn't seem to be a feasible option 
for you. You can either use libhid/libusb and submit the data directly to 
USB transport, or you can experiment with kernel-provided lightweight 
hidraw interface in -mm, but it's not guaranteed to be in a frozen-API 
state yet.

Hope this helps, 

-- 
Jiri Kosina

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to