Uncategorized

I have installed usbrelay softwate on Ubuntu for my 4 relay control board (which works on Windows). Running the command usbrelay detects device but can’t open it.

I have installed usbrelay softwate on Ubuntu for my 4 relay control board (which works on Windows). Running the command usbrelay detects device but can’t open it.

If usbrelay sees your device but reports it can’t open it, it’s almost always a permissions or udev issue. Here’s the usual fix:


✔️ Step 1 — Check what error it actually gives

Run:

usbrelay -d

or

sudo usbrelay

If it works with sudo but not as a normal user, it’s definitely a permissions problem.


✔️ Step 2 — Identify the device

Find the USB VID/PID:

lsusb

Example output:

Bus 001 Device 005: ID 16c0:05df USBRelay4

Write down the idVendor and idProduct values.


✔️ Step 3 — Create a udev rule

Create a new rules file:

sudo nano /etc/udev/rules.d/99-usbrelay.rules

Add this (replace with your VID/PID values):

SUBSYSTEM=="usb", ATTR{idVendor}=="16c0", ATTR{idProduct}=="05df", MODE="0666"

Or, better (covers HID-based relay boards):

SUBSYSTEM=="hidraw", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE="0666"

Save and exit.


✔️ Step 4 — Reload rules

sudo udevadm control --reload-rules
sudo udevadm trigger

Then unplug and re-plug the relay board.


✔️ Step 5 — Test again

usbrelay

If permissions were the issue, it should now open properly.


If it still won’t open

1. Check whether the board is grabbed by another driver

Some relay boards register as HID devices and get claimed by the kernel.

Run:

dmesg | grep -i hid

If you see something like “hid-generic claimed device”, try adding:

DRIVER=="", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05df", MODE="0666"

2. Make sure you’re not running in a snap or sandbox

usbrelay installed via Snap can’t access hidraw devices.
If you installed via Snap:

sudo snap remove usbrelay
sudo apt install usbrelay

(Or build from source.)


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.