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
UPLCOM(4)						   BSD Kernel Interfaces Manual 						 UPLCOM(4)

NAME
uplcom -- USB support for Prolific PL-2303/2303X/2303HX serial adapters driver SYNOPSIS
To compile this driver into the kernel, place the following lines in your kernel configuration file: device uplcom device ucom Alternatively, to load the driver as a module at boot time, place the following line in loader.conf(5): uplcom_load="YES" DESCRIPTION
The uplcom driver provides support for various serial adapters based on the Prolific PL-2303, PL-2303X and PL-2303HX USB-to-RS232 Bridge chips. The device is accessed through the ucom(4) driver which makes it behave like a tty(4). HARDWARE
The uplcom driver supports the following adapters: o ATEN UC-232A o BAFO BF-800 o BAFO BF-810 o Belkin F5U257 o ELECOM UC-SGT o HAL Corporation Crossam2+USB IR commander o Hama USB RS-232 Serial Adapter o Hamlet exagerate XURS232 o IOGEAR UC-232A o I/O DATA USB-RSAQ o I/O DATA USB-RSAQ2 o I/O DATA USB-RSAQ3 o Mobile Action MA-620 Infrared Adapter o PLANEX USB-RS232 URS-03 o RATOC REX-USB60 o Radio Shack USB Serial Cable o Sandberg USB to Serial Link (model number 133-08) o SOURCENEXT KeikaiDenwa 8 (with and without charger) o Sony Ericsson USB Cable (Susteen USB Data Cable) o Willcom W-SIM DD PHS terminal.(WS002IN) SEE ALSO
tty(4), ucom(4), usb(4) HISTORY
The uplcom driver appeared in NetBSD 1.6. This manual page was adopted from NetBSD by Tom Rhodes <trhodes@FreeBSD.org> in April 2002. BSD
November 22, 2006 BSD
All times are GMT -4. The time now is 11:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy