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

Potential udev issues #6

Open
maresb opened this issue Apr 14, 2024 · 8 comments
Open

Potential udev issues #6

maresb opened this issue Apr 14, 2024 · 8 comments

Comments

@maresb
Copy link
Contributor

maresb commented Apr 14, 2024

We strive to make it easy to set up the necessary udev rules in Linux. In case you have any trouble, please discuss it here.

@FabianRig
Copy link

With NixOS you might want to use the following:

services.udev.extraRules = ''
  ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="1001", MODE="0666"
'';

@maresb
Copy link
Contributor Author

maresb commented Apr 20, 2024

Thanks @FabianRig! Do you know a good way to detect NixOS to determine whether or not this should be suggested? Would you be willing to making a PR for this?

@FabianRig
Copy link

NixOS works a bit differently than most other distributions. You have to edit a config and can't simply call "apt install ...". Therefore, I don't think it's a good idea to go about this manually. Actually, I'm thinking about adding a NixOS module which would add an option (https://search.nixos.org/options) for labelle/udev...

@maresb
Copy link
Contributor Author

maresb commented Apr 23, 2024

@FabianRig, I've been eyeing NixOS, but haven't yet decided to take the plunge.

For the full context, please note that the idProduct value is generated dynamically here based on the model of the device that's currently plugged in.

In particular, the udev configuration is meant to be decoupled from the installation process. We don't know ahead-of-time which devices the user will connect, and the udev rule is meant to be device-specific.

Therefore, I don't think it's a good idea to go about this manually.

What's the alternative? I don't like the idea of attempting to add/edit configuration automatically. I'd rather prompt the user with appropriate instructions, and I'm happy to have them be nix-specific when nix is detected.

Actually, I'm thinking about adding a NixOS module which would add an option

That'd be awesome, thanks!!!

@FabianRig
Copy link

@maresb Thank you for the clarification. I overlooked the fact, that the id is generated dynamically...

I could write a NixOS module, but it wouldn't make things any easier because you'd have to configure it yourself. And it wouldn't make your config any easier...

Perhaps, it's a better idea to detect NixOS and to print a string which you can directly import into your configuration.nix?! I did a little test:

import platform
platform.version()

yields '#1-NixOS SMP PREEMPT_DYNAMIC Thu Apr 4 18:23:07 UTC 2024' for me. If we detect that, we could create the above string and simply print it for the user.

services.udev.extraRules = ''
  ACTION=="add", SUBSYSTEMS=="usb", ATTRS{idVendor}=="0922", ATTRS{idProduct}=="1001", MODE="0666"
'';

Then you'd just have to add the above to your configuration.nix and apply it.

@maresb
Copy link
Contributor Author

maresb commented Apr 26, 2024

Thanks @FabianRig, that sounds great! Would you like to open a PR for that?

maresb added a commit to maresb/labelle that referenced this issue Apr 30, 2024
One subtle issue is that when printing the exception, line breaks were
being inserted according to the terminal width. To avoid this, I broke the
command into short lines.

The error now reads:

```
UsbDeviceError:

You do not have sufficient access to the device. You probably want to add the a udev
rule in /etc/udev/rules.d with the following command:

    echo 'ACTION=="add",'\
         'SUBSYSTEMS=="usb",'\
         'ATTRS{idVendor}=="0922",'\
         'ATTRS{idProduct}=="1001",'\
         'MODE="0666"' \
      | sudo tee /etc/udev/rules.d/91-labelle-0922-1001.rules

Next, refresh udev with:

    sudo udevadm control --reload-rules
    sudo udevadm trigger --attr-match=idVendor="0922"

Finally, turn your device off and back on again to activate the new permissions.

If this still does not resolve the problem, you might need to reboot.
In case rebooting is necessary, please report this at <labelle-org#6>.
We are still trying to figure out a simple procedure which works for everyone.
In case you still cannot connect, or if you have any information or ideas, please
post them at that link.
```
@jhocan55
Copy link

Hi, I'm working with a dymo printer LabelWriter 550, connected directly to a Linux machine (Debian 12) but I cannot print when I launch the line
labelle "Hello world"
The output I get is: "DeviceManagerError: No matching devices found"
As the Readme says I added an udev rule with the parameters of my printer that I retrieve using the command "lusb". Some one is having the same issue? Thanks for your help

@maresb
Copy link
Contributor Author

maresb commented Jul 30, 2024

@jhocan55 please refer to #4 regarding the current status of LabelWriter 550 support.

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

3 participants