Trying to communicate with an android device on a serial port. I can establish a connection through pyserial, but I don't understand how the flow of information works and why I can't get any output (or when I should expect output). As a check, I can log into the device using minicom or python3 -m serial.tools.miniterm and get the expected output from things like pwd and echo hello. My basic code:
import serial
ser = serial.Serial("/dev/ttyS0")
ser.write(b'echo hello')
ser.inWaiting()
ser.write(b'pwd')
ser.inWaiting()
# print(ser.readLine().decode())
ser.inWaiting() returns 0 both times it's called, so there's no point in trying to read anthing.
I would greatly appreciate any discussion of fundamentals that I seem to be missing. Thank you.
from No response from pyserial connection to android on serial port
No comments:
Post a Comment