Serial Communication from shell Mac OS X PHP script


 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Serial Communication from shell Mac OS X PHP script
# 1  
Old 04-17-2008
Serial Communication from shell Mac OS X PHP script

Hi again,

I spoke with Keyspan and they assured me the USB to Serial device was working if I could use the Screen tool.

I asked why I was unable to redirect stdin/stdout to and from the /dev/tty. device and was told there was no reason I shouldn't be able to do so.

I have tried:

#echo “A” > /dev/ tty.USA28Xb2P1.1

The terminal window just hangs.

I have also tried #chat and #efax with no luck...

Has anyone had any luck with serial port communication from any other shell scripting language on a unix/linux box?

Thanks!

Corey




Subject: [nyphp-talk] Serial communication in Mac OS X
To: <talk@lists.nyphp.org>
Message-ID: <C42C2CE7.59796%corey@bmfenterprises.com>
Content-Type: text/plain; charset="us-ascii"

Hi All,

I am trying to connect to /dev/tty.USA28Xb2P1.1 which is a Keyspan USB to
Serial adapter. I have had success using the screen utility, #screen
/dev/tty.USA28Xb2P1.1 but I would like to use PHP to create a web interface
to a microcontroller.

I have attempted fopen with no luck:

> $port = "/dev/tty.USA28Xb2P1.1";
>
> $p = fopen($port, 'r+');
> $read = fread($p, filesize($port));
> fclose($p);
>
> echo $read;
>
> $p = fopen($port, 'r+');
> fwrite($p, "A");
> fclose($p);

I have tried SerProxy but cannot get a connection through telnet. I have
also tried LibSerial but could only find version 0.5.2 which does not yet
support PHP apparently... I have read about IOKit but I am not sure it will
get me where I want to be.

Any help would be greatly appreciated.

Thank you!

Corey
# 2  
Old 11-07-2008
I downloaded and compiled kermit on OSX 10.4 for use with the Keyspan connecting through /dev/tty.USA19H1d1P1.1 . In the past I had an entire factory tied together with kermit and scripts. Give it a shot.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. HP-UX

Serial standard communication (stty)

Hello friends, I am trying to communicate with a programmer memory from Unix (HP-UX) via serial port. Well, I have some code ready stty parameters to achieve communicating the device with the computer, but I have my doubts. I would like to know if you have some code fragment where you use the... (5 Replies)
Discussion started by: Monttanna
5 Replies

2. OS X (Apple)

Inter-shell communication

If I open two bash shells and telnet from Shell 2 to a remote server (on the Net), is there a way to direct input from Shell 1 to the telnet shell? The telnet shell is a limited environment with a specific command set. I want to direct commands from Shell 1 and, if possible, put 1-second... (2 Replies)
Discussion started by: xinUoG
2 Replies

3. Programming

Serial communication failing

edit: never mind; mods please delete. I finally got so frustrated I figured it couldn't be the code and it must be the device on the other end. After pulling it out of its cradle, I realized it was a different model number than the one I was using before, and wasn't accepting my... (1 Reply)
Discussion started by: DreamWarrior
1 Replies

4. OS X (Apple)

Use a Serial Console with Mac OS X Leopard

I'm trying to use an old Commodore 128D as a terminal to access OS X's shell via a serial port. I've used 'screen' and 'zterm' to ensure the two machines are successfully interfaced. Instructions for opening up the serial console on other Unix-y operating systems don't work with OS X Leopard. ... (3 Replies)
Discussion started by: joecassara
3 Replies

5. Programming

problem while having a communication with serial port?????

hello, I am gettin problem while sending and recieving data through seial port... when I am sending Data then the reciever end is not able to recieve that data ..... Reciever end is running in infinite loop just polling after some time to check that there is data on the port and then again... (9 Replies)
Discussion started by: arunchaudhary19
9 Replies

6. IP Networking

ip communication through serial connection

I have serial modem connection between two computers. We have to login the remote computer through ip address. How can I get the ip address in this connection? (1 Reply)
Discussion started by: pcsaji
1 Replies

7. UNIX for Dummies Questions & Answers

serial communication

This isn't really a unix question, or even a programming question, but I hope you guys can help. I want to create a program to control the electricity on a model railway. I have created the program to that it sends characters over the serial cable, but now I need to do the switch that will... (1 Reply)
Discussion started by: KrazyGuyPaul
1 Replies

8. UNIX for Advanced & Expert Users

Serial Communication in UNIX

Hi, I am working on serial communication on Unix. Can anyone guide me through it. The steps required for RS 232 communication and can i do serial communication even if i dont have super user previledges. Thankx, Vicky (1 Reply)
Discussion started by: Vicky
1 Replies

9. UNIX for Dummies Questions & Answers

Serial port communication

We're running SCO Unix Openserver 5.05 and I'm having trouble with serial communication between the com2 serial port and a handheld device. Downloading data from Unix to the handheld works perfectly, but the other way around creates a major problem. I don't know whether it's a buffer overflow or... (1 Reply)
Discussion started by: Aretha
1 Replies
Login or Register to Ask a Question