RE: [PHP] Com Port Access - Take 2
| From: | Matthias Endler | Date: | Wed, 18 Oct 2000 23:38:10 +0000 |
| Subject: | RE: [PHP] Com Port Access - Take 2 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-21008@lists.php.net to get a copy of this message | ||
Hi Chris,
> >(1) the easy way
> >
> >You have a commandline tool to control the device on serialport, then you
> >can simply use PHP's popen()-function
> >(http://au.php.net:81/manual/function.popen.php).
>
> Okay, now my problem is, I dont know what applications I need to
> install on
> my unix box to have console access to the serial port. I have
> used Minicom
> to access it, but minicom is unable to be launched by popen() because its
> not command line.
>
> Do you, or anyone else have any suggestions of a good tool to use that
> works well with php so I can access the serial port ?
if /dev/ttyS0 is your serialport, you could simply do a:
system("echo -n 'hello' > /dev/ttyS0");
the only thing is that you need proper permissions set for /dev/ttyS0
(symlink), so your webserver user can write to it. I'm not sure how to read
from it though.
Cheers,
Matthias