Access USB printer in CUPS container with udev rule for SYMLINK

344 views Asked by At

I'm running CUPS in a docker container using the olbat/cupsd image (docker container is a requirement, I can't change this).

I need to be able to print to a USB printer, which means using the --device flag to expose the usb device to the container.

The physical path of the printer (currently) is /dev/bus/usb/001/005 and when i pass this into --device the printer is listed as an available printer within CUPS.

The issue is when the device is removed, it gets allocated a new path - I attempted to use a udev rule to address this with a SYMLINK (see below).

ACTION=="add" SUBSYSTEMS=="usb", ATTRS{product}=="$Product", SYMLINK="bus/usb/001/009"

where $Product is a valid product

This creates /dev/bus/usb/001/009 as expected, but when passed into the container using --device the printer is not listed under the available printers.

However running udevadm info /dev/bus/usb/001/009 inside the CUPS container, lists the printer but with DEVNAME=/dev/bus/usb/001/005 and N: /bus/usb/001/005.

I feel like this is very close to working, but something is missing.

0

There are 0 answers