Add more (all) device data to checksum

This commit is contained in:
Paul Kronenwetter 2022-09-20 18:24:22 -04:00
parent 90bcce10f1
commit bb2fe37e54

View file

@ -44,12 +44,12 @@ def get_audio_devices():
return list(proxy_input_devices), list(proxy_output_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_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.to_bytes(2, byteorder="big")
crc_hwid = crc_hwid.hex() 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): def fetch_audio_devices(input_devices, output_devices):
@ -86,9 +86,9 @@ def fetch_audio_devices(input_devices, output_devices):
name = "" name = ""
if max_input_channels > 0: if max_input_channels > 0:
input_devs.add(device_crc(name)) input_devs.add(device_crc(device))
if max_output_channels > 0: if max_output_channels > 0:
output_devs.add(device_crc(name)) output_devs.add(device_crc(device))
for index, item in enumerate(input_devs): for index, item in enumerate(input_devs):
input_devices.append({"id": index, "name": item}) input_devices.append({"id": index, "name": item})