From 9f3f8a360fd853a85400b8e9442bcb15498e66a0 Mon Sep 17 00:00:00 2001 From: Samie Bee Date: Sun, 29 Sep 2024 14:55:24 -0400 Subject: [PATCH 1/2] Support Enlighten 4.1.6 revision codes --- usb/wasatchConfig.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usb/wasatchConfig.py b/usb/wasatchConfig.py index f8beefc2..70c95e30 100644 --- a/usb/wasatchConfig.py +++ b/usb/wasatchConfig.py @@ -66,6 +66,14 @@ def ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue=0, wIndex=0, if dev_handle == 0xc0 and bmRequestType == 0xff and bRequest == 0x3 and wValue == 0x0 and wIndex == 0x40 and self.idProduct == 0x1000: return [0x00, 0x04] + # REQUEST REVISION CODE + if dev_handle == 0xc0 and bmRequestType == 0xc0 and bRequest == 0x0 and wValue == 0x0 and wIndex == 0x40: + return [0x00, 0x00] + + # REQUEST FPGA REVISION + if dev_handle == 0xc0 and bmRequestType == 0xb4 and bRequest == 0x0 and wValue == 0x0 and wIndex == 0x07: + return [0x00, 0x00] + # log unhandled ctrl messages def display(k): if type(k) == int: From 98a00eff8575ca1dc0ff4db4300155e681864b0e Mon Sep 17 00:00:00 2001 From: Samie Bee Date: Sun, 24 Nov 2024 11:24:10 -0500 Subject: [PATCH 2/2] Remove dev_handle, correcting variable names in receiver messages --- usb/wasatchConfig.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usb/wasatchConfig.py b/usb/wasatchConfig.py index 70c95e30..8283f44d 100644 --- a/usb/wasatchConfig.py +++ b/usb/wasatchConfig.py @@ -49,29 +49,29 @@ def __init__(self, custom_eeprom=None): self.eeprom.generate_write_buffers() - def ctrl_transfer(self, dev_handle, bmRequestType, bRequest, wValue=0, wIndex=0, data_or_wLength = None, timeout = None): + def ctrl_transfer(self, bmRequestType, bRequest, wValue=0, wIndex=0, data_or_wLength = None, timeout = None): """ Here we pretend to be the device firmware """ # REQUEST EEPROM - if dev_handle == 0xc0 and bmRequestType == 0xff and bRequest == 0x1 and wIndex == 0x40: + if bmRequestType == 0xc0 and bRequest == 0xff and wValue == 0x1 and data_or_wLength == 0x40: buf = self.eeprom.write_buffers[self._eeprom_page] self._eeprom_page += 1 return buf # REQUEST FPGA COMPILATION OPTIONS - if dev_handle == 0xc0 and bmRequestType == 0xff and bRequest == 0x4 and wIndex == 0x40: + if bmRequestType == 0xc0 and bRequest == 0xff and wValue == 0x4 and data_or_wLength == 0x40: return [0xFF, 0xFF] # REQUEST LINE LENGTH (pid=0x1000) - if dev_handle == 0xc0 and bmRequestType == 0xff and bRequest == 0x3 and wValue == 0x0 and wIndex == 0x40 and self.idProduct == 0x1000: + if bmRequestType == 0xc0 and bRequest == 0xff and wValue == 0x3 and wIndex == 0x0 and data_or_wLength == 0x40 and self.idProduct == 0x1000: return [0x00, 0x04] # REQUEST REVISION CODE - if dev_handle == 0xc0 and bmRequestType == 0xc0 and bRequest == 0x0 and wValue == 0x0 and wIndex == 0x40: + if bmRequestType == 0xc0 and bRequest == 0xc0 and wValue == 0x0 and wIndex == 0x0 and data_or_wLength == 0x40: return [0x00, 0x00] # REQUEST FPGA REVISION - if dev_handle == 0xc0 and bmRequestType == 0xb4 and bRequest == 0x0 and wValue == 0x0 and wIndex == 0x07: + if bmRequestType == 0xc0 and bRequest == 0xb4 and wValue == 0x0 and wIndex == 0x0 and data_or_wLength == 0x07: return [0x00, 0x00] # log unhandled ctrl messages @@ -82,7 +82,7 @@ def display(k): return None else: return str(k) - print("unhandled ctrl_t:", 'dev_handle ==', display(dev_handle), 'and bmRequestType ==', display(bmRequestType), 'and bRequest ==', display(bRequest), 'and wValue ==', display(wValue), 'and wIndex ==', display(wIndex), 'and data_or_wLength ==', display(data_or_wLength), 'and timeout ==',timeout) + print('unhandled ctrl_t: bmRequestType ==', display(bmRequestType), 'and bRequest ==', display(bRequest), 'and wValue ==', display(wValue), 'and wIndex ==', display(wIndex), 'and data_or_wLength ==', display(data_or_wLength), 'and timeout ==',timeout) def read(self, endpoint, msgLen, timeout): " Lets just spit out a spectrum ! (tho this could be EEPROM, i think, depending on last ctrl_t) "