NYCPHP Meetup

NYPHP.org

[nycphp-talk] Re: talk Digest, Vol 18, Issue 38

Ben Sgro ben at projectskyline.com
Thu Apr 17 17:12:24 EDT 2008


Hello Corey,

Did you try running sudo <command>

Maybe you need root to write to serial...

- Ben

Corey Fogarty wrote:
> 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: [nycphp-talk] Serial communication in Mac OS X
>     To: <_talk at lists.nyphp.org_>
>     Message-ID: <_C42C2CE7.59796%corey at 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
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php



More information about the talk mailing list