First of all, is xmodem UNIX only project or does it truly support Windows? If it only supports UNIX-like operating systems, would it make sense to add select() call to the getc() routine so that it can benefit from the timeout parameter?
def getc(size, timeout=1):
buf = None
readable,_,_ = select.select([ser], [], [], timeout)
if ser in readable:
buf = ser.read(size)
return buf
I would also replace serial.Serial() with serial.serial_for_url().
What about Py2 support? Does it still make sense to support it?
First of all, is xmodem UNIX only project or does it truly support Windows? If it only supports UNIX-like operating systems, would it make sense to add
select()
call to thegetc()
routine so that it can benefit from thetimeout
parameter?I would also replace
serial.Serial()
withserial.serial_for_url()
.What about Py2 support? Does it still make sense to support it?