How can I communicate with a 3G modem via pySerial while it is connected?

白昼怎懂夜的黑 提交于 2019-12-04 12:55:59

Ah. Apparently this modem exposes a couple of ttys to work with. I was able to use /dev/ttyUSB1 to sent AT commands while WvDial was connected on /dev/ttyUSB0:

import serial

ser = serial.Serial('/dev/ttyUSB1', 9600, timeout=2)

at_command = 'AT+ZCSQ\r\n'
ser.write(at_command)
ser.sendBreak()

line = ser.read(ser.inWaiting())
ser.close

print line
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!