diff --git a/CHANGELOG b/CHANGELOG index 9f7905b..bb8c470 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +studio-controls version 2.3.7 + + [ Len Ovens ] + - Ensure value exists before using in auto_jack.py + - Ensure value exists before using in autojack + - Don't read empty lock file + studio-controls version 2.3.6 [ Len Ovens ] diff --git a/usr/bin/autojack b/usr/bin/autojack index faca295..5c38b5e 100755 --- a/usr/bin/autojack +++ b/usr/bin/autojack @@ -1795,8 +1795,6 @@ def jack_info(mesg): def ses_cb_command(*args, **kwargs): ''' Generic signal receiver ''' global control_signal - rec_string = f"args: {str(args[0])}" - # logging.debug(f"got signal - {rec_string}") control_signal = args @@ -1807,6 +1805,7 @@ def command_run(): global phones global control_signal args = control_signal + rec_string = f"args: {str(args[0])}" logging.debug(f"got signal - {rec_string}") if 'start' in args: logging.info("Got start signal.") @@ -1919,18 +1918,20 @@ def main(): new_pid = str(os.getpid()) old_pid = new_pid if os.path.isfile(lock_file): - # other instance still hasn't gone maybe hung - with open(lock_file, "r") as lk_file: - for line in lk_file: - # only need one line - old_pid = line.rstrip() - if new_pid != old_pid: - print("old lock file found, killing old pid") - try: - os.kill(int(old_pid), 9) - except Exception: - print("") - time.sleep(1) + file_stats = os.stat(lock_file) + if int(file_stats.st_size): + # other instance still hasn't gone maybe hung + with open(lock_file, "r") as lk_file: + for line in lk_file: + # only need one line + old_pid = line.rstrip() + if new_pid != old_pid: + print("old lock file found, killing old pid") + try: + os.kill(int(old_pid), 9) + except Exception: + print("") + time.sleep(1) with open(lock_file, "w") as lk_file: lk_file.write(new_pid) print("Lock file created") diff --git a/usr/lib/python3/dist-packages/auto_jack.py b/usr/lib/python3/dist-packages/auto_jack.py index 07eea3e..7606e26 100644 --- a/usr/lib/python3/dist-packages/auto_jack.py +++ b/usr/lib/python3/dist-packages/auto_jack.py @@ -581,6 +581,7 @@ def check_devices(our_db): sub_db['description'] = "unknown" # now find the real number + ndevs = -1 if os.path.exists("/proc/asound/cards"): with open("/proc/asound/cards", "r") as cards_file: for line in cards_file: @@ -592,6 +593,8 @@ def check_devices(our_db): ndevs = int(first_el) else: return our_db + if ndevs == -1: + return our_db ndevs += 1 for x in range(0, ndevs): # card loop diff --git a/usr/share/studio-controls/version b/usr/share/studio-controls/version index e75da3e..00355e2 100644 --- a/usr/share/studio-controls/version +++ b/usr/share/studio-controls/version @@ -1 +1 @@ -2.3.6 +2.3.7