Ubuntu Core 22 Snap and USB

Outside of Snap I have python code which uses /dev/usb/lp0 device to access the device (brother label printer – but the usb is of storage type).

Inside of a snapcraft I cannot get this to work. I have used the the following plugs:

plugs:
  - mount-observe
  - network-bind
  - process-control
  - raw-usb
  - hardware-observe
  - log-observe
  - serial-port
  - physical-memory-control
  - i2c
  - gpio-control

yet nothing seems to expose the usb port inside the snap? Help?

Thanks for any help, Will

1 Like

Without seeing the code, my best guess is that you need the removable-media plug since your printer is considered a storage device. You might also need cups or cups-control depending on what exactly it’s doing with that printer.

You’ll need manually connect the plugs. I think only connecting raw-usb will do the job.

sudo snap connect <snap_name>:raw-usb

1 Like