mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Add more (all) device data to checksum
This commit is contained in:
parent
90bcce10f1
commit
bb2fe37e54
1 changed files with 5 additions and 5 deletions
10
tnc/audio.py
10
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})
|
||||
|
|
Loading…
Reference in a new issue