The symptom is pygmc.connect() takes forever and ultimately fails to connect (failing as-in not finding a GMC to connect to, no exception raised)
This is on Ubuntu via VMware with correct udev rules #105 (fix it already Ubuntu!)
Log:
>gc = pygmc.connect()
...
DEBUG:pygmc.connection:Matched devices: [('/dev/ttyUSB1', 'USB VID:PID=1A86:7523 LOCATION=1-2.1')]
DEBUG:pygmc.discovery:Checking port=/dev/ttyUSB1 baudrate=115200
DEBUG:pygmc.connection:reset_input_buffer
DEBUG:pygmc.connection:reset_output_buffer
DEBUG:pygmc.connection:get_exact(cmd=b'<GETSERIAL>>', size=7, expected=b'')
DEBUG:pygmc.connection:write='b'<GETSERIAL>>''
DEBUG:pygmc.connection:read_until(size=7, expected=b'')
DEBUG:pygmc.connection:response=b''
DEBUG:pygmc.connection:get(cmd=b'<GETVER>>', wait_sleep=0.01)
DEBUG:pygmc.connection:write='b'<GETVER>>''
DEBUG:pygmc.connection:read_at_least(size=7, wait_sleep=0.01)
DEBUG:pygmc.connection:read_until(size=7, expected=b'')
DEBUG:pygmc.connection:response=b'GMC-500'
DEBUG:pygmc.connection:read_all
DEBUG:pygmc.connection:response=b'+Re 2.22'
DEBUG:pygmc.connection:combined-response=b'GMC-500+Re 2.22'
DEBUG:pygmc.connection:reset_input_buffer
DEBUG:pygmc.connection:reset_output_buffer
DEBUG:pygmc.connection:reset_input_buffer
DEBUG:pygmc.connection:reset_output_buffer
INFO:pygmc.connection:Close connection: Serial<id=0x713193a531c0, open=True>(port='/dev/ttyUSB1', baudrate=115200, bytesize=8, parity='N', stopbits=1, timeout=5, xonxoff=False, rtscts=False, dsrdtr=False)
DEBUG:pygmc.discovery:Checking port=/dev/ttyUSB1 baudrate=57600
...
Can see empty <GETSERIAL>> yet no error (not shown in logs... it did take 3 seconds to reply)
Was able to reproduce in pure pyserial... (in same session. i.e. no usb reconnect, jupyter notebook restart, etc...)
con = serial.Serial(port='/dev/ttyUSB1', baudrate=115200, timeout=3)
w = con.write(b"<GETSERIAL>>")
print(f'{w=}')
# w=12
_serial_number = con.read_until(terminator=b"", size=7)
print(f'{_serial_number=}')
# _serial_number=b''
A con.read_all() was attempted some time after... empty result. (after the above example with no buffer reset)
Within same session, I tried con.read_until(terminator=b"DeliciousPyGMC", size=7) and then it finally returned a response.
There may be two possible issues here...
- The
terminator=b"" param has some awkward handling when used with pyserial timeout & size (no exception raised)
- GQElectronics GMC has some bug that returns empty response. (GMC map is enabled and running & device hasn't been powered off in a few months)
PyGMC=0.14.1
The symptom is
pygmc.connect()takes forever and ultimately fails to connect (failing as-in not finding a GMC to connect to, no exception raised)This is on Ubuntu via VMware with correct udev rules #105 (fix it already Ubuntu!)
Log:
Can see empty
<GETSERIAL>>yet no error (not shown in logs... it did take 3 seconds to reply)Was able to reproduce in pure
pyserial... (in same session. i.e. no usb reconnect, jupyter notebook restart, etc...)A
con.read_all()was attempted some time after... empty result. (after the above example with no buffer reset)Within same session, I tried
con.read_until(terminator=b"DeliciousPyGMC", size=7)and then it finally returned a response.There may be two possible issues here...
terminator=b""param has some awkward handling when used withpyserialtimeout&size(no exception raised)PyGMC=0.14.1