I’m trying to access a board (Razberry HAT) attached the GPIO pins on a Rasberry Pi 3+.
The snap package I’m using is zwavejs2mqtt on a Rasbian (and Ubuntu Server «classic») OS. I’m not using Ubuntu Core.
The device is available at /dev/ttyAMA0. I’ve confirmed it working by compiling Zwavejs2MQTT and run it outside of the snap environment.
However I’m not able to access it from within the snap. The board is not listed from the command snap interface serial-port, only zwavejs2mqtt:serial-port shows up, so there’s no connection to be made between the snap and the OS.
Heres the output of udevadm info -a -n /dev/ttyAMA0:
@rpi:~/zwavejs2mqtt $ udevadm info -a -n /dev/ttyAMA0
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/platform/soc/3f201000.serial/tty/ttyAMA0':
KERNEL=="ttyAMA0"
SUBSYSTEM=="tty"
DRIVER==""
ATTR{close_delay}=="50"
ATTR{closing_wait}=="3000"
ATTR{console}=="N"
ATTR{custom_divisor}=="0"
ATTR{flags}=="0x10000000"
ATTR{io_type}=="2"
ATTR{iomem_base}=="0x3F201000"
ATTR{iomem_reg_shift}=="0"
ATTR{irq}=="114"
ATTR{line}=="0"
ATTR{port}=="0x0"
ATTR{power/control}=="auto"
ATTR{power/runtime_active_time}=="0"
ATTR{power/runtime_status}=="unsupported"
ATTR{power/runtime_suspended_time}=="0"
ATTR{type}=="32"
ATTR{uartclk}=="48000000"
ATTR{xmit_fifo_size}=="16"
looking at parent device '/devices/platform/soc/3f201000.serial':
KERNELS=="3f201000.serial"
SUBSYSTEMS=="amba"
DRIVERS=="uart-pl011"
ATTRS{driver_override}=="(null)"
ATTRS{id}=="00241011"
ATTRS{irq0}=="114"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="1104747"
ATTRS{power/runtime_status}=="active"
ATTRS{power/runtime_suspended_time}=="0"
looking at parent device '/devices/platform/soc':
KERNELS=="soc"
SUBSYSTEMS=="platform"
DRIVERS==""
ATTRS{driver_override}=="(null)"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
looking at parent device '/devices/platform':
KERNELS=="platform"
SUBSYSTEMS==""
DRIVERS==""
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
as you have already found, hotplug support only works for USB devices … serial interface slots can only be provided by gadget snaps, the only way out here would be to build a classic image with a classic gadget snap from scratch … or to switch to Ubuntu Core …
But then again, I have to roll my own to access the serial port?
This won’t be an option. I’m quite sure the users that want to use the snap package of zwavejs2mqtt is not willing to use another OS than they have already installed. They most likely have a bunch of other services already running on their system.