-
I've looked at the firmware for a few different CMSIS-DAP probes, and noticed they aren't all the same. I couldn't find anything in the CMSIS-DAP v1 spec regarding HID report descriptor requirements, so I looked at what pyOCD requires. It looks like the report descriptor doesn't get parsed by pyOCD. It just seems to use the DAP packet format, up to the size of the endpoint. So is there anything actually required in the HID report descriptor for CMSIS-DAP v1?
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Through targeted trial and error, I've got a simplified report descriptor working:
It only works with the input and output as const (0x01). When it's just data (0x00), pyocd list doesn't find any adapters. FWIW, I've got hidapi 49.2.1 installed. |
Beta Was this translation helpful? Give feedback.
-
PyOCD doesn't itself parse the HID report descriptor, but kernel HID drivers will, and hidapi and pywinusb backends rely on the OS HID support and therefore the parsed reports. For instance, if you tried to send an OUT report packet with hidapi for a device whose HID report descriptors only define IN reports, it will not work. It will work on Linux with no HID reports defined, because on that OS pyocd just uses libusb (via pyusb) to directly access the device. On macOS and Windows the report descriptors matter, because you cannot detach the kernel HID driver. |
Beta Was this translation helpful? Give feedback.
-
Fyi, I've taken a note to try to get a formal requirement for HID descriptors added to the CMSIS docs. (Though the CMSIS team generally feels the CMSIS-DAPv1 HID interface is legacy and should not be used anymore.) |
Beta Was this translation helpful? Give feedback.
-
Through targeted trial and error, I've got a simplified report descriptor working:
It only works with the input and output as const (0x01). When it's just data (0x00), pyocd list doesn't find any adapters. FWIW, I've got hidapi 49.2.1 installed. From your comment, I guess it boils down to making sure the Windows HID driver accepts the report descriptor. |
Beta Was this translation helpful? Give feedback.
-
I discovered that it's not just the OS, the usb library used makes a difference. When I removed hidapi, pyocd on Win7 couldn't find my probe. I had to expand the report descriptor:
I used the USB-IF HID descriptor tool to validate it. |
Beta Was this translation helpful? Give feedback.
PyOCD doesn't itself parse the HID report descriptor, but kernel HID drivers will, and hidapi and pywinusb backends rely on the OS HID support and therefore the parsed reports. For instance, if you tried to send an OUT report packet with hidapi for a device whose HID report descriptors only define IN reports, it will not work.
It will work on Linux with no HID reports defined, because on that OS pyocd just uses libusb (via pyusb) to directly access the device. On macOS and Windows the report descriptors matter, because you cannot detach the kernel HID driver.