Sponsored Content
Operating Systems OS X (Apple) Serial Communication from shell Mac OS X PHP script Post 302186650 by cpfogarty on Thursday 17th of April 2008 05:01:28 PM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
UCOM(4) 						   BSD Kernel Interfaces Manual 						   UCOM(4)

NAME
ucom -- USB tty support SYNOPSIS
To compile this driver into the kernel, place the following line in your kernel configuration file: device ucom Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): ucom_load="YES" DESCRIPTION
The ucom driver attaches to USB modems, serial ports, and other devices that need to look like a tty. The ucom driver shows a behavior like a tty(4). This means that normal programs such as tip(1) or pppd(8) can be used to access the device. The portno locater can be used to decide which port to use for devices that have multiple external ports. BUGS
Prior to FreeBSD 6.0 ucom created /dev/ucom? rather than the uniform device names created today. Old scripts must be adjusted accordingly. FILES
/dev/cuaU? /dev/ttyU? SEE ALSO
tty(4), uark(4), uchcom(4), uftdi(4), umct(4), umodem(4), uplcom(4), usb(4), uvisor(4), uvscom(4) HISTORY
The ucom driver was adopted from NetBSD in March of 2002. This manual page was adopted from NetBSD by Tom Rhodes <trhodes@FreeBSD.org> in April 2002. BSD
March 1, 2008 BSD
All times are GMT -4. The time now is 05:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy