Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LIBUSB_ERROR_NO_DEVICE #5

Open
koroki opened this issue Jan 27, 2019 · 1 comment
Open

LIBUSB_ERROR_NO_DEVICE #5

koroki opened this issue Jan 27, 2019 · 1 comment

Comments

@koroki
Copy link

koroki commented Jan 27, 2019

Hi,
I'm using the common ws2801 leds in a x86-64 system. The easiest way that I found to use it was to use this hack with usbasp. It works perfectly, it is especially confortable because the USBASP are small. But, there is a unconformable problem for me. When the USB is disconnected, usually because the computer is moved a little bit and the usb loses the connection for a while, the hyperiond give this error:

Error while writing data to Hyperion led controller (LIBUSB_ERROR_NO_DEVICE)

But it doesn't stop. And systemd has no error signal. For systemd the status is "Active: active (running)". For this reason, it is not automatic restarted. And I should restarted for myself.

Is there any way to autorestart?

@koroki
Copy link
Author

koroki commented Mar 17, 2019

Well, I found a way to restart the hyperion using udevrules: when the usb is reconnected, the udev kill the previous hyperiond. If the systemd unit has auto-restart on fail, it is restarted and all works again. I changed the group of the USBAVP to uucp and introduce the user that launch kodi to control hyperiond with kodi.

I'll copy here the files:

/etc/systemd/system/hyperion.service:
[Unit]
Description=Hyperion Systemd service

[Service]
Type=simple
User=kodi
Group=uucp
UMask=007
ExecStart=/usr/bin/hyperiond /etc/hyperion/hyperion.config.json
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
TimeoutStopSec=10

[Install]
WantedBy=multi-user.target

/etc/udev/rules.d/99-USBasp.rules
# Set Group for USBasp
SUBSYSTEM=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="uucp", RUN="/usr/local/bin/kill_hyperion"

/usr/local/bin/kill_hyperion (group uucp and the proper permissions!):
#!/bin/bash
kill -9 `ps -aux | grep hyperiond | awk '{print $2}'`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant