Has anybody ever worked with KDE inc. (EDM-4000 series) devices? - embedded

Has anybody ever worked with KDE inc. (EDM-4000 series) devices? Or with devices of "neighbor" series like KDM-47XY, KDM-57XY, etc.? EDM-4000 series (if exactly, my particular device is EDM-4954 VER :X1.01) is a motorized insertion type of MS & IC card Reader/Writer module with RS-232C interface for enterprise customers like banks. My problem is that I cannot get a successful ATR form the card, on power ON.
I send commands sequentially INIT - GET VERSION - ENTRY - STATUS REQUEST - IC POWER ON... But always receive status IC CARD NO ATR:
0X02 0X4E 0X38 0X31 0X31 0X33 0X03 0X46 0X0D
STX 'N' cm pm err0 err1 ETX BCC CR
0X31 0X33 err status means IC CARD NO ATR
Here is the full flow:
Opening port: /dev/ttyUSB0
0X02 0X43 0X30 0X30 0X33 0X32 0X34 0X30 0X33 0X30 0X30 0X30 0X30 0X31 0X30 0X03 0X77 0X0D
write INIT
2022/11/23 14:04:12 Write bytes: 18
Read attempt: 0
Start reader
Received:0X06 0X0D
reader: got data
2022/11/23 14:04:13 ACK received
write ENQ
2022/11/23 14:04:13 Write bytes: 2
Start reader
Received:0X02 0X50 0X30 0X30 0X30 0X31 0X32 0X32 0X32 0X31 0X32 0X03 0X63 0X0D
reader: got data
22212
INIT answer code is P ...OK
Track1: RW
Track2: RW
Track3: RW
JIS: RW
Support ICC: ICC able
0X02 0X43 0X3C 0X30 0X03 0X4C 0X0D
write get version type
2022/11/23 14:04:14 Write bytes: 7
Read attempt: 0
Start reader
Received:0X06 0X0D
reader: got data
2022/11/23 14:04:14 ACK received
write ENQ
2022/11/23 14:04:14 Write bytes: 2
Read attempt: 0
Start reader
Received:0X02 0X50 0X3C 0X30 0X30 0X31 0X28 0X20 0X45 0X44 0X4D 0X2D 0X34 0X39 0X35 0X34 0X20 0X56 0X45 0X52 0X20 0X3A 0X58 0X31 0X2E 0X30 0X31 0X20 0X29 0X03 0X0F 0X0D
reader: got data
( EDM-4954 VER :X1.01 )
0X02 0X43 0X32 0X31 0X03 0X43 0X0D
PLEASE INSERT A CARD AND PRESS A KEY
I got the byte [32] ( )
write ENTRY
2022/11/23 14:04:15 Write bytes: 7
Read attempt: 0
Start reader
Received:0X06 0X0D
reader: got data
2022/11/23 14:04:15 ACK received
write ENQ
2022/11/23 14:04:16 Write bytes: 2
Start reader
Received:0X02 0X50 0X32 0X31 0X30 0X32 0X03 0X52 0X0D
reader: got data
0X02 0X43 0X31 0X31 0X03 0X40 0X0D
write STATUS REQUEST /get char
I got the byte [32] ( )
2022/11/23 14:04:19 Write bytes: 7
Read attempt: 0
Start reader
Received:0X06 0X0D
reader: got data
2022/11/23 14:04:19 ACK received
write ENQ
2022/11/23 14:04:20 Write bytes: 2
Read attempt: 0
Start reader
Received:0X02 0X50 0X31 0X31 0X30 0X32 0X42 0X48 0X03 0X5B 0X0D
reader: got data
BH
0X02 0X43 0X38 0X31 0X03 0X49 0X0D
write IC POWER ON /get char
2022/11/23 14:04:20 Write bytes: 7
Read attempt: 0
Start reader
Received:0X06 0X0D
reader: got data
2022/11/23 14:04:20 ACK received
write ENQ
2022/11/23 14:04:20 Write bytes: 2
Start reader
Received:0X02 0X4E 0X38 0X31 0X31 0X33 0X03 0X46 0X0D
Unfortunately, such a behavior I have with all the IC cards I have, of various payment systems. What am I doing wrong? Or might my device be not OK? Cannot find any example, or community in the internet about these devices. Vendor also gives very few manuals. Might anybody have worked with this vendor? I work fine with a magnetic stripe, but I need ICC EMV mode now.

Related

New problem moving from Ubuntu Impish to Jammy; Bluetooth LE Remote pairing/connecting, but not creating /dev/input

Something happened between Impish and Jammy on my device, and my Xiaomi MiTV bluetooth remote control no longer works. After upgrading to 22.04, it just stopped creating a /dev/input, and has continued not working even switching to mainline kernel 5.17 (Jammy's 5.15.x doesn't work either) and the wishful thinking that every update on apt that shows up will fix it. It's been there since the pre-release and has remained ever since.
Device in question:
https://xiaomi-mi.ca/accessories-tv-box/xiaomi-mi-tv-mi-tv-box-bluetooth-remote-control/
I'm running Ubuntu Mate on an Odroid H2+ (j4115-based x86 SBC) as a media player. Bluetooth has been supplied via a BCM20702A-based IOGear BT4.0 adapter (driver installed), but I've also tried a (legit) CSR8510-based BT4.0 adapter with similar results.
It's a bit finicky, but pairs fine if certain steps are followed—but it's been that way with this remote and every ELEC I've had in the past that I've had in the past (PI ArmHF /Odroid ARM64). Note: It pairs and is usable on Windows, MacOS and iOS and pre-Jammy versions of Ubuntu.
Addresses obfuscated to protect the innocent…
REMOTE & CONTROLLER from bluetoothctl:
[XiaoMi RC]# info
Device F4:XX:XX:XX:XX:XX (public)
Name: XiaoMi RC
Alias: XiaoMi RC
Appearance: 0x03c0
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
WakeAllowed: yes
LegacyPairing: no
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Immediate Alert (00001802-0000-1000-8000-00805f9b34fb)
UUID: Link Loss (00001803-0000-1000-8000-00805f9b34fb)
UUID: Tx Power (00001804-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)
UUID: Scan Parameters (00001813-0000-1000-8000-00805f9b34fb)
Modalias: bluetooth:v2717p3200d0110
Battery Percentage: 0x47 (71)
[XiaoMi RC]# show 5C:XX:XX:XX:XX:XX
Controller 5C:XX:XX:XX:XX:XX (public)
Name: mybox
Alias: mybox
Class: 0x00000104
Powered: yes
Discoverable: no
DiscoverableTimeout: 0x000000b4
Pairable: yes
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d0540
Discovering: no
Roles: central
Roles: peripheral
Advertising Features:
ActiveInstances: 0x00 (0)
SupportedInstances: 0x05 (5)
SupportedIncludes: tx-power
SupportedIncludes: appearance
SupportedIncludes: local-name
LSUSB:
Bus 001 Device 005: ID 0a5c:21e8 Broadcom Corp. BCM20702A0 Bluetooth 4.0
busctl:
busctl introspect 'org.bluez' '/org/bluez/hci0/dev_F4_XX_XX_XX_XX_XX'
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
org.bluez.Battery1 interface - - -
.Percentage property y 71 emits-change
org.bluez.Device1 interface - - -
.CancelPairing method - - -
.Connect method - - -
.ConnectProfile method s - -
.Disconnect method - - -
.DisconnectProfile method s - -
.Pair method - - -
.Adapter property o "/org/bluez/hci0" emits-change
.Address property s "F4:XX:XX:XX:XX:XX" emits-change
.AddressType property s "public" emits-change
.Alias property s "XiaoMi RC" emits-change writable
.Appearance property q 960 emits-change
.Blocked property b false emits-change writable
.Class property u - emits-change
.Connected property b true emits-change
.Icon property s - emits-change
.LegacyPairing property b false emits-change
.ManufacturerData property a{qv} - emits-change
.Modalias property s "bluetooth:v2717p3200d0110" emits-change
.Name property s "XiaoMi RC" emits-change
.Paired property b true emits-change
.RSSI property n - emits-change
.ServiceData property a{sv} - emits-change
.ServicesResolved property b true emits-change
.Trusted property b true emits-change writable
.TxPower property n - emits-change
.UUIDs property as 9 "00001800-0000-1000-8000-00805f9b34fb… emits-change
.WakeAllowed property b true emits-change writable
org.freedesktop.DBus.Introspectable interface - - -
.Introspect method - s -
org.freedesktop.DBus.Properties interface - - -
.Get method ss v -
.GetAll method s a{sv} -
.Set method ssv - -
.PropertiesChanged signal sa{sv}as -
a few odd messages in syslog, but nothing that screams "major fail":
:~$ cat /var/log/syslog | grep "Blue"
Apr 5 22:50:24 mybox systemd[1]: Starting Bluetooth management mechanism...
Apr 5 22:50:24 mybox kernel: [ 7.337177] Bluetooth: Core ver 2.22
Apr 5 22:50:24 mybox kernel: [ 7.337217] Bluetooth: HCI device and connection manager initialized
Apr 5 22:50:24 mybox kernel: [ 7.337222] Bluetooth: HCI socket layer initialized
Apr 5 22:50:24 mybox kernel: [ 7.337227] Bluetooth: L2CAP socket layer initialized
Apr 5 22:50:24 mybox kernel: [ 7.337234] Bluetooth: SCO socket layer initialized
Apr 5 22:50:24 mybox kernel: [ 7.575381] Bluetooth: hci0: BCM: chip id 63
Apr 5 22:50:24 mybox kernel: [ 7.576384] Bluetooth: hci0: BCM: features 0x07
Apr 5 22:50:24 mybox kernel: [ 7.592401] Bluetooth: hci0: BCM20702A
Apr 5 22:50:24 mybox kernel: [ 7.592411] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
Apr 5 22:50:24 mybox kernel: [ 7.594649] Bluetooth: hci0: BCM20702A1 'brcm/BCM20702A1-0a5c-21e8.hcd' Patch
Apr 5 22:50:24 mybox kernel: [ 8.196379] Bluetooth: hci0: unexpected event 0xff length: 2 > 0
Apr 5 22:50:24 mybox systemd[1]: Started Bluetooth management mechanism.
Apr 5 22:50:24 mybox kernel: [ 8.518390] Bluetooth: hci0: Broadcom Bluetooth Device
Apr 5 22:50:24 mybox kernel: [ 8.518400] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1764
Apr 5 22:50:24 mybox systemd[1]: Starting Bluetooth service...
Apr 5 22:50:24 mybox bluetoothd[970]: Bluetooth daemon 5.64
Apr 5 22:50:24 mybox systemd[1]: Started Bluetooth service.
Apr 5 22:50:24 mybox NetworkManager[699]: <info> [1649213424.6320] Loaded device plugin: NMBluezManager (/usr/lib/x86_64-linux-gnu/NetworkManager/1.36.4/libnm-device-plugin-bluetooth.so)
Apr 5 22:50:24 mybox systemd[1]: Reached target Bluetooth Support.
Apr 5 22:50:24 mybox kernel: [ 8.948829] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Apr 5 22:50:24 mybox kernel: [ 8.948837] Bluetooth: BNEP filters: protocol multicast
Apr 5 22:50:24 mybox kernel: [ 8.948843] Bluetooth: BNEP socket layer initialized
Apr 5 22:50:24 mybox bluetoothd[970]: Bluetooth management interface 1.21 initialized
Apr 5 22:50:36 mybox kernel: [ 20.341197] Bluetooth: RFCOMM TTY layer initialized
Apr 5 22:50:36 mybox kernel: [ 20.341222] Bluetooth: RFCOMM socket layer initialized
Apr 5 22:50:36 mybox kernel: [ 20.341233] Bluetooth: RFCOMM ver 1.11
Apr 5 22:56:28 mybox systemd[1777]: Reached target Bluetooth.
Apr 5 23:17:03 mybox systemd[1777]: Starting Bluetooth Manager...
Apr 5 23:17:03 mybox systemd[1777]: Started Bluetooth Manager.
Apr 5 23:17:25 mybox kernel: [ 1630.329450] Bluetooth: hci0: unexpected SMP command 0x0b from f4:xx:xx:xx:xx:xx
Apr 5 23:17:52 mybox blueman-manager[115657]: blueman.bluez.errors.BluezDBusException: org.freedesktop.DBus.Error.InvalidArgs No such interface 'org.bluez.Battery1'
Apr 6 06:21:33 mybox NetworkManager[660748]: <info> [1649240493.3391] Loaded device plugin: NMBluezManager (/usr/lib/x86_64-linux-gnu/NetworkManager/1.36.4/libnm-device-plugin-bluetooth.so)
The remote pairs and connects. I can obviously see it bluetoothctl. But no event is created in /dev/input:
me#mybox:~$ sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Power Button
/dev/input/event1: Power Button
/dev/input/event2: Video Bus
/dev/input/event3: Logitech K400 Plus
/dev/input/event4: Microsoft X-Box 360 pad
/dev/input/event5: Microsoft X-Box 360 pad
/dev/input/event6: Microsoft X-Box 360 pad
/dev/input/event7: Pulse-Eight CEC Adapter
/dev/input/event8: Microsoft X-Box 360 pad
/dev/input/event9: HDA Intel PCH Mic
/dev/input/event10: HDA Intel PCH Headphone
/dev/input/event11: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event12: HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event13: HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event14: HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event15: HDA Intel PCH HDMI/DP,pcm=10
Select the device event number [0-15]:
showkey and xev gets no keypresses, but btmon is seeing them:
me#mybox:~$ sudo btmon
Bluetooth monitor ver 5.64
= Note: Linux version 5.17.1-051701-generic (x86_64) 0.026997
= Note: Bluetooth subsystem version 2.22 0.027002
= New Index: 5C:XX:XX:XX:XX:XX (Primary,USB,hci0) [hci0] 0.027004
= Open Index: 5C:XX:XX:XX:XX:XX [hci0] 0.027004
= Index Info: 5C:XX:XX:XX:XX:XX (Broadcom Corporation) [hci0] 0.027005
# MGMT Open: bluetoothd (privileged) version 1.21 {0x0001} 0.027006
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #1 [hci0] 1.698718
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000510000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #2 [hci0] 1.774350
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #3 [hci0] 2.594360
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000520000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #4 [hci0] 2.754407
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #5 [hci0] 3.414342
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000500000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #6 [hci0] 3.574341
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #7 [hci0] 4.014365
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 00004f0000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #8 [hci0] 4.174358
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #9 [hci0] 4.674365
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000660000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #10 [hci0] 4.934380
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #11 [hci0] 5.794429
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000800000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #12 [hci0] 6.034380
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #13 [hci0] 7.194396
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000810000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #14 [hci0] 7.354432
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #15 [hci0] 8.454406
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 00004a0000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #16 [hci0] 8.694405
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #17 [hci0] 10.414431
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000650000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #18 [hci0] 10.654417
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #19 [hci0] 11.134410
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000f10000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #20 [hci0] 11.294427
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #21 [hci0] 12.094482
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000280000000000
> ACL Data RX: Handle 64 flags 0x02 dlen 15 #22 [hci0] 12.234598
ATT: Handle Value Notification (0x1b) len 10
Handle: 0x0032
Data: 0000000000000000
This is driving me nuts. Especially because another similar model of the same remote that uses AAA batteries instead of a coin-cell battery works (that one disconnects regularly, and is slow to reconnect however, but pairs fine, creates an input event and all keypresses are recognized).

Custom HID Gamepad works on Windows, has some inverted buttons in Linux

I've designed a custom gamepad using an STM32. It has four analog axes, and 22 buttons. I have written firmware for it, including the USB Descriptor (that took a few tries).
It works exactly as expected on Windows, but on Linux (Raspbian specifically) the last 5 buttons are inverted ("on" by default, "off" when pressed)
It is critical to my product that it work on both platforms (Mac too, but I don't have one to test right now)
Any ideas why this would be, and what to do about it?
Here's the output of lsusb -v for this device:
Bus 001 Device 003: ID 0483:5750 STMicroelectronics
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0483 STMicroelectronics
idProduct 0x5750
bcdDevice 2.00
iManufacturer 1 STMicroelectronics
iProduct 2 STM32 Custom Human interface
iSerial 3 74E79C303734
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0029
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xc0
Self Powered
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.11
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 53
Report Descriptor: (length is 53)
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x05 ] 5
Gamepad
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Local ): Usage, data= [ 0x01 ] 1
Pointer
Item(Main ): Collection, data= [ 0x00 ] 0
Physical
Item(Local ): Usage, data= [ 0x30 ] 48
Direction-X
Item(Local ): Usage, data= [ 0x31 ] 49
Direction-Y
Item(Local ): Usage, data= [ 0x32 ] 50
Direction-Z
Item(Local ): Usage, data= [ 0x33 ] 51
Rotate-X
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x0f ] 4095
Item(Global): Report Size, data= [ 0x10 ] 16
Item(Global): Report Count, data= [ 0x04 ] 4
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Global): Usage Page, data= [ 0x09 ] 9
Buttons
Item(Local ): Usage Minimum, data= [ 0x01 ] 1
Button 1 (Primary)
Item(Local ): Usage Maximum, data= [ 0x16 ] 22
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x16 ] 22
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x02 ] 2
Item(Main ): Input, data= [ 0x03 ] 3
Constant Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 10
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 10
Device Status: 0x0001
Self Powered
I also just noticed that the stick positions are different (again, correct on Windows, and wrong on Linux.)
I did read something about Linux having a kernel driver that does something to these values? jstest-gtk lets me control some aspects of the axes (scaling, dead zones, inversion) maybe that's a clue?

Increasing the volume of an HID device using feature reports

What hex code do I need to send to the device (and what report index) to trigger a volume change?
I'm trying to use HID feature reports to increase the volume of a Jabra 410 headset. The Jabra provides the following interface and report description:
https://pastebin.com/ES8ivMym
Report Descriptor: (length is 273)
Item(Global): Usage Page, data= [ 0x0c ] 12
Consumer
Item(Local ): Usage, data= [ 0x01 ] 1
Consumer Control
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x01 ] 1
Item(Global): Usage Page, data= [ 0x0c ] 12
Consumer
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0xea ] 234
Volume Decrement
Item(Local ): Usage, data= [ 0xe9 ] 233
Volume Increment
Item(Local ): Usage, data= [ 0xe2 ] 226
Mute
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x03 ] 3
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x05 ] 5
Item(Main ): Input, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Global): Usage Page, data= [ 0x00 0xff ] 65280
(null)
Item(Local ): Usage, data= [ 0x01 ] 1
(null)
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x02 ] 2
Item(Local ): Usage, data= [ 0x01 ] 1
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x20 ] 32
Item(Main ): Output, data= [ 0x02 0x01 ] 258
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Buffered Bytes
Item(Local ): Usage, data= [ 0x01 ] 1
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x20 ] 32
Item(Main ): Input, data= [ 0x02 0x01 ] 258
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Buffered Bytes
Item(Global): Report ID, data= [ 0x04 ] 4
Item(Global): Usage Page, data= [ 0x30 0xff ] 65328
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0x20 ] 32
(null)
Item(Local ): Usage, data= [ 0x97 ] 151
(null)
Item(Local ): Usage, data= [ 0x2b ] 43
(null)
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x03 ] 3
Item(Main ): Input, data= [ 0x23 ] 35
Constant Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Local ): Usage, data= [ 0x2f ] 47
(null)
Item(Local ): Usage, data= [ 0x21 ] 33
(null)
Item(Local ): Usage, data= [ 0x24 ] 36
(null)
Item(Local ): Usage, data= [ 0xfd 0xff ] 65533
(null)
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x04 ] 4
Item(Main ): Input, data= [ 0x07 ] 7
Constant Variable Relative No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x09 ] 9
Item(Main ): Input, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Local ): Usage, data= [ 0xff 0xff ] 65535
(null)
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Feature, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x07 ] 7
Item(Main ): Feature, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x40 0xff ] 65344
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0x17 ] 23
(null)
Item(Local ): Usage, data= [ 0x1e ] 30
(null)
Item(Local ): Usage, data= [ 0x09 ] 9
(null)
Item(Local ): Usage, data= [ 0x18 ] 24
(null)
Item(Local ): Usage, data= [ 0x20 ] 32
(null)
Item(Local ): Usage, data= [ 0x21 ] 33
(null)
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x06 ] 6
Item(Main ): Output, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x30 0xff ] 65328
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0x9e ] 158
(null)
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Output, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x09 ] 9
Item(Main ): Output, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Global): Usage Page, data= [ 0x0b ] 11
Telephony
Item(Local ): Usage, data= [ 0x05 ] 5
Headset
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x03 ] 3
Item(Global): Usage Page, data= [ 0x0b ] 11
Telephony
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0x20 ] 32
Hook Switch
Item(Local ): Usage, data= [ 0x97 ] 151
Line Busy Tone
Item(Local ): Usage, data= [ 0x2b ] 43
Speaker Phone
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x03 ] 3
Item(Main ): Input, data= [ 0x23 ] 35
Constant Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Local ): Usage, data= [ 0x2f ] 47
Phone Mute
Item(Local ): Usage, data= [ 0x21 ] 33
Flash
Item(Local ): Usage, data= [ 0x24 ] 36
Redial
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x03 ] 3
Item(Main ): Input, data= [ 0x07 ] 7
Constant Variable Relative No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Local ): Usage, data= [ 0x07 ] 7
Programmable Button
Item(Global): Usage Page, data= [ 0x09 ] 9
Buttons
Item(Local ): Usage, data= [ 0x01 ] 1
Button 1 (Primary)
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Count, data= [ 0x09 ] 9
Item(Main ): Input, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x08 ] 8
LEDs
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0x17 ] 23
Off-Hook
Item(Local ): Usage, data= [ 0x1e ] 30
Speaker
Item(Local ): Usage, data= [ 0x09 ] 9
Mute
Item(Local ): Usage, data= [ 0x18 ] 24
Ring
Item(Local ): Usage, data= [ 0x20 ] 32
Hold
Item(Local ): Usage, data= [ 0x21 ] 33
Microphone
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x06 ] 6
Item(Main ): Output, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x0b ] 11
Telephony
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0x9e ] 158
(null)
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Output, data= [ 0x22 ] 34
Data Variable Absolute No_Wrap Linear
No_Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x09 ] 9
Item(Main ): Output, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
I have successfully used feature report #3 to interact with the device, including the manipulation of some LEDs and call states. However, no combination of data changes the volume, and I get no response whatsoever when interacting with feature report #1, which should be responsible for volume if I'm reading the report properly.
For example, sending a hex value of 05 (as in 00000101) to page #3 results in the device going to a muted state.
I decoded the report descriptor and it appears that the volume increment/decrement reports are sent from the device (headset) to the host (PC or whatever) using an input report, not a feature report. That is, the device tells the host to increment/decrement the volume - not the other way around.
BTW, I only see one feature report defined and it uses REPORT_ID 0x04.
Specifically, the input report with REPORT_ID 0x01 is used for volume control:
//--------------------------------------------------------------------------------
// Consumer Device Page inputReport 01 (Device --> Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x01 (1)
// Collection: ConsumerControl
uint8_t CD_ConsumerControlVolumeDecrement : 1; // Usage 0x000C00EA: Volume Decrement, Value = 0 to 1
uint8_t CD_ConsumerControlVolumeIncrement : 1; // Usage 0x000C00E9: Volume Increment, Value = 0 to 1
uint8_t CD_ConsumerControlMute : 1; // Usage 0x000C00E2: Mute, Value = 0 to 1
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
} inputReport01_t;
The full decoded report descriptor is shown below...
hidrdd git:master ❯ rexx rd.rex --dump -dsa samples/headset-jabra410.rd
//--------------------------------------------------------------------------------
// Report descriptor data in hex (length 273 bytes)
//--------------------------------------------------------------------------------
// 050C0901 A1018501 050C1500 250109EA 09E909E2 75019503 81027501 95058101
// C00600FF 0901A101 85020901 150026FF 00750895 20920201 09011500 26FF0075
// 08952082 02018504 0630FF15 00250109 20099709 2B750195 03812309 2F092109
// 240AFDFF 75019504 81077501 95098101 0AFFFF75 019501B1 22750195 07B10106
// 40FF1500 25010917 091E0909 09180920 09217501 95069122 0630FF15 00250109
// 9E750195 01912275 01950991 01C0050B 0905A101 8503050B 15002501 09200997
// 092B7501 95038123 092F0921 09247501 95038107 09070509 09017501 95018102
// 95098101 05081500 25010917 091E0909 09180920 09217501 95069122 050B1500
// 2501099E 75019501 91227501 95099101 C0
//--------------------------------------------------------------------------------
// Decoded Application Collection
//--------------------------------------------------------------------------------
/*
05 0C (GLOBAL) USAGE_PAGE 0x000C Consumer Device Page
09 01 (LOCAL) USAGE 0x000C0001 Consumer Control (CA=Application Collection)
A1 01 (MAIN) COLLECTION 0x00000001 Application (Usage=0x000C0001: Page=Consumer Device Page, Usage=Consumer Control, Type=CA)
85 01 (GLOBAL) REPORT_ID 0x01 (1)
05 0C (GLOBAL) USAGE_PAGE 0x000C Consumer Device Page <-- Redundant: USAGE_PAGE is already 0x000C
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Info: Consider replacing 15 00 with 14
25 01 (GLOBAL) LOGICAL_MAXIMUM 0x01 (1)
09 EA (LOCAL) USAGE 0x000C00EA Volume Decrement (RTC=Re-trigger Control)
09 E9 (LOCAL) USAGE 0x000C00E9 Volume Increment (RTC=Re-trigger Control)
09 E2 (LOCAL) USAGE 0x000C00E2 Mute (OOC=On/Off Control)
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field
95 03 (GLOBAL) REPORT_COUNT 0x03 (3) Number of fields
81 02 (MAIN) INPUT 0x00000002 (3 fields x 1 bit) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 05 (GLOBAL) REPORT_COUNT 0x05 (5) Number of fields
81 01 (MAIN) INPUT 0x00000001 (5 fields x 1 bit) 1=Constant 0=Array 0=Absolute
C0 (MAIN) END_COLLECTION Application
*/
//--------------------------------------------------------------------------------
// Consumer Device Page inputReport 01 (Device --> Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x01 (1)
// Collection: ConsumerControl
uint8_t CD_ConsumerControlVolumeDecrement : 1; // Usage 0x000C00EA: Volume Decrement, Value = 0 to 1
uint8_t CD_ConsumerControlVolumeIncrement : 1; // Usage 0x000C00E9: Volume Increment, Value = 0 to 1
uint8_t CD_ConsumerControlMute : 1; // Usage 0x000C00E2: Mute, Value = 0 to 1
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
} inputReport01_t;
//--------------------------------------------------------------------------------
// Decoded Application Collection
//--------------------------------------------------------------------------------
/*
06 00FF (GLOBAL) USAGE_PAGE 0xFF00 Vendor-defined
09 01 (LOCAL) USAGE 0xFF000001 <-- Warning: Undocumented usage
A1 01 (MAIN) COLLECTION 0x00000001 Application (Usage=0xFF000001: Page=Vendor-defined, Usage=, Type=)
85 02 (GLOBAL) REPORT_ID 0x02 (2)
09 01 (LOCAL) USAGE 0xFF000001 <-- Warning: Undocumented usage
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
26 FF00 (GLOBAL) LOGICAL_MAXIMUM 0x00FF (255)
75 08 (GLOBAL) REPORT_SIZE 0x08 (8) Number of bits per field
95 20 (GLOBAL) REPORT_COUNT 0x20 (32) Number of fields
92 0201 (MAIN) OUTPUT 0x00000102 (32 fields x 8 bits) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 1=Buffer
09 01 (LOCAL) USAGE 0xFF000001 <-- Warning: Undocumented usage
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
26 FF00 (GLOBAL) LOGICAL_MAXIMUM 0x00FF (255) <-- Redundant: LOGICAL_MAXIMUM is already 255
75 08 (GLOBAL) REPORT_SIZE 0x08 (8) Number of bits per field <-- Redundant: REPORT_SIZE is already 8
95 20 (GLOBAL) REPORT_COUNT 0x20 (32) Number of fields <-- Redundant: REPORT_COUNT is already 32
82 0201 (MAIN) INPUT 0x00000102 (32 fields x 8 bits) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 1=Buffer
85 04 (GLOBAL) REPORT_ID 0x04 (4)
06 30FF (GLOBAL) USAGE_PAGE 0xFF30 Vendor-defined
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
25 01 (GLOBAL) LOGICAL_MAXIMUM 0x01 (1)
09 20 (LOCAL) USAGE 0xFF300020 <-- Warning: Undocumented usage
09 97 (LOCAL) USAGE 0xFF300097 <-- Warning: Undocumented usage
09 2B (LOCAL) USAGE 0xFF30002B <-- Warning: Undocumented usage
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field
95 03 (GLOBAL) REPORT_COUNT 0x03 (3) Number of fields
81 23 (MAIN) INPUT 0x00000023 (3 fields x 1 bit) 1=Constant 1=Variable 0=Absolute 0=NoWrap 0=Linear 1=NoPrefState 0=NoNull 0=NonVolatile 0=Bitmap
09 2F (LOCAL) USAGE 0xFF30002F <-- Warning: Undocumented usage
09 21 (LOCAL) USAGE 0xFF300021 <-- Warning: Undocumented usage
09 24 (LOCAL) USAGE 0xFF300024 <-- Warning: Undocumented usage
0A FDFF (LOCAL) USAGE 0xFF30FFFD <-- Warning: Undocumented usage
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 04 (GLOBAL) REPORT_COUNT 0x04 (4) Number of fields
81 07 (MAIN) INPUT 0x00000007 (4 fields x 1 bit) 1=Constant 1=Variable 1=Relative 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 09 (GLOBAL) REPORT_COUNT 0x09 (9) Number of fields
81 01 (MAIN) INPUT 0x00000001 (9 fields x 1 bit) 1=Constant 0=Array 0=Absolute
0A FFFF (LOCAL) USAGE 0xFF30FFFF <-- Warning: Undocumented usage
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 01 (GLOBAL) REPORT_COUNT 0x01 (1) Number of fields
B1 22 (MAIN) FEATURE 0x00000022 (1 field x 1 bit) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 1=NoPrefState 0=NoNull 0=NonVolatile 0=Bitmap
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 07 (GLOBAL) REPORT_COUNT 0x07 (7) Number of fields
B1 01 (MAIN) FEATURE 0x00000001 (7 fields x 1 bit) 1=Constant 0=Array 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap
06 40FF (GLOBAL) USAGE_PAGE 0xFF40 Vendor-defined
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
25 01 (GLOBAL) LOGICAL_MAXIMUM 0x01 (1) <-- Redundant: LOGICAL_MAXIMUM is already 1
09 17 (LOCAL) USAGE 0xFF400017 <-- Warning: Undocumented usage
09 1E (LOCAL) USAGE 0xFF40001E <-- Warning: Undocumented usage
09 09 (LOCAL) USAGE 0xFF400009 <-- Warning: Undocumented usage
09 18 (LOCAL) USAGE 0xFF400018 <-- Warning: Undocumented usage
09 20 (LOCAL) USAGE 0xFF400020 <-- Warning: Undocumented usage
09 21 (LOCAL) USAGE 0xFF400021 <-- Warning: Undocumented usage
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 06 (GLOBAL) REPORT_COUNT 0x06 (6) Number of fields
91 22 (MAIN) OUTPUT 0x00000022 (6 fields x 1 bit) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 1=NoPrefState 0=NoNull 0=NonVolatile 0=Bitmap
06 30FF (GLOBAL) USAGE_PAGE 0xFF30 Vendor-defined
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
25 01 (GLOBAL) LOGICAL_MAXIMUM 0x01 (1) <-- Redundant: LOGICAL_MAXIMUM is already 1
09 9E (LOCAL) USAGE 0xFF30009E <-- Warning: Undocumented usage
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 01 (GLOBAL) REPORT_COUNT 0x01 (1) Number of fields
91 22 (MAIN) OUTPUT 0x00000022 (1 field x 1 bit) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 1=NoPrefState 0=NoNull 0=NonVolatile 0=Bitmap
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 09 (GLOBAL) REPORT_COUNT 0x09 (9) Number of fields
91 01 (MAIN) OUTPUT 0x00000001 (9 fields x 1 bit) 1=Constant 0=Array 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap
C0 (MAIN) END_COLLECTION Application
*/
//--------------------------------------------------------------------------------
// Vendor-defined featureReport 04 (Device <-> Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x04 (4)
uint8_t VEN_VendorDefinedFFFF : 1; // Usage 0xFF30FFFF: , Value = 0 to 1
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
} featureReport04_t;
//--------------------------------------------------------------------------------
// Vendor-defined inputReport 02 (Device --> Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x02 (2)
uint8_t VEN_VendorDefined0001[32]; // Usage 0xFF000001: , Value = 0 to 255
} inputReport02_t;
//--------------------------------------------------------------------------------
// Vendor-defined inputReport 04 (Device --> Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x04 (4)
uint8_t VEN_VendorDefined0020 : 1; // Usage 0xFF300020: , Value = 0 to 1
uint8_t VEN_VendorDefined0097 : 1; // Usage 0xFF300097: , Value = 0 to 1
uint8_t VEN_VendorDefined002B : 1; // Usage 0xFF30002B: , Value = 0 to 1
uint8_t VEN_VendorDefined002F : 1; // Usage 0xFF30002F: , Value = 0 to 1
uint8_t VEN_VendorDefined0021 : 1; // Usage 0xFF300021: , Value = 0 to 1
uint8_t VEN_VendorDefined0024 : 1; // Usage 0xFF300024: , Value = 0 to 1
uint8_t VEN_VendorDefinedFFFD : 1; // Usage 0xFF30FFFD: , Value = 0 to 1
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
} inputReport04_t;
//--------------------------------------------------------------------------------
// Vendor-defined outputReport 02 (Device <-- Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x02 (2)
uint8_t VEN_VendorDefined0001[32]; // Usage 0xFF000001: , Value = 0 to 255
} outputReport02_t;
//--------------------------------------------------------------------------------
// Vendor-defined outputReport 04 (Device <-- Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x04 (4)
uint8_t VEN_VendorDefined0017 : 1; // Usage 0xFF400017: , Value = 0 to 1
uint8_t VEN_VendorDefined001E : 1; // Usage 0xFF40001E: , Value = 0 to 1
uint8_t VEN_VendorDefined0009 : 1; // Usage 0xFF400009: , Value = 0 to 1
uint8_t VEN_VendorDefined0018 : 1; // Usage 0xFF400018: , Value = 0 to 1
uint8_t VEN_VendorDefined0020 : 1; // Usage 0xFF400020: , Value = 0 to 1
uint8_t VEN_VendorDefined0021 : 1; // Usage 0xFF400021: , Value = 0 to 1
uint8_t VEN_VendorDefined009E : 1; // Usage 0xFF30009E: , Value = 0 to 1
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
} outputReport04_t;
//--------------------------------------------------------------------------------
// Decoded Application Collection
//--------------------------------------------------------------------------------
/*
05 0B (GLOBAL) USAGE_PAGE 0x000B Telephony Device Page
09 05 (LOCAL) USAGE 0x000B0005 Headset (CL=Logical Collection)
A1 01 (MAIN) COLLECTION 0x00000001 Application (Usage=0x000B0005: Page=Telephony Device Page, Usage=Headset, Type=CL) <-- Warning: USAGE type should be CA (Application)
85 03 (GLOBAL) REPORT_ID 0x03 (3)
05 0B (GLOBAL) USAGE_PAGE 0x000B Telephony Device Page <-- Redundant: USAGE_PAGE is already 0x000B
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
25 01 (GLOBAL) LOGICAL_MAXIMUM 0x01 (1) <-- Redundant: LOGICAL_MAXIMUM is already 1
09 20 (LOCAL) USAGE 0x000B0020 Hook Switch (OOC=On/Off Control)
09 97 (LOCAL) USAGE 0x000B0097 Line Busy Tone (MC=Momentary Control)
09 2B (LOCAL) USAGE 0x000B002B Speaker Phone (OOC=On/Off Control)
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 03 (GLOBAL) REPORT_COUNT 0x03 (3) Number of fields
81 23 (MAIN) INPUT 0x00000023 (3 fields x 1 bit) 1=Constant 1=Variable 0=Absolute 0=NoWrap 0=Linear 1=NoPrefState 0=NoNull 0=NonVolatile 0=Bitmap
09 2F (LOCAL) USAGE 0x000B002F Phone Mute (OOC=On/Off Control)
09 21 (LOCAL) USAGE 0x000B0021 Flash (MC=Momentary Control)
09 24 (LOCAL) USAGE 0x000B0024 Redial (OSC=One Shot Control)
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 03 (GLOBAL) REPORT_COUNT 0x03 (3) Number of fields <-- Redundant: REPORT_COUNT is already 3
81 07 (MAIN) INPUT 0x00000007 (3 fields x 1 bit) 1=Constant 1=Variable 1=Relative 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap
09 07 (LOCAL) USAGE 0x000B0007 Programmable Button (NAry=Named Array)
05 09 (GLOBAL) USAGE_PAGE 0x0009 Button Page
09 01 (LOCAL) USAGE 0x00090001 Button 1 Primary/trigger (MULTI=Selector, On/Off, Momentary, or One Shot)
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 01 (GLOBAL) REPORT_COUNT 0x01 (1) Number of fields
81 02 (MAIN) INPUT 0x00000002 (1 field x 1 bit) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap
95 09 (GLOBAL) REPORT_COUNT 0x09 (9) Number of fields
81 01 (MAIN) INPUT 0x00000001 (9 fields x 1 bit) 1=Constant 0=Array 0=Absolute
05 08 (GLOBAL) USAGE_PAGE 0x0008 LED Indicator Page
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
25 01 (GLOBAL) LOGICAL_MAXIMUM 0x01 (1) <-- Redundant: LOGICAL_MAXIMUM is already 1
09 17 (LOCAL) USAGE 0x00080017 Off-Hook (OOC=On/Off Control)
09 1E (LOCAL) USAGE 0x0008001E Speaker (OOC=On/Off Control)
09 09 (LOCAL) USAGE 0x00080009 Mute (OOC=On/Off Control)
09 18 (LOCAL) USAGE 0x00080018 Ring (OOC=On/Off Control)
09 20 (LOCAL) USAGE 0x00080020 Hold (OOC=On/Off Control)
09 21 (LOCAL) USAGE 0x00080021 Microphone (OOC=On/Off Control)
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 06 (GLOBAL) REPORT_COUNT 0x06 (6) Number of fields
91 22 (MAIN) OUTPUT 0x00000022 (6 fields x 1 bit) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 1=NoPrefState 0=NoNull 0=NonVolatile 0=Bitmap
05 0B (GLOBAL) USAGE_PAGE 0x000B Telephony Device Page
15 00 (GLOBAL) LOGICAL_MINIMUM 0x00 (0) <-- Redundant: LOGICAL_MINIMUM is already 0 <-- Info: Consider replacing 15 00 with 14
25 01 (GLOBAL) LOGICAL_MAXIMUM 0x01 (1) <-- Redundant: LOGICAL_MAXIMUM is already 1
09 9E (LOCAL) USAGE 0x000B009E Ringer (OOC=On/Off Control)
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 01 (GLOBAL) REPORT_COUNT 0x01 (1) Number of fields
91 22 (MAIN) OUTPUT 0x00000022 (1 field x 1 bit) 0=Data 1=Variable 0=Absolute 0=NoWrap 0=Linear 1=NoPrefState 0=NoNull 0=NonVolatile 0=Bitmap
75 01 (GLOBAL) REPORT_SIZE 0x01 (1) Number of bits per field <-- Redundant: REPORT_SIZE is already 1
95 09 (GLOBAL) REPORT_COUNT 0x09 (9) Number of fields
91 01 (MAIN) OUTPUT 0x00000001 (9 fields x 1 bit) 1=Constant 0=Array 0=Absolute 0=NoWrap 0=Linear 0=PrefState 0=NoNull 0=NonVolatile 0=Bitmap
C0 (MAIN) END_COLLECTION Application
*/
//--------------------------------------------------------------------------------
// Telephony Device Page inputReport 03 (Device --> Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x03 (3)
// Collection: Headset
uint8_t TEL_HeadsetHookSwitch : 1; // Usage 0x000B0020: Hook Switch, Value = 0 to 1
uint8_t TEL_HeadsetLineBusyTone : 1; // Usage 0x000B0097: Line Busy Tone, Value = 0 to 1
uint8_t TEL_HeadsetSpeakerPhone : 1; // Usage 0x000B002B: Speaker Phone, Value = 0 to 1
uint8_t TEL_HeadsetPhoneMute : 1; // Usage 0x000B002F: Phone Mute, Value = 0 to 1
uint8_t TEL_HeadsetFlash : 1; // Usage 0x000B0021: Flash, Value = 0 to 1
uint8_t TEL_HeadsetRedial : 1; // Usage 0x000B0024: Redial, Value = 0 to 1
uint8_t TEL_HeadsetProgrammableButton : 1; // Usage 0x000B0007: Programmable Button, Value = 0 to 1
// Usage 0x00090001 Button 1 Primary/trigger (MULTI=Selector, On/Off, Momentary, or One Shot) Value = 0 to 1 <-- Ignored: REPORT_COUNT (1) is too small
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
} inputReport03_t;
//--------------------------------------------------------------------------------
// LED Indicator Page outputReport 03 (Device <-- Host)
//--------------------------------------------------------------------------------
typedef struct
{
uint8_t reportId; // Report ID = 0x03 (3)
// Collection: Headset
uint8_t LED_HeadsetOffHook : 1; // Usage 0x00080017: Off-Hook, Value = 0 to 1
uint8_t LED_HeadsetSpeaker : 1; // Usage 0x0008001E: Speaker, Value = 0 to 1
uint8_t LED_HeadsetMute : 1; // Usage 0x00080009: Mute, Value = 0 to 1
uint8_t LED_HeadsetRing : 1; // Usage 0x00080018: Ring, Value = 0 to 1
uint8_t LED_HeadsetHold : 1; // Usage 0x00080020: Hold, Value = 0 to 1
uint8_t LED_HeadsetMicrophone : 1; // Usage 0x00080021: Microphone, Value = 0 to 1
uint8_t TEL_HeadsetRinger : 1; // Usage 0x000B009E: Ringer, Value = 0 to 1
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
uint8_t : 1; // Pad
} outputReport03_t;

Data error when inflating the zlib stream object

I am trying to inflate an object stream in a pdf. While inflating one of the object stream which is compressed with flate decode I am getting data error.
Object stream
1339 0 obj^M<</First 7/Length 36/Filter/FlateDecode/N 1/Type/ObjStm>>stream^M
^ZÖ¬Áã9^<87>^GÎ<89><93>^WÊ<8d>ð<93>yM<96>t0Ò=$Ô<·×^L<84>°¯$<8b>^M
endstream
**Encryption object **
1698 0 obj^M<</Length 128/Filter/Standard/O(¡"ÎÙ¢¬<9d><9c>­"\r^S^LÀõeâJý;Î{dTÔÜ<9d>~´>^Tº)/P -1324/R 3/U(É^[®ú^F^C /¬®=ÌæZv5');\r\n view( a)/V 2>>^Mendobj
After decrypting I got this data
{0x68, 0x16, 0x48, 0x59, 0x11, 0xef, 0x34, 0xe9, 0xd0, 0x79, 0xf6, 0xcb, 0x73, 0xf6, 0x8a, 0x50, 0xed, 0xdc, 0x34, 0xe9, 0x60, 0xb1, 0xbf, 0x3, 0xf5, 0x92, 0x5, 0x67, 0x60, 0xd9, 0x84, 0x34, 0x44, 0xad, 0xa9, 0x5c}
Now I have to uncompress this data.
I am getting data error after calling inflate(&zstrm, Z_FINISH);
I am stuck here. Can anyone please help me to understand this error.
Ans :
Here the input I was supplying to zlib was not a valid inflate data. When the input stream was encrypted the first character was new line character. I was skipping that newline character. That was the error.
That's not a zlib stream, nor is it even raw deflate data.

Reverse-engineering a HID handshake by examining bytes over USB

I'm trying to extract real-time data from a Wacom Inkling
Roel Janssen has already examined the packets here:
// Some kind of handshaking.
// Values obtained by sniffing the USB connection between SketchManager and the device.
unsigned char usb_data[33];
memset (&usb_data, '\0', 33);
int bytes = 0;
memcpy (&usb_data, "\x80\x01\x03\x01\x02\x00\x00\x00", 8);
bytes += libusb_control_transfer (handle,
0x21, // bmRequestType
9, // bRequest
0x0380, // wValue
0, // wIndex
usb_data, // data
33, // wLength
0); // timeout
memcpy (&usb_data, "\x80\x01\x0a\x01\x01\x0b\x01\x00", 8);
bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0);
memset (&usb_data, '\0', 33);
bytes += libusb_control_transfer (handle, 0xa1, 1, 0x0380, 0, usb_data, 33, 0);
memcpy (&usb_data, "\x80\x01\x0b\x01\x00\x00\x00\x00", 8);
bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0);
memcpy (&usb_data, "\x80\x01\x02\x01\x01\x00\x00\x00", 8);
bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0);
memcpy (&usb_data, "\x80\x01\x0a\x01\x01\x02\x01\x00", 8);
bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0);
memset (&usb_data, '\0', 33);
bytes += libusb_control_transfer (handle, 0xa1, 1, 0x0380, 0, usb_data, 33, 0);
I'm trying to rewrite this code using HID API which has a very minimal API (here)
I'm going to attempt to just use hid_write for now, but there is maybe a chance this handshake is sending a feature report...?
Is there anyone out there who can look at that bytestream and see what is going on?
EDIT: It appears the Inkling exposes a FlashDrive and HID interface, so I am guessing this bytecode must be selecting the HID interface and telling it to start sending data. But can I code it in a more elegant / human readable form?
EDIT: I have it working! Both hid_write and hid_send_feature_report work!
hid_device* handle = hid_open(inklingVendorId, inklingProductId, NULL);
jassert(handle != nullptr);
int bytes_written =
hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x03\x01\x02\x00\x00\x00", 8) +
hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x0a\x01\x01\x0b\x01\x00", 8) +
hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x0b\x01\x00\x00\x00\x00", 8) +
hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x02\x01\x01\x00\x00\x00", 8) +
hid_send_feature_report(handle, (const unsigned char *)"\x80\x01\x0a\x01\x01\x02\x01\x00", 8);
jassert(bytes_written == 5*8);
const int enable_nonblocking = 1, disable_nonblocking = 0;
jassert( hid_set_nonblocking(handle, disable_nonblocking) != FAIL); // want to block
while(true) {
int bytes_got = hid_read(handle, usb_data, 10);
... However I would still like to understand what is going on. This is rather hacky.
EDIT: Output of lsusb (from Roel, I don't have Linux to hand):
Bus 003 Device 002: ID 056a:0221 Wacom Co., Ltd
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x056a Wacom Co., Ltd
idProduct 0x0221
bcdDevice 12.56
iManufacturer 1 (error)
iProduct 2 MSC Device
iSerial 5 4833000045C5549C0002DD012DA5549C
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 57
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 3 USB/MSC Inkling
bmAttributes 0x80
(Bus Powered)
MaxPower 500mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 2 Mouse
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.01
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 215
Report Descriptor: (length is 215)
Item(Global): Usage Page, data= [ 0x0d ] 13
Digitizer
Item(Local ): Usage, data= [ 0x02 ] 2
Pen
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x02 ] 2
Item(Local ): Usage, data= [ 0x02 ] 2
Pen
Item(Main ): Collection, data= [ 0x00 ] 0
Physical
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x30 ] 48
Direction-X
Item(Local ): Usage, data= [ 0x31 ] 49
Direction-Y
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x80 0x07 ] 1920
Item(Global): Physical Minimum, data= [ 0x00 ] 0
Item(Global): Physical Maximum, data= [ 0x00 0x78 ] 30720
Item(Global): Unit, data= [ 0x11 ] 17
System: SI Linear, Unit: Centimeter
Item(Global): Unit Exponent, data= [ 0x0e ] 14
Unit Exponent: 14
Item(Global): Report Size, data= [ 0x10 ] 16
Item(Global): Report Count, data= [ 0x02 ] 2
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x0d ] 13
Digitizer
Item(Local ): Usage, data= [ 0x42 ] 66
Tip Switch
Item(Local ): Usage, data= [ 0x45 ] 69
Eraser
Item(Local ): Usage, data= [ 0x44 ] 68
Barrel Switch
Item(Local ): Usage, data= [ 0x32 ] 50
In Range
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x04 ] 4
Item(Global): Unit, data= [ 0x00 ] 0
System: None, Unit: (None)
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x09 ] 9
Buttons
Item(Local ): Usage Minimum, data= [ 0x01 ] 1
Button 1 (Primary)
Item(Local ): Usage Maximum, data= [ 0x04 ] 4
Button 4
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x04 ] 4
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x0d ] 13
Digitizer
Item(Local ): Usage, data= [ 0x30 ] 48
Tip Pressure
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x00 0x04 ] 1024
Item(Global): Report Size, data= [ 0x10 ] 16
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x0d ] 13
Digitizer
Item(Local ): Usage, data= [ 0x3d ] 61
X Tilt
Item(Local ): Usage, data= [ 0x3e ] 62
Y Tilt
Item(Global): Logical Minimum, data= [ 0x81 ] 129
Item(Global): Logical Maximum, data= [ 0x7f ] 127
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x02 ] 2
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x00 ] 0
Undefined
Item(Global): Report ID, data= [ 0x04 ] 4
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x0c ] 12
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x00 ] 0
Undefined
Item(Global): Report ID, data= [ 0x08 ] 8
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x3b ] 59
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Local ): Usage, data= [ 0x01 ] 1
Pointer
Item(Global): Report ID, data= [ 0x80 ] 128
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x20 ] 32
Item(Main ): Feature, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x02 ] 2
Mouse
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0x01 ] 1
Pointer
Item(Main ): Collection, data= [ 0x00 ] 0
Physical
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x30 ] 48
Direction-X
Item(Local ): Usage, data= [ 0x31 ] 49
Direction-Y
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x80 0x07 ] 1920
Item(Global): Physical Minimum, data= [ 0x00 ] 0
Item(Global): Physical Maximum, data= [ 0x00 0x78 ] 30720
Item(Global): Unit, data= [ 0x11 ] 17
System: SI Linear, Unit: Centimeter
Item(Global): Unit Exponent, data= [ 0x0e ] 14
Unit Exponent: 14
Item(Global): Report Size, data= [ 0x10 ] 16
Item(Global): Report Count, data= [ 0x02 ] 2
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x09 ] 9
Buttons
Item(Local ): Usage Minimum, data= [ 0x01 ] 1
Button 1 (Primary)
Item(Local ): Usage Maximum, data= [ 0x03 ] 3
Button 3 (Tertiary)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x03 ] 3
Item(Global): Unit, data= [ 0x00 ] 0
System: None, Unit: (None)
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Report Count, data= [ 0x05 ] 5
Item(Main ): Input, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Main ): End Collection, data=none
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 4
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 4 USB/MSC Inkling
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 0
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
bNumConfigurations 2
Device Status: 0x0000
(Bus Powered)
1) Verify that the Inkling uses HID USB device class. Try lsusb -v and check the bDeviceClass or bInterfaceClass field in the output (The USB human interface device class can be used to describe both device and interface classes. The interface class is used when a USB device can contain more than one function. from https://en.wikipedia.org/wiki/USB_human_interface_device_class) In the manual (https://www.wacom.com/~/media/files/store-manuals/inkling-manual-english.pdf) is said that it is a USB flash drive, in this case it uses USB mass storage device class (BULK transfer)
2) If it is a USB HID device class you can try to get the feature reports (if the inkling sends any) similar to this website http://libusb.6.n5.nabble.com/How-to-get-HID-report-td4628.html
libusb_get_descriptor makes standard GET_DESCRIPTOR requests, where the
bmRequestType field is 0x80. The DT_REPORT descriptor request must
indicate that the recipient is an interface, which requires
bmRequestType to be 0x81.
You have two good choices. The report descriptors are all included in
the configuration descriptor, so you should be able to fetch the whole
configuration descriptor en masse and parse it to extract the report
descriptors.
Alternatively, libusb_get_descriptor is a very thin layer over
libusb_control_transfer , so you could just expand it by hand:
res = libusb_control_transfer( devh, LIBUSB_ENDPOINT_IN |
LIBUSB_RECIPIENT_INTERFACE,
LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_REPORT << 8) | 0, 0, buf,
sizeof(buf), 1000);
more links:
- http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/
http://www.beyondlogic.org/usbnutshell/usb1.shtml
---------------------------------------------------------------------------------
libusb_control_transfer performs USB control transfers. Control transfers are used for command and status operations, see this http://libusb.sourceforge.net/api-1.0/group__syncio.html and this http://www.beyondlogic.org/usbnutshell/usb4.shtml#Control
USB control requests are a subtype of USB requests, see http://www.beyondlogic.org/usbnutshell/usb6.shtml
usb_data seems to be the USB send buffer, it is always filled with the data bytes, then the libusb_control_transfer is send
This is the commented form of the USB control request (http://www.beyondlogic.org/usbnutshell/usb6.shtml)
memcpy (&usb_data, "\x80\x01\x03\x01\x02\x00\x00\x00", 8);
bytes += libusb_control_transfer (handle,
0x21, // bmRequestType
9, // bRequest
0x0380, // wValue
0, // wIndex
usb_data, // data
33, // wLength
0); // timeout
This is the short form of the USB control request
memcpy (&usb_data, "\x80\x01\x0a\x01\x01\x0b\x01\x00", 8);
bytes += libusb_control_transfer (handle, 0x21, 9, 0x0380, 0, usb_data, 33, 0);
So all the byte sequences like "\x80\x01\x03\x01\x02\x00\x00\x00" are commands codes that are used to configure the Inkling ('handshake') and only the Inkling and the Wacom folks understand...
So this is one single report you send over USB:
80 01 03 01 02 00 00 00 .... (in total the buffer is 1+32 = 33 bytes)
^^ Report ID
This is the relevant part from the HID descriptor:
...
Item(Global): Report ID, data= [ 0x80 ] 128
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x20 ] 32
Item(Main ): Feature, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
This says that your data for Report ID 0x80 has to be interpreted as 32 times one byte (it's meaning is up to the driver I guess). It is a Feature which means that it can configure the device via GET_FEATURE/SET_FEATURE reports over the control endpoint.
For more information about how to interpret this descriptor, see the HID v1.1 specification from http://www.usb.org/developers/hidpage/.