todbot / Blink1Control2

Blink1Control GUI to control blink(1) USB RGB LED devices.
http://blink1.thingm.com/
Apache License 2.0
154 stars 24 forks source link

Blink2Control2 "no device connected" #178

Closed tnagels closed 2 years ago

tnagels commented 2 years ago

On my fresh Debian install I get "no device connected" although a Blink1 is plugged in. On another computer it works, so the unit is not defective.

When I open developer tools, this is what I get in the console: No blink(1)'s with serial number 3C158110 could be found.

So it seems like the software does "see" the blink(1) but cannot control it.

To clarify: I just installed the .deb file and did nothing else as the installation steps on Github seem to indicate that they are only needed for development.

todbot commented 2 years ago

It sounds like you need to install the udev rules that Linux requires to access non-keyboard/mice USB HID devices. See: https://github.com/todbot/Blink1Control2#linux

tnagels commented 2 years ago

That fixed it indeed. Is this the only thing I need to do from the "development" installation procedure? The documentation could be clearer on this.

todbot commented 2 years ago

That is the only thing you should need to do. Apologies, getting Linux to deal with peripherals is always a bit tricky.

We could be better at informing what needs to be done on first startup. I've added issue #179 to expand on this idea and will close this issue for now.

vargn commented 11 months ago

I'm seeing no device connected from Blink1Control2 and blink1-tool. I have added the udev rules and reloaded udev.

The device is picked up by the system and clearly shown when running lsusb and when listing devices with udevadm. I have tried +5 micro USB cables, still no luck.

I'm using Arch, any ideas what could be the issue?

todbot commented 11 months ago

I'm seeing no device connected from Blink1Control2 and blink1-tool. I have added the udev rules and reloaded udev.

The device is picked up by the system and clearly shown when running lsusb and when listing devices with udevadm. I have tried +5 micro USB cables, still no luck.

I'm using Arch, any ideas what could be the issue?

I don't know Arch Linux, sorry. I'll try getting a VM setup to try it out.

Does Arch even use udev and hidraw? The lsusb command will only USB devices and doesn't indicate if a USB HID device (which blink(1) is) is detected properly by the hidraw. You should be able to see a message in the system log if a device is bound to a driver when the device is connected.

When you do sudo blink1-tool --red does it work?

todbot commented 11 months ago

Hi @vargn, I installed Arch VM from the official VM repo, got it running on VirtualBox and plugged in a blink(1). Then I downloaded and tried the blink1-tool-v2.3.0-linux-x86_64.zip bundle in the Releases section. Looks like it works. Here's the commands I did and their output:

[arch@archlinux Downloads]$ uname -r
6.6.8-arch1-1
[arch@archlinux Downloads]$ unzip blink1-tool-v2.3.0-linux-x86_64.zip 
Archive:  blink1-tool-v2.3.0-linux-x86_64.zip
  inflating: blink1-tool

# check if we can just run blink1-tool:
[arch@archlinux Downloads]$ ./blink1-tool  --list
cannot open blink(1), bad id or serial number
Have you added udev rules? Try blink1-tool --add_udev_rules

# nope, check if we can do control via sudo
[arch@archlinux blink1-tool]$ sudo ./blink1-tool --list
blink(1) list: 
id:0 - serialnum:39d6e131 (mk3) fw version:304
[arch@archlinux blink1-tool]$ sudo ./blink1-tool --red
set dev:0:0 to rgb:0xff,0x00,0x00 over 300 msec
[arch@archlinux blink1-tool]$ sudo ./blink1-tool --off
set dev:0:0 to rgb:0x00,0x00,0x00 over 300 msec

# that works, so add udev rules
[arch@archlinux Downloads]$ ./blink1-tool  --add_udev_rules
Attempting to add udev rules.
'sudo' will be used. Please have your password ready
Script being run:
#/bin/bash 
fn=/etc/udev/rules.d/51-blink1.rules 
if [ ! -e $fn ] ; then 
  echo 'ATTRS{idVendor}=="27b8", ATTRS{idProduct}=="01ed", MODE:="666", GROUP="plugdev"' | sudo tee $fn 
fi 
sudo udevadm control --reload 
sudo udevadm trigger 

Running script...
ATTRS{idVendor}=="27b8", ATTRS{idProduct}=="01ed", MODE:="666", GROUP="plugdev"
...Done.

# try again as non-root
[arch@archlinux Downloads]$ ./blink1-tool  --list
blink(1) list: 
id:0 - serialnum:39d6e131 (mk3) fw version:304
[arch@archlinux Downloads]$ ./blink1-tool  --on
set dev:0:0 to rgb:0xff,0xff,0xff over 300 msec
[arch@archlinux Downloads]$ ./blink1-tool  --off
set dev:0:0 to rgb:0x00,0x00,0x00 over 300 msec
vargn commented 11 months ago

Hi @todbot Thank you for a very quick response. I attempted the same steps as you did, which is what I have done previously without luck.

image

I have AppArmor enabled and I also use Firejail. Could this be why it is not working as intended?

todbot commented 11 months ago

I have AppArmor enabled and I also use Firejail. Could this be why it is not working as intended?

No clue, @vargn, I don't use either of those. But any kind of security system that interposes between the real world and the OS could definitely be an issue. I would check the logs of both of those and see if they print something out when either the blink(1) is inserted or when you try to run blink1-tool. Then I'd look in the manuals for both about setting up explicit exceptions for certain devices.

vargn commented 11 months ago

Thank you for taking the time and replying.

I think I have found the problem. When executing systemctl status systemd-udevd.service:

jan 03 20:27:13 main systemd-udevd[444]: /etc/udev/rules.d/51-blink1.rules:1 Unknown group 'plugdev', ignoring.

I then found this: https://wiki.archlinux.org/title/udev#Allowing_regular_users_to_use_devices

Also, should I leave this section as is ATTRS{idVendor}=="27b8", ATTRS{idProduct}=="01ed"? Or should I edit it with the output of lsusb?

Bus 001 Device 010: ID 20a0:41e5 Clay Logic BlinkStick

Would that be ATTRS{idVendor}=="20a0", ATTRS{idProduct}=="41e5"?

todbot commented 11 months ago

@vargn, BlinkStick is not our product.

vargn commented 11 months ago

@todbot Oh my god... That's what I get for buying something, leaving it untouched for months and then google the product name from memory. I guess this explains why I couldn't get it to work. Let's pretend this never happened lmao. Sorry for wasting your time!