Pages: [1]   Go Down
Author Topic: Can't open serial device on MAC  (Read 444 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a problem with TTY device on MAC. I created a script which talks to Arduino and works well on Linux. Problem I'm having with MAC is I can't "fopen" the device. For example, if I do

sudo echo "foo" >> /dev/tty.usbmodem1431

It hangs forever blocking the port. It works well from Arduino's Serial Monitor so theoretically I should be able talking to it.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 495
Posts: 19036
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
sudo echo "foo" >> /dev/tty.usbmodem1431

How do you "append" to the end of a serial port? Try > instead.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Well spotted but the real problem is fopen. Command line example was only to isolate the problem. ">" has the same issue as ">>" it waits forever. I never had this problem on Linux so I presume it's Mac related issue.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I still don't know why I can't open TTY but I found a working solution. I have to wrtie to "/dev/cu.usbmodem1431" instead of "/dev/tty.usbmodem1431"
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 28
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have always had to use cu as well, tty has never worked for me
Logged

Pages: [1]   Go Up
Jump to: