bglib icon indicating copy to clipboard operation
bglib copied to clipboard

packet mode incorrect should produce a better error message

Open AlanBell opened this issue 12 years ago • 0 comments

if you don't change packet_mode to False in bglib_test_scanner.py (and others) then it will send a packet that causes the BLED112B USB dongle to reset itself (which you can see happening in /var/log/syslog - it reattaches itself to USB) and you get the following error message

$python bglib_test_scanner.py Traceback (most recent call last): File "bglib_test_scanner.py", line 117, in main() File "bglib_test_scanner.py", line 94, in main ble.send_command(ser, ble.ble_cmd_gap_set_mode(0, 0)) File "/home/alan/Projects/rfid/bglib/Python/Examples/bglib.py", line 642, in send_command ser.write(packet) File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 489, in write raise SerialException('write failed: %s' % (v,)) serial.serialutil.SerialException: write failed: [Errno 5] Input/output error

it would be good if this could be trapped in bglib and raise a more informative error message pointing to the packet mode flag as a possible cause.

AlanBell avatar Sep 25 '13 11:09 AlanBell