Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Add RawHID Device + HID API Device #407

Merged
merged 5 commits into from
Nov 8, 2015
Merged

Conversation

NicoHood
Copy link
Contributor

@NicoHood NicoHood commented Nov 8, 2015

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.

    "device" :
    {
        "name"       : "MyPi",
        "type"       : "paintpack",
        "output"     : "/dev/ttyACM0",
        "VID"        : "0x2341",
        "PID"        : "0x8036",
        "rate"       : 115200,
        "colorOrder" : "rgb"
    },

tvdzwan added a commit that referenced this pull request Nov 8, 2015
Add RawHID Device + HID API Device
@tvdzwan tvdzwan merged commit 9691147 into hyperion-project:master Nov 8, 2015
@NicoHood
Copy link
Contributor Author

NicoHood commented Nov 8, 2015

Thx for merging :)
Feel free to also adapt the other devices to the new API, but I will not do this, unless I have the real hardware to ensure nothing is breaking. Paintpack was easy to check though.

Before you recompile the binaries now, could you please give this a look before?
https://github.com/tvdzwan/hyperion/issues/392

@cribskip
Copy link

cribskip commented Jan 4, 2016

Thanks you very much for this. Seems pretty good, however, building a current hyperion is really time consuming. Is there a current build available for raspberry / OSMC? Thanks :)

@NicoHood
Copy link
Contributor Author

NicoHood commented Jan 4, 2016

Looks like the answer is just "no".
I recompiled this myself for x64 really quick and on the raspi it takes a few minutes, maximum 40min i think on an old pi. So well, no real problem. The docs also describe it quite good. Just use the normal install script (to get the services right in place) and then recompile it and copy the new binaries.

@NicoHood NicoHood deleted the RawHID branch May 20, 2016 10:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants