Hi, I have a Homeassistant OS install on Raspberry Pi 4. I’m connecting to a custom USB device (with a script using AppDaemon), and for the most part it works really well. However, sometimes the connection seems to go ‘stale’, or I restart the script and lose the thread where I am managing the connection - and the USB port gets locked and there is nothing I can do to unlock it other than physically unplug and replug the device.
With other Linux systems, I could run a number of Python or CLI commands to unlock/reset the USB port. But on HomeAssistant OS, depending on the command I’ll get permission denied (for instance using os.O_WRONLY in Python/AppDaemon), or ‘the file system is read-only’ (sending echo 0 > /sys/bus/usb/devices/#-#.#/authorized
by CLI or from Python). I WAS able to successfully reset the USB port via CLI when logged in to the HA server in developer mode using port 22222, I found a method to do that. But nothing from AppDaemon nor by using the Terminal & SSH Add-On. It seems that while the USB port is passed through to the HA Docker container, permission to alter the connection is not.
So I am wondering, is there is any way to unlock a particular USB serial port programmatically from within HomeAssistant/HA Terminal/AppDaemon? Even if it means something like triggering a privileged script running in the base OS (and how the heck to do that, too). Or any other ideas on how to handle this? I’m only semi-familiar with the serial abstraction of USB ports, though seeing anything about udev rules just short of makes me panic…
Thank you!