projects
/
goodfet
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
turn ftdi driver into echo server
[goodfet]
/
client
/
USBFtdi.py
diff --git
a/client/USBFtdi.py
b/client/USBFtdi.py
index
32f3204
..
abc5980
100644
(file)
--- a/
client/USBFtdi.py
+++ b/
client/USBFtdi.py
@@
-137,7
+137,7
@@
class USBFtdiInterface(USBInterface):
USBEndpoint.usage_type_data,
16384, # max packet size
0, # polling interval, see USB 2.0 spec Table 9-13
USBEndpoint.usage_type_data,
16384, # max packet size
0, # polling interval, see USB 2.0 spec Table 9-13
-
self.handle_buffer_available
# handler function
+
None
# handler function
)
]
)
]
@@
-155,11
+155,16
@@
class USBFtdiInterface(USBInterface):
descriptors
)
descriptors
)
- def handle_buffer_available(self):
- pass
-
def handle_data_available(self, data):
def handle_data_available(self, data):
- print(bytes_as_hex(data))
+ s = data[1:]
+ if self.verbose > 0:
+ print(self.name, "received string", s)
+
+ s = s.replace(b'\r', b'\r\n')
+
+ reply = b'\x01\x00' + s
+
+ self.configuration.device.maxusb_app.send_on_endpoint(3, reply)
class USBFtdiDevice(USBDevice):
class USBFtdiDevice(USBDevice):
@@
-181,8
+186,8
@@
class USBFtdiDevice(USBDevice):
0, # device subclass
0, # protocol release number
64, # max packet size for endpoint 0
0, # device subclass
0, # protocol release number
64, # max packet size for endpoint 0
- 0x0
304
, # vendor id: FTDI
- 0x
0160
, # product id: FT232 USB-Serial (UART) IC
+ 0x0
403
, # vendor id: FTDI
+ 0x
6001
, # product id: FT232 USB-Serial (UART) IC
0x0001, # device revision
"GoodFET", # manufacturer string
"FTDI Emulator", # product string
0x0001, # device revision
"GoodFET", # manufacturer string
"FTDI Emulator", # product string