Php Serial Port Communication Linux Wine
Dec 11, 2015. The serial port is not of much use today, but there are still some things that rely on serial port communication. The question is how do you map a Wine Windows serial port to a Linux device. If you use Linux and rely on a Windows only serial port application, besides virtualization, you could use Wine. RIGblaster - Links to Ham Radio Sound Card Software. This collection of software programs is included on the DVD of Sound Card Software Collection. Wine Yard offers final year projects for B.Tech ECE students in Multirotors,ARM Processor,Bio metrics,Radar,Wi-Fi,ZigBee,Bluetooth,RF,GSM,CDMA,Digital Image.
I'm working with an application which connects to Huawei 3G Modem using COM ports in php. Here is my code:
sms.php:
This is working fine with me. Now challenge is every time i connect to the new usb port the COM was changing for my modem. Is there any other way to detect the device automatically with php in windows ?
1 Answer
You need to determinate COM port number of your USB device via some external command called trough PHP's shell_exec().
For Windows you can try this small tool:
After you call this tool via shell_exec(), you need to parse it's output (RegExp) and look for exact COM port number based on company/device name.
Not the answer you're looking for? Browse other questions tagged windowsserial-portgsmmodem or ask your own question.
I try to read serial port on Linux platform using PHP.
But I cant read any data. When I try to read using .net, this time I can read.
I use 'php_serial.class.php' class for serial port operations. You can read this class from this link :
here
My code is like this :
the line 'print_r(' (size '.strlen($read). ' ) ');' always return zero. What is the reason why I cant read data from serial port?
3 Answers
I am sure you have rsolved this by now, but here is my 2c worth.
You read the serial port twice. Once to check if there is data and then again when there is data. In my experience, reading it once clears the buffer and thus reading it again will yield an empty result.
Just do not read it the second time
Had the same problem. I needed two options set using stty -isig -icanon
once they were set the script read no problem.
Hello this is REALLY old but I am currently (still am) working on this, I got the bytes back correctly (remove ord() to read as a string btw).
The reason it is coming through as zero is because of the infinite loop, even if you send something nothing is being returned (so it would seem) Though using your code I managed to get things returned as strings.
Hyperterminal
I actually entered data the device side into the console...this then returned me what i entered into the device, it appears you would need to fork the process in order to do it 100% your way. The reason it works sometimes is because if you enter a command which returns a few lines it will most likely get some of them.
Serial Port Communication Program
use screen to connect to the device and then just type random things and hit enter... you will see it appear on your php output.