Vojtech Pavlik wrote:
On Sun, Mar 06, 2005 at 09:56:24AM -0500, Adam Kropelin wrote:

hid-core contains the following bit of code in hid_input_report:

if (hid->claimed & HID_CLAIMED_HIDDEV)
hiddev_report_event(hid, report);

for (n = 0; n < report->maxfield; n++)
hid_input_field(hid, report->field[n], data, regs);

if (hid->claimed & HID_CLAIMED_INPUT)
hidinput_report_event(hid, report);

From this, it seems that hiddev is notified of the report before the
fields of the report have been updated with new values. This isn't a
problem since hiddev cares only that the report changed, not what its
value is.

It feels counterintuitive, though, and some unsuspecting soul might
change hiddev such that it wants the value immediately. Is the
current behavior by design?

Well, right now an application using hiddev gets the report arrival event first, and then all value change events after that. It seems counterintuitive, but I don't think we can change it without breaking applications.

Ah, yes. Makes perfect sense, and I definitely wouldn't change it.

Honestly, hiddev needs to be killed and replaced by something which
just passes reports around instead of trying to decode them in the
kernel.

I agree completely. One of the issues I'm facing at the moment is dealing with buggy devices via hiddev. Some APC UPSes are rather cavalier about sending the proper number of bytes in a usage value; they often send fewer than the report descriptor claims. Userspace could work around this sort of thing if it had control of the report decoding. At the moment I'm contemplating various potential kernel workarounds, but it's risky since any change would affect all HID devices, not just the ones I know to broken.


--Adam



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to