This repository was archived by the owner on May 6, 2021. It is now read-only.
Add RawHID Device + HID API Device #407
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new generic HID device which relies on the already used HIDAPI. This way we do not need to duplicate the code for the HID API handling. It also fixes reconnection issues. The new HID Device will reconnect after 3 seconds if connection was lost. On top of that you can now (optionally) change the USB PID and VID via the json config file.
On top of that a new RawHID device was added which works with the current dev version of the HID Project. This way you can simply use an Arduino (as keyboard!) to receive data, not even a real RawHID device is required (but would also work). Both feature and report out is supported.
More information about this can be found here:
arduino/Arduino#4105
If you like to, you can adapt this api to other led devices. I did this for the paintpack. I dont own a paintpack device myself, but my arduino can pretend to be one and it works (as it did before the patch, just with a changed VID and PID). So nothing should break here. I made sure it uses the out report again, not the feature report.
Test sketch with paintpack (works with/without this PR) https://github.com/NicoHood/HID/blob/dev/examples/RawHID/RawHIDPaintpack/RawHIDPaintpack.ino
Sample config (only name, VID and PID are important). If no PID/VID setting was added it will use the default hardcoded values. To use the Arduino as ambilight receiver you can use name "rawhid" instead.