All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Add GET/SET_REPORT support to HoG
@ 2014-11-21 14:41 David Herrmann
  2014-11-21 14:41 ` [PATCH 1/4] hog: import latest uhid.h definition David Herrmann
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: David Herrmann @ 2014-11-21 14:41 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: Benjamin Tissoires, Marcel Holtmann, Johan Hedberg,
	David Herrmann

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


diff --git a/set_touchmode.c b/set_touchmode.c
index 7e5d59a..0e6f412 100644
--- a/set_touchmode.c
+++ b/set_touchmode.c
@@ -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(-)

-- 
2.1.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-11-26  8:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 14:41 [PATCH 0/4] Add GET/SET_REPORT support to HoG David Herrmann
2014-11-21 14:41 ` [PATCH 1/4] hog: import latest uhid.h definition David Herrmann
2014-11-21 14:41 ` [PATCH 2/4] hog: break out the report retrieval in its own function David Herrmann
2014-11-21 14:41 ` [PATCH 3/4] hog: implement get_report functionality David Herrmann
2014-11-21 14:41 ` [PATCH 4/4] hog: implement set_report functionality David Herrmann
2014-11-21 14:58 ` [PATCH 0/4] Add GET/SET_REPORT support to HoG Benjamin Tissoires
2014-11-26  8:04 ` Johan Hedberg
2014-11-26  8:14   ` David Herrmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.