Trying to connect to a Tevo Tornado 3D printer connected to my MacBook Air via a USB cable. In terminal I identify the USB devcice and try to connect to it using:
> js$ ls /dev/tty* | grep usb
/dev/tty.usbserial-1410
> js$ screen /dev/tty.usbserial-1410
but that yields an unresponsive screen with random looking characters:
If I connect the printer to a Raspberry Pi running OctoPrint software I can look at the terminal output on the Pi's OctoPrint webpage and see the following exchange:
Connecting to: /dev/ttyUSB0
Changing monitoring state from "Offline" to "Opening serial port"
Connected to: Serial<id=0xabb411d0, open=True>(port='/dev/ttyUSB0'
,baudrate=250000, bytesize=8, parity='N', stopbits=1, timeout=10.0
,xonxoff=False, rtscts=False, dsrdtr=False), starting monitor
Changing monitoring state from "Opening serial port" to "Connecting"
Send: N0M110 N0*125
Send: N0 M110 N0*125
Recv: start
Recv: echo:Marlin TORNADO
Send: N0 M110 N0*125
Recv:
...
This lists the baud rate and other connection parameters that allow that software to successfully connect to the printer. Back in terminal, with the printer re-connected directly to the Mac's USB port, I tried to connect by feeding the above information into the screen command like so:
screen /dev/tty.usbserial-14210 250000,cs8,-parenb,-cstopb,-ixoff
I also tried other variations, but they all yield the unresponsive terminal screen above. Does anyone have any ideas on what I'm doing wrong and how I can connect to this USB device using Terminal on my Mac?
Update, Ran stty on the octopi connected to the printer and got these results:
pi@octopi:~ $ stty < /dev/ttyUSB0 -a
speed 0 baud; rows 0; columns 0; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>;
swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 0; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany
-imaxbel -iutf8
-opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl
-echoke -flusho -extproc
Update2: After looking at source code on the OctoPi there is a file called comm.py. It details a process of opening and closing the port while switching parity settings. Apparently this is some kind of common bug/feature??? This is necessary to do for the Python serial library to connect, which I can now do BTW. Here is the code from comm.py which is part of OctoPrint Source:
use_parity_workaround = settings().get(["serial", "useParityWorkaround"])
needs_parity_workaround = get_os() == "linux" and os.path.exists("/etc/debian_version") # See #673
if use_parity_workaround == "always" or (needs_parity_workaround and use_parity_workaround == "detect"):
serial_obj.parity = serial.PARITY_ODD
serial_obj.open()
serial_obj.close()
serial_obj.parity = serial.PARITY_NONE
serial_obj.open()
I still don't know how to get screen to do this disconnect-change parity-connect process though. So maybe screen is not a possibility???