I have a python program that sends text message using a USB modem, it works fine..
But sometimes when I reboot my device the program cant fine the device, so I need unplug than plug back again to work... is there someway to locate the usb inside the code?
At this point:
Code: Select all
dongle = serial.Serial(port="/dev/serial/by-id/usb-HUAWEI_HUAWEI_Mobile-if02-port0",baudrate=9600,timeout=0,rtscts=0,xonxoff=0)
Code: Select all
Traceback (most recent call last):
File "lsms.py", line 5, in <module>
dongle = serial.Serial(port="/dev/serial/by-id/usb-HUAWEI_HUAWEI_Mobile-if02-port0",baudrate=9600,timeout=0,rtscts=0,xonxoff=0)
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 260, in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 276, in open
raise SerialException("could not open port %s: %s" % (self._port, msg))
serial.serialutil.SerialException: could not open port /dev/serial/by-id/usb-HUAWEI_HUAWEI_Mobile-if02-port0: [Errno 2] No such file or directory: '/dev/serial/by-id/usb-HUAWEI_HUAWEI_Mobile-if02-port0'
Thanks