diff options
author | Nikolai Kondrashov <spbnick@gmail.com> | 2010-07-22 13:19:44 +0000 |
---|---|---|
committer | Nikolai Kondrashov <spbnick@gmail.com> | 2010-07-22 13:19:44 +0000 |
commit | 16d793f5bae71e72a3edcdb24431ad06a1995cc3 (patch) | |
tree | cb5fb0ec99e0e947a3dbb422794e6e407094e4ed /lib | |
parent | 94328c20c37b8789c19205e877123499b18d49bb (diff) | |
download | usbhid-dump-16d793f5bae71e72a3edcdb24431ad06a1995cc3.tar.gz |
Added (somewhat dummy) Set_Protocol and Set_Idle requests to stream dumping setup.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/iface.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/iface.c b/lib/iface.c index f78fef5..0b173a9 100644 --- a/lib/iface.c +++ b/lib/iface.c @@ -302,6 +302,66 @@ hid_dump_iface_list_clear_halt(hid_dump_iface *list) enum libusb_error +hid_dump_iface_list_set_idle(const hid_dump_iface *list, + uint8_t duration, + unsigned int timeout) +{ + int rc; + + assert(hid_dump_iface_list_valid(list)); + + for (; list != NULL; list = list->next) + { + rc = libusb_control_transfer(list->handle, + /* host->device, class, interface */ + 0x21, + /* Set_Idle */ + 0x0A, + /* duration for all report IDs */ + duration << 8, + /* interface */ + list->number, + NULL, 0, + timeout); + if (rc < 0) + return rc; + } + + return LIBUSB_SUCCESS; +} + + +enum libusb_error +hid_dump_iface_list_set_protocol(const hid_dump_iface *list, + bool report, + unsigned int timeout) +{ + int rc; + + assert(hid_dump_iface_list_valid(list)); + + for (; list != NULL; list = list->next) + { + rc = libusb_control_transfer(list->handle, + /* host->device, class, interface */ + 0x21, + /* Set_Protocol */ + 0x0B, + /* 0 - boot, 1 - report */ + report ? 1 : 0, + /* interface */ + list->number, + NULL, 0, + timeout); + if (rc < 0) + return rc; + } + + return LIBUSB_SUCCESS; +} + + +enum libusb_error hid_dump_iface_list_release(hid_dump_iface *list) { enum libusb_error err; |