[libhid-discuss] Trying to repair a program using libhid to configure an Ultimarc Joystick

Xiaofan Chen xiaofanc at gmail.com
Wed Mar 25 03:57:26 UTC 2015


On Wed, Mar 25, 2015 at 11:43 AM, Andrew Silverman
<andrewsi at microsoft.com> wrote:
> I’m having some trouble understanding how to set up the
> destination bits correctly for requesttype/request – When I looked at the
> USB 2 spec tables that describe these, they just don’t seem to correspond in
> a sensible way to the values the original author was using, and so I’m a bit
> lost.
>

Ref: Ch7 of the HID spec should be good for you.
http://www.usb.org/developers/hidpage/HID1_11.pdf

Some cheat codes for you, from Linux USB developer
Alan Stern. It might help you to translate HID report
read/write to control IN/OUT transfer.

                Standard device requests

RQtype Req Value Index Length
----------------------------------------------
  0 1 dev-feat 0 0 Clear device feature
  0 3 dev-feat 0 0 Set device feature
  0 5 address 0 0 Set device address
  0 9 config-value 0 0 Set configuration
  1 b altsetting intf 0 Set interface
  1 1 intf-feat intf 0 Clear interface feature
  1 3 intf-feat intf 0 Set interface feature
  2 1 ep-feat ep 0 Clear endpoint feature
  2 3 ep-feat ep 0 Set endpoint feature
 80 0 0 0 2 Get device status
 80 6 descr-type/ 0/ len Get descriptor
                index lang-ID
 80 8 0 0 1 Get configuration
 81 0 0 intf 2 Get interface status
 81 a 0 intf 1 Get interface (altsetting)
 82 0 0 ep 2 Get endpoint status

Device features: 0 = self-powered, 1 = remote wakeup
Interface features: None
Endpoint features: 0 = halt
Descriptor types: 1 = device, 2 = config, 3 = string, (4 = interface,
        5 = endpoint), 6 = device qualifier, 7 = other-speed config

HID class requests

RQtype Req Value Index Length
----------------------------------------------
 21 9 report-type/ID intf len Set report
 21 a duration/ID intf 0 Set idle
 21 b proto intf 0 Set protocol
 81 6 descr-type/set intf len Get class descriptor
 a1 1 report-type/ID intf len Get report
 a1 2 0/ID intf 1 Get idle
 a1 3 0 intf 1 Get protocol

Report type: 1 = input, 2 = output, 3 = feature
Descriptor type: 21 = HID, 22 = Report, 23 = Physical
Protocol: 0 = boot, 1 = report

-- 
Xiaofan



More information about the libhid-discuss mailing list