diff --git a/usb/wasatchConfig.py b/usb/wasatchConfig.py index f8beefc2..8283f44d 100644 --- a/usb/wasatchConfig.py +++ b/usb/wasatchConfig.py @@ -49,23 +49,31 @@ 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 bmRequestType == 0xc0 and bRequest == 0xc0 and wValue == 0x0 and wIndex == 0x0 and data_or_wLength == 0x40: + return [0x00, 0x00] + + # REQUEST FPGA REVISION + if bmRequestType == 0xc0 and bRequest == 0xb4 and wValue == 0x0 and wIndex == 0x0 and data_or_wLength == 0x07: + return [0x00, 0x00] + # log unhandled ctrl messages def display(k): if type(k) == int: @@ -74,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) "