I'm having some trouble with talking to a cisco device over serial using pyserial. I'm getting the response I expect some times, but not always, and I have no idea what I'm doing wrong. Sometimes I just get empty responses multiple times in a row. I'm running windows 7, python 2.7, pyserial 2.7.
Here's some sample code to get some response.
ser = serial.Serial("COM20")
ser.timeout = 2
ser.parity = 'N'
ser.write("\nenable\nsh ip int brief\n")
print ser.read(10**8)
The responses I get look something like this, as expected: Router(config)#
The settings required by cisco:
Bits per sec : 9600
Data bits : 8
Parity : none
Stop bits : 1
Flow control : none
As far as I can tell, they match the defaults for pyserial.