Skip to content

Add GET/SET_REPORT support to HoG

David Herrmann linux-bluetooth 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4hog: import latest uhid.h definitionprofiles/input/uhid_copy.h+105 -120 replies
2/4hog: break out the report retrieval in its own functionprofiles/input/hog.c+25 -170 replies
3/4hog: implement get_report functionalityprofiles/input/hog.c+86 -00 replies
4/4hog: implement set_report functionalityprofiles/input/hog.c+76 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] Add GET/SET_REPORT support to HoG

Hi

With linux-3.18 uhid will gain GET/SET_REPORT support. 3.18 isn't released, yet, but the uhid features are part of 3.18-rc5 so I think it's fine to rely on it. We can always revert it if it will not be released (for whatever reason..).

Benjamin wrote these 4 patches about 2 months ago and I promised to fix a few bugs and send them upstream. I already feel bad for letting them rot for 2 months.. sorry!

Anyway, I fixed the ID tracking, some typos, and fixed handling of devices that dont send report IDs in GET_REPORT. Patches should be straightforward. The GET/SET_REPORT feature is important for nearly all non-standard HID device drivers. It's used to query and modify device behavior. With this in place, we should be able to use all the kernel hid drivers via uhid/hog.

Benjamin has an example program to modify MS Arc Surface Touch mouse behavior, which needs these patches to query/modify the device. See:
https://github.com/bentiss/mstouchmouse/tree/WIP-USB
(If you check it out, make sure to use the WIP-USB branch! You should also apply
the diff below, to make sure it works even if the report-ID is not prepended.)

Works fine with my devices here!
David

set_touchmode.c +5 -0
index 7e5d59a..0e6f412 100644
@@ -48,6 +48,11 @@ static int get_report(int fd, unsigned char id, ...
     } else {
         printf("Report data (%d):\n\t", id);
         pr_buffer(buf, res);
+        /* prepend report-ID if not sent by device */
+        if (res > 0 && buf[0] != id) {
+            memmove(buf + 1, buf, (res >= len) ? (res - 1) : res);
+            buf[0] = id;
+        }
     }
     return res;
 }

Benjamin Tissoires (4):
hog: import latest uhid.h definition
hog: break out the report retrieval in its own function
hog: implement get_report functionality
hog: implement set_report functionality

 profiles/input/hog.c       | 204 +++++++++++++++++++++++++++++++++++++++++----
 profiles/input/uhid_copy.h | 117 +++++++++++++++++++++++---
 2 files changed, 292 insertions(+), 29 deletions(-)
Signature · 1 line
2.1.3