From fec0644989fb857e5da7bc6fc3352618c425fbf3 Mon Sep 17 00:00:00 2001 From: Arnaud Quette Date: Tue, 18 Jun 2024 18:04:41 +0200 Subject: [PATCH] Debug additions Add an option to list USB devices, and adapt the driver logs to the system ones Signed-off-by: Arnaud Quette --- smartnut/config.yaml | 1 + smartnut/rootfs/etc/cont-init.d/smartnut.sh | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/smartnut/config.yaml b/smartnut/config.yaml index 5acfb0d..c7181f1 100644 --- a/smartnut/config.yaml +++ b/smartnut/config.yaml @@ -29,6 +29,7 @@ options: schema: log_level: list(trace|debug|info|notice|warning|error|fatal)? autoconf_usb_devices: bool? + list_usb_devices: bool? autoconf_remote_nut_devices: bool? manually_edit_devices: bool? devices: diff --git a/smartnut/rootfs/etc/cont-init.d/smartnut.sh b/smartnut/rootfs/etc/cont-init.d/smartnut.sh index cb1fe33..c566987 100755 --- a/smartnut/rootfs/etc/cont-init.d/smartnut.sh +++ b/smartnut/rootfs/etc/cont-init.d/smartnut.sh @@ -22,6 +22,17 @@ find /etc/nut -not -perm 0660 -type d -exec chmod 0660 {} \; rm -f "${UPS_CONF}" touch "${UPS_CONF}" +# Adapt driver log level to the system one +if bashio::debug; then + echo "debug_min 5" >> "${UPS_CONF}" +fi + +# USB Debugging +if bashio::config.true 'list_usb_devices' ;then + bashio::log.info "Connected USB devices:" + lsusb +fi + # Check for USB devices first if bashio::config.true 'autoconf_usb_devices' ;then