Page 1 of 1

6.30 beta 4 GetHIDReportDescriptor windows x64

Posted: Fri Nov 28, 2025 7:44 pm
by miso
Please don't be too harsh with me, if I'm mistaken.
I could not get the hexdump of the descriptor with GetHIDReportDescriptor(#HID) command. It should return return a string, but I get only an empty string. A binary would be fine too.

Re: 6.30 beta 4 GetHIDReportDescriptor windows x64

Posted: Fri Nov 28, 2025 8:09 pm
by miso
https://nextcloud.cloudns.ph/index.php/ ... wfcEaoReba

This Zip only contains txt, code and some info.
It lists all the already connected gamepads and joysticks, displays their info, and tries to open them to get the descriptor to put into the debug window for test. Will show things and tries to get data only if such game device is connected.

Re: 6.30 beta 4 GetHIDReportDescriptor windows x64

Posted: Sat Nov 29, 2025 4:26 pm
by minimy
Really nice lists, full of detail. Thanks for share miso!
Here same with HID. :shock:

Re: 6.30 beta 4 GetHIDReportDescriptor windows x64

Posted: Sun Nov 30, 2025 11:07 am
by PeDe
PB v6.30b4 x64, Raspberry Pi (Debian 13), Logitech, Inc. F510 Gamepad

I changed the code a little and got a report descriptor.

Peter

Code: Select all

ImportC ""
 hid_get_report_descriptor(*hid_device, *buf, buf_size.i)
EndImport
#HID_API_MAX_REPORT_DESCRIPTOR_SIZE = 4096
          
If OpenHID(counter,Val(HIDInfo(#PB_HID_VendorId)),Val(HIDInfo(#PB_HID_ProductId)))
  Define iResult.i, iSize.i, iHid.i, *buf
  iHid = IsHID(counter)
  If iHid
    iHid = PeekI(iHid)
    iSize = #HID_API_MAX_REPORT_DESCRIPTOR_SIZE
    *buf = AllocateMemory(iSize)
    iResult = hid_get_report_descriptor(iHid, *buf, iSize)
    Debug "iResult: " + iResult
    If iResult > -1
      ShowMemoryViewer(*buf, iResult)
    Else
      Debug "Error hid_get_report_descriptor()"
    EndIf
  EndIf
  CloseHID(counter)
Else
  Debug "Error"+HIDError()
EndIf  
MemoryViewer:

Code: Select all

0000000025E9AEB8  05 01 09 04 A1 01 A1 02 15 00 26 FF 00 35 00 46  ....¡.¡...&ÿ.5.F
0000000025E9AEC8  FF 00 75 08 95 04 09 30 09 31 09 32 09 35 81 02  ÿ.u.•..0.1.2.5.
0000000025E9AED8  25 07 46 3B 01 75 04 95 01 65 14 09 39 81 42 65  %.F;.u.•.e..9Be
0000000025E9AEE8  00 25 01 45 01 75 01 95 0C 05 09 19 01 29 0C 81  .%.E.u.•.....).
0000000025E9AEF8  02 06 00 FF 75 01 95 10 25 01 45 01 09 01 81 02  ...ÿu.•.%.E....
0000000025E9AF08  C0 A1 02 26 FF 00 46 FF 00 75 08 95 07 09 02 91  À¡.&ÿ.Fÿ.u.•...‘
0000000025E9AF18  02 C0 A1 02 26 FF 00 46 FF 00 75 08 95 05 06 00  .À¡.&ÿ.Fÿ.u.•...
0000000025E9AF28  FF 09 01 B1 02 C0 C0                             ÿ..±.ÀÀ

Re: 6.30 beta 4 GetHIDReportDescriptor windows x64

Posted: Sun Nov 30, 2025 11:52 am
by User_Russian
This is not a string, but binary data. Here is a similar descriptor from a test project.

Code: Select all

const uint8_t Joystick_ReportDescriptor[JOYSTICK_SIZ_REPORT_DESC] =
  {
    0x05,          /*Usage Page(Generic Desktop)*/
    0x01,
    0x09,          /*Usage(Mouse)*/
    0x02,
    0xA1,          /*Collection(Logical)*/
    0x01,
    0x09,          /*Usage(Pointer)*/
    0x01,
    /* 8 */
    0xA1,          /*Collection(Linked)*/
    0x00,
    0x05,          /*Usage Page(Buttons)*/
    0x09,
    0x19,          /*Usage Minimum(1)*/
    0x01,
    0x29,          /*Usage Maximum(3)*/
    0x03,
    /* 16 */
    0x15,          /*Logical Minimum(0)*/
    0x00,
    0x25,          /*Logical Maximum(1)*/
    0x01,
    0x95,          /*Report Count(3)*/
    0x03,
    0x75,          /*Report Size(1)*/
    0x01,
    /* 24 */
    0x81,          /*Input(Variable)*/
    0x02,
    0x95,          /*Report Count(1)*/
    0x01,
    0x75,          /*Report Size(5)*/
    0x05,
    0x81,          /*Input(Constant,Array)*/
    0x01,
    /* 32 */
    0x05,          /*Usage Page(Generic Desktop)*/
    0x01,
    0x09,          /*Usage(X axis)*/
    0x30,
    0x09,          /*Usage(Y axis)*/
    0x31,
    0x09,          /*Usage(Wheel)*/
    0x38,
    /* 40 */
    0x15,          /*Logical Minimum(-127)*/
    0x81,
    0x25,          /*Logical Maximum(127)*/
    0x7F,
    0x75,          /*Report Size(8)*/
    0x08,
    0x95,          /*Report Count(3)*/
    0x03,
    /* 48 */
    0x81,          /*Input(Variable, Relative)*/
    0x06,
    0xC0,          /*End Collection*/
    0x09,
    0x3c,
    0x05,
    0xff,
    0x09,
    /* 56 */
    0x01,
    0x15,
    0x00,
    0x25,
    0x01,
    0x75,
    0x01,
    0x95,
    /* 64 */
    0x02,
    0xb1,
    0x22,
    0x75,
    0x06,
    0x95,
    0x01,
    0xb1,
    /* 72 */
    0x01,
    0xc0
  }
  ; /* Joystick_ReportDescriptor */
Function GetHIDReportDescriptor() must return a pointer.

Re: 6.30 beta 4 GetHIDReportDescriptor windows x64

Posted: Sun Nov 30, 2025 12:08 pm
by miso
I was expecting to populate a buffer, but the ide compiler gave the error, it requires a string. I thought maybe I will get an decription of a sting version of it like "A20B" etc, but the string remained empty.

With Idles help ( he has the original hidlib wrapped), I could get the hexdump to a buffer.
Though, I could not use the PB one built in the beta. (nor with string nor with buffer)

@Pede, thanks: I just woke up, so I did not test this, but linking to the lib directly should work.

@User Russian: The compiler gave me an error if not returned to a string. The vendorid is a string also, while in the lib it's an uint16.
Autocomplete and the command help shows only 1 parameter for the command, and that is the #HID ID.

Re: 6.30 beta 4 GetHIDReportDescriptor windows x64

Posted: Sun Nov 30, 2025 2:43 pm
by miso
@Pede: Tested, that works. Thanks.