diff options
author | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2013-05-15 22:51:44 +0300 |
---|---|---|
committer | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2013-05-16 00:22:42 +0300 |
commit | 43ff6178e6d318a0149f09db37e00c82c913457d (patch) | |
tree | d03505d31668eb4a2b4d0fbc71699199d7923028 | |
parent | 81eab80f40fd6c0d7ffb3734e27480ea5617807a (diff) | |
download | usbhid-dump-huion.tar.gz |
Add Huion tablet enablinghuion
Add enabling of Huion proprietary tablet mode to stream dumping
initialization.
Signed-off-by: Martin Rusko <martin.rusko@gmail.com>
Tested-by: Martin Rusko <martin.rusko@gmail.com>
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | include/uhd/iface.h | 10 | ||||
-rw-r--r-- | lib/iface.c | 23 | ||||
-rw-r--r-- | src/usbhid-dump.c | 4 |
4 files changed, 38 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 98ac558..bdcd93e 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([usbhid-dump], [1.3]) +AC_INIT([usbhid-dump], [1.3-huion]) AC_CONFIG_AUX_DIR([auxdir]) AM_INIT_AUTOMAKE([1.9 -Wall foreign]) AM_MAINTAINER_MODE diff --git a/include/uhd/iface.h b/include/uhd/iface.h index d6bd67d..5eea32b 100644 --- a/include/uhd/iface.h +++ b/include/uhd/iface.h @@ -149,6 +149,16 @@ extern enum libusb_error uhd_iface_set_protocol( unsigned int timeout); /** + * Enable Huion proprietary tablet mode. + * + * @param iface + * + * @return Libusb error code. + */ +extern enum libusb_error uhd_iface_huion_enable_tablet( + const uhd_iface *iface); + +/** * Clear halt condition on the input interrupt endpoint of an interface. * * @param iface The interface to clear halt condition on. diff --git a/lib/iface.c b/lib/iface.c index 7209188..a8fd8f0 100644 --- a/lib/iface.c +++ b/lib/iface.c @@ -240,4 +240,27 @@ uhd_iface_set_protocol(const uhd_iface *iface, return LIBUSB_SUCCESS; } +enum libusb_error +uhd_iface_huion_enable_tablet(const uhd_iface *iface) +{ + int rc; + unsigned char data[22]; + + assert(uhd_iface_valid(iface)); + + rc = libusb_get_string_descriptor(iface->dev->handle, + /* descriptor index */ + 0x64, + /* LANGID, English (United States) */ + 0x0409, + /* data from the descriptor */ + (unsigned char *)data, + sizeof(data) + ); + + if (rc < 0 && rc != LIBUSB_ERROR_PIPE) + return rc; + + return LIBUSB_SUCCESS; +} diff --git a/src/usbhid-dump.c b/src/usbhid-dump.c index 56a2956..8aaa224 100644 --- a/src/usbhid-dump.c +++ b/src/usbhid-dump.c @@ -319,6 +319,10 @@ dump_iface_list_stream(libusb_context *ctx, /* Set infinite idle duration */ LIBUSB_IFACE_GUARD(uhd_iface_set_idle(iface, 0, UHD_IO_TIMEOUT), iface, "set infinite idle duration"); + + /* Enable Huion proprietary tablet mode */ + LIBUSB_IFACE_GUARD(uhd_iface_huion_enable_tablet(iface), + iface, "enable Huion proprietary tablet mode"); } /* Calculate number of interfaces and thus transfers */ |