* [PATCH] HID: core: dump events in hidraw even if raw_event() returns > 0
@ 2013-04-18 16:55 Benjamin Tissoires
0 siblings, 0 replies; only message in thread
From: Benjamin Tissoires @ 2013-04-18 16:55 UTC (permalink / raw)
To: Jiri Kosina, Dmitry Torokhov, Benjamin Tissoires, linux-input,
linux-kernel
Cc: Benjamin Tissoires
If raw_events() returns a value not equal to 0, the processing stops.
However, I think we should still forward the events to the hidraw node,
unless there is an error in raw_event() marked by a negative value.
For instance, hid-magicmouse stops the processing because the device
use a hidden collection (not declared in hid reports descriptor), making
hid-core lost when dealing with it. However, forwarding it to the
user-space through hidraw is harmless and can help debugging the driver.
Of course, hid debugfs can be used, but there is currently a problem with
the output beeing too small for some devices and it adds processing in the
kernel because debugfs returns human readable strings outputs.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
---
Hi Jiri,
well, this is the patch I mentioned earlier.
I don't think it will break anything, but I don't know how many applications
use hidraw and will be hurt by receiving more events. I did a quick review
of all hid drivers, and some of them are returning 1 in their raw_event().
The only problematic one is hid-primax, which manually calls
hid_report_raw_event() before returning 1... which is... weird.
Anyway, I would like your advice on this, if you think it's valuable or if
we should drop it and continue with the current implementation.
Cheers,
Benjamin
drivers/hid/hid-core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 1129f49..e0b8175 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1315,6 +1315,8 @@ nomem:
if (hdrv && hdrv->raw_event && hid_match_report(hid, report)) {
ret = hdrv->raw_event(hid, report, data, size);
if (ret != 0) {
+ if (ret > 0 && (hid->claimed & HID_CLAIMED_HIDRAW))
+ ret = hidraw_report_event(hid, data, size);
ret = ret < 0 ? ret : 0;
goto unlock;
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-04-18 16:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18 16:55 [PATCH] HID: core: dump events in hidraw even if raw_event() returns > 0 Benjamin Tissoires
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).