diff --git a/etc/dbus-serialbattery/dbus-serialbattery.py b/etc/dbus-serialbattery/dbus-serialbattery.py index b41588e2..29fd624e 100644 --- a/etc/dbus-serialbattery/dbus-serialbattery.py +++ b/etc/dbus-serialbattery/dbus-serialbattery.py @@ -114,7 +114,7 @@ def get_port() -> str: else: # just for MNB-SPI logger.info("No Port needed") - return "/dev/tty/USB9" + return "/dev/ttyUSB9" logger.info("dbus-serialbattery v" + str(utils.DRIVER_VERSION)) diff --git a/etc/dbus-serialbattery/reinstall-local.sh b/etc/dbus-serialbattery/reinstall-local.sh index 39bcbe88..d0982864 100755 --- a/etc/dbus-serialbattery/reinstall-local.sh +++ b/etc/dbus-serialbattery/reinstall-local.sh @@ -123,7 +123,7 @@ if [ ! -f "$filename" ]; then fi # kill driver, if running. It gets restarted by the service daemon -pkill -f "python .*/dbus-serialbattery.py$" +pkill -f "python .*/dbus-serialbattery.py /dev/tty.*" @@ -145,16 +145,18 @@ IFS="," read -r -a bms_array <<< "$bluetooth_bms_clean" length=${#bms_array[@]} # echo $length -# stop all dbus-blebattery services -svc -u /service/dbus-blebattery.* +# stop all dbus-blebattery services, if at least one exists +if [ -d "/service/dbus-blebattery.0" ]; then + svc -u /service/dbus-blebattery.* -# always remove existing blebattery services to cleanup -rm -rf /service/dbus-blebattery.* + # always remove existing blebattery services to cleanup + rm -rf /service/dbus-blebattery.* -# kill all blebattery processes that remain -pkill -f "supervise dbus-blebattery.*" -pkill -f "multilog .* /var/log/dbus-blebattery.*" -pkill -f "python .*/dbus-serialbattery.py .*_Ble" + # kill all blebattery processes that remain + pkill -f "supervise dbus-blebattery.*" + pkill -f "multilog .* /var/log/dbus-blebattery.*" + pkill -f "python .*/dbus-serialbattery.py .*_Ble" +fi if [ "$length" -gt 0 ]; then @@ -247,6 +249,7 @@ else # remove cronjob sed -i "/5 0,12 \* \* \* \/etc\/init.d\/bluetooth restart/d" /var/spool/cron/root + echo echo "No Bluetooth battery configuration found in \"/data/etc/dbus-serialbattery/config.ini\"." echo "You can ignore this, if you are using only a serial connection." echo diff --git a/etc/dbus-serialbattery/utils.py b/etc/dbus-serialbattery/utils.py index f3553d61..8ea766ba 100644 --- a/etc/dbus-serialbattery/utils.py +++ b/etc/dbus-serialbattery/utils.py @@ -38,7 +38,7 @@ def _get_list_from_config( # if not specified: baud = 9600 # Constants - Need to dynamically get them in future -DRIVER_VERSION = "1.0.20230608dev" +DRIVER_VERSION = "1.0.20230610dev" zero_char = chr(48) degree_sign = "\N{DEGREE SIGN}"