Accessing USB device from within snap?

Hi,

I was trying to use the snap

which works in general, but can’t access the 3d printer connected to USB.

Aug 17 20:49:37 pc kernel: [ 8721.055150] audit: type=1400 audit(1629226177.364:694): apparmor=“DENIED” operation=“open” profile=“snap.cura-slicer.cura” name="/sys/devices/pnp0/00:04/id" pid=57119 comm=“python3” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0
Aug 17 20:49:37 pc kernel: [ 8721.055484] audit: type=1400 audit(1629226177.364:695): apparmor=“DENIED” operation=“open” profile=“snap.cura-slicer.cura” name="/sys/devices/pci0000:00/0000:00:01.3/0000:01:00.0/usb1/1-4/bNumInterfaces" pid=57119 comm=“python3” requested_mask=“r” denied_mask=“r” fsuid=1000 ouid=0

It’s a serial connection, i.e. like most 3d printers, an arduino board with a serial IO, in conjunction with a USB-serial converter chip. Pretty normal and widely used under Linux.

The older (outdated) version that comes as a regular ubuntu package, works (but has other flaws, that’s why I would like to use the significantly newer version in the snap).

There’s plenty of web pages describing how to access USB devices from within a snap, but they all do cover USB sticks only, i.e. they do not explain how to access a USB device itself, just to access a mounted file system from a USB device. But things here are different. I need to access the device itself.

Where would I find some docs about setting the permissions correctly?

thanks and regards

for the snap side of things there are the raw-usb interface and there is

but that might indeed not change/add the permissions of the device itself, if your app does not run as a daemon (i.e. as root) you might need to cater for that as well to make sure the user is in the correct groups etc …

here is an example snap where i pop up a warning for the user if she is not in the video group … the script is a simple command-chain script using yad to show the popup:

https://github.com/ogra1/vlc-pi-snap/blob/master/scripts/checks.sh