Consider merging changes to test.c back into libusb/hidapi #168
No reviewers
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi!168
Loading…
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Review the (generic) changes I added to test.c (for testing arbitrary custom HID devices instead of hardcoding VID, PID, reports, etc.
Thanks for your effort!
test.c is intended to be a very simple example of the API usage, but with this change, it becomes too complicated I'd say. Most of the "example" becomes a int/hex/command-line converters which doesn't help its original purpose.
Instead, I'd rather leave this test as is, and recommend to use https://github.com/todbot/hidapitester.
ok but I think its bad to have hardcoded vendor & product ids and
input/output reports in a test program like that. I attempted to get
basically the same API calls as the original without hardcoding
everything. The only "addition" I made was to support both 8-bit byte and
16-bit word formatting for a custom HID joystick interface.
-Lennie
On Tue, Jun 9, 2020 at 4:41 AM Ihor Dutchak notifications@github.com
wrote:
My position - readability and simplicity in the example is the most value.
That hard-coded device was used by the original author years ago. I don't even know what that is, or does it exist at all.
I'd rather remove that part completely to make the example even simpler. When the bigger part of an example is a helper functions - it doesn't make it a good example.
Maybe for the example code, we use an extant, known piece of hardware that is easily and cheaply obtainable, and the VID/PID pair is known to be for development, not a commercial product. For this, I would recommend a Teensy 2.0 (USD 16.00) running the Teensy RawHID Basic example:
https://www.pjrc.com/teensy/rawhid.html
https://github.com/PaulStoffregen/Teensyduino_Examples/blob/master/USB_RawHID/Basic/Basic.pde
Even though there are more modern examples, the Teensy RawHID stuff has been around since at least 2010, so it's pretty familiar to anyone doing USB HID.
Pull request closed