todbot / hidapitester

Simple command-line program to test HIDAPI
GNU General Public License v3.0
257 stars 29 forks source link

What's the expected result for Test-Hardware? #27

Open xsrf opened 9 months ago

xsrf commented 9 months ago

Hey, so I'm trying hidapitester on Windows 10 with an Arduino Pro Micro and the supplied Test-Code for the Arduino Micro. I am able to send and receive regular reports, but no feature reports (wrote -1 bytes).

> hidapitester.exe --vidpid 1b4f:9206 --open --get-report-descriptor 
Opening device, vid/pid: 0x1B4F/0x9206
Report Descriptor:
 06 C0 FF 0A 00 0C A1 01 09 01 15 00 26 FF 00 75 08 95 40 81 02 09 02 15 00 26 FF 00 75 08 95 40
 91 02 C0
Closing device

> hidapitester.exe --vidpid 1b4f:9206 --open -t 2000 --read-input
Opening device, vid/pid: 0x1B4F/0x9206
Reading 64-byte input report 0, 2000 msec timeout...read 64 bytes:
 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F
Closing device

> hidapitester.exe --vidpid 1b4f:9206 --open -l 2 --send-output 0,1 
Opening device, vid/pid: 0x1B4F/0x9206
Writing output report of 2-bytes...wrote 65 bytes:
 00 01
Closing device

> hidapitester.exe --vidpid 1b4f:9206 --open -l 2 --send-feature 0,1 
Opening device, vid/pid: 0x1B4F/0x9206
Writing 2-byte feature report...wrote -1 bytes:
 00 01
Closing device

Is this expected? Or should I be able to send feature reports?

Docs read

The sketch recives 64-byte Output or Feature reports, and prints them to Serial Monitor

So I guess not being able to send a feature report is an issue?

Getting the same result on 3 different Windows 10 PCs.

xsrf commented 9 months ago

I guess writing feature reports fails because the device is not expecting feature reports. The HID descriptor above decodes to:

0x06, 0xC0, 0xFF,  // Usage Page (Vendor Defined 0xFFC0)
0x0A, 0x00, 0x0C,  // Usage (0x0C00)
0xA1, 0x01,        // Collection (Application)
0x09, 0x01,        //   Usage (0x01)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x40,        //   Report Count (64)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x02,        //   Usage (0x02)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x40,        //   Report Count (64)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

// 35 bytes

There are two reports defined, one Input and one Output, but no Feature. So I guess the Readme is wrong?