PHP to read a COM port??
| From: | David Bouw | Date: | Sat, 04 Nov 2000 11:22:09 +0000 |
| Subject: | PHP to read a COM port?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-23704@lists.php.net to get a copy of this message | ||
Hi..
I have a serial barcode scanner which I would like to use with PHP to enter Barcode data and store
this with PHP
in a MySQL database..
This barcode scanner is serial and I would like to know if there is a possibility to read the serial
port with PHP.?
I found the following postings on internet:
>I recently received some barcode scanners that plug directly into a serial port, such as
>tty/b01. I read that I can >disable getty, make a node and open the tty as an input file, but I
>don't know how to identify the file/pointer/??? to >open the file. Can anyone help with a
>simple C language program? thanks
And this is the answer
>I got this one from a consultant...when reading directly from a port for a barcode
>scanner/decoder, simply fopen >the device name, such as ttyb16, but remember to fopen in the
>"rb" mode. "b" denotes binary. Use stty to set the >speed and parameters of
>the port.
Is something like this possible with PHP..?
My question, if I setup the above (with fopen(/dev/tty01) ??) what should I do to let PHP stop
reading the Serial port and continue after a barcode is scanned.? (If I don't do anything he
will probably just wait for more data)
Barcodes begin with a * character and also end with one.. Is is possible to do some kind of while
loop till I detect the * character for a second time?
If I anyone has experience on reading a serial port under unix I would greatly appreciate help. I am
used to windows and what I understand is that you can use file pointers to all kinds of devices
under Linux/Unix..
Thanks in advance..
(PS: Please also send a copy to my email when replying)
David