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

Documentation improvements for linux #121

Open
3 tasks
cbs228 opened this issue Dec 18, 2021 · 0 comments
Open
3 tasks

Documentation improvements for linux #121

cbs228 opened this issue Dec 18, 2021 · 0 comments

Comments

@cbs228
Copy link

cbs228 commented Dec 18, 2021

The installation instructions for linux are close but could be made more specific. Python newcomers may be confused by Python 2 vs Python 3, and there are still a lot of tutorials out there that might lead them erroneously towards Python 2.

  • On some linux distros, it is still necessary to use pip3 instead of pip. This is particularly true if the user has a legacy Python 2 interpreter installed alongside Python 3.

  • On some linux distros, it is necessary to install pip3. It is not part of stock Ubuntu, and there it must be installed with sudo apt install python3-pip. We should put this near the top of the README file and add libusb-1.0-0 for good measure.

  • The user needs permission on the printer device node in order to use it. I believe this is the case for the PyUSB backend as well as the kernel backend. The docs make it sound like this step only applies to the kernel backend.

I am aware of two approaches for granting permissions:

udev

These rules ought to be portable to most systems which use systemd. Install in /etc/udev/rules.d/69-brotherql-labelprinter.rules:

# udev rules for Brother QL label printers using usb

# Installation:
# - Copy this file to /etc/udev/rules.d/
# - Run the command:
#       udevadm control --reload && udevadm trigger

ACTION!="add|change", GOTO="brotherql_rules_end"
SUBSYSTEM!="usb|usbmisc", GOTO="brotherql_rules_end"

# QL-1100
# use your printer's VID/PID here
ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="20a7", TAG+="uaccess"

LABEL="brotherql_rules_end"

These rules grant permission on the printer to any logon user for the duration of their session. The uaccess tag is poorly documented but is explained here. You can see it in action by power-cycling your printer and running:

getfacl /dev/usb/lp0

which should show an ACL rule for your username.

# file: dev/usb/lp0
# owner: root
# group: lp
user::rw-
user:YOUR_NAME_HERE:rw-  # <------
group::rw-
mask::rw-
other::---

If there is interest, we could ship a udev rules file with known VIDs/PIDs.

groups

On Debian-alikes, you can add your user account to the lp group:

sudo usermod -a -G lp "$(whoami)"

This grants you permission on all printers, which may not be what you want. Normally, only CUPS (or whatever the printer backend is) has direct access to printers. brother_ql might be persuaded to try and send files to these printers, which might be bad. In certain deployments, it may also have negative consequences for security.

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