From bb2fe37e5468c07598aa3bc191759a1bec0f6b9c Mon Sep 17 00:00:00 2001 From: Paul Kronenwetter Date: Tue, 20 Sep 2022 18:24:22 -0400 Subject: [PATCH] Add more (all) device data to checksum --- tnc/audio.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tnc/audio.py b/tnc/audio.py index d2eec361..07269087 100644 --- a/tnc/audio.py +++ b/tnc/audio.py @@ -44,12 +44,12 @@ def get_audio_devices(): return list(proxy_input_devices), list(proxy_output_devices) -def device_crc(dev_name: str) -> str: +def device_crc(device) -> str: crc_algorithm = crcengine.new("crc16-ccitt-false") # load crc8 library - crc_hwid = crc_algorithm(bytes(dev_name, encoding="utf-8")) + crc_hwid = crc_algorithm(bytes(f"{device}", encoding="utf-8")) crc_hwid = crc_hwid.to_bytes(2, byteorder="big") crc_hwid = crc_hwid.hex() - return f"{dev_name} [{crc_hwid}]" + return f"{device['name']} [{crc_hwid}]" def fetch_audio_devices(input_devices, output_devices): @@ -86,9 +86,9 @@ def fetch_audio_devices(input_devices, output_devices): name = "" if max_input_channels > 0: - input_devs.add(device_crc(name)) + input_devs.add(device_crc(device)) if max_output_channels > 0: - output_devs.add(device_crc(name)) + output_devs.add(device_crc(device)) for index, item in enumerate(input_devs): input_devices.append({"id": index, "name": item})