- Php serial port windows
- About
- Php serial port windows
- Php serial port windows
- About
- PHP + COM порт
- gravataLonga / php_serial.class.php
- This comment has been minimized.
- const669 commented May 29, 2019
- This comment has been minimized.
- mailworm commented Mar 9, 2020 •
- This comment has been minimized.
- ElvisAns commented Oct 17, 2020
- This comment has been minimized.
- gravataLonga commented Oct 18, 2020
- This comment has been minimized.
- gravataLonga commented Oct 18, 2020
- This comment has been minimized.
- mailworm commented Oct 20, 2020
Php serial port windows
PHP Serial was written at a time where I did not know any other language than PHP and I started to get seriously bored with its abilities.
I somehow got hold of a « Citizen C2202-PD » point-of-sale display, and I wanted to play around with it. I also managed to get the documentation of it, and created a convenience class to access the serial port though the Linux file.
Afterwards, I posted it to PHP Classes, and this probably is what brought it any visibility.
State of the project
Interestingly enough, this piece of code that is widely untested has created a lot if interest ever since it was created, and especially nowadays with everybody toying around with Arduinos and Raspberry Pis. I receive about 1 email every month asking for help with the code or sending patches/suggestions.
I think that it is time for me to remove the dust off this project and to give it a full visibility on modern tools, aka GitHub.
There is lots of bugs. I know there is. I just don’t know which are they.
- Linux: the initially supported platform, the one I used. Probably the less buggy one.
- MacOS: although I never tried it on MacOS, it is similar to Linux and some patches were submitted to me, so I guess it is OK
- Windows: it seems to be working for some people, not working for some others. Theoretically there should be a way to get it done.
I have a few concerns regarding the behaviour of this code.
- Inter-platform consistency. I seriously doubt that all operations go the same way across all platforms.
- Read operations. Reading was never needed in my project, so all the tests I did on that matter were theoretic. I was also quite naive, so the API is probably not optimal. What we need is to re-think reading from scratch.
- Configuration done by calling functions. This is so Java. It would be much better to be able to pass a configuration array once and for all. Furthermore, I suspect that the order of call matters, which is bad.
- Auto-closing the device. There is an auto-close function that is registered at PHP shutdown. This sounds quite ridiculous, something has to be done about that.
- Use exceptions. Currently there is an heavy use of the errors system to report errors (2007 baby), but this is seriously lame. They have to be replaced by actual exceptions.
Call for contribution
I have about 0 time to code or test this project. However, there is clearly a need for it.
As in all open-source projects, I need people to fit this to their needs and to contribute back their code.
What is needed, IMHO:
- Address the concerns listed above, and find new ones.
- Create a reproducible test environment for each OS, and prove that each feature works (basically, unit-testing).
- Report of use cases, bugs, missing features, etc.
If you feel like doing any of those, do not hesitate to create an issue or a pull-request, I’ll gladly consider consider it 🙂
PHP Serial Copyright (C) 2007-2014 PHP Serial’s contributors (see CONTRIBUTORS file)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
About
Multi-platform convenience class to access the serial port from PHP
Php serial port windows
Php serial port windows
PHP Serial was written at a time where I did not know any other language than PHP and I started to get seriously bored with its abilities.
I somehow got hold of a « Citizen C2202-PD » point-of-sale display, and I wanted to play around with it. I also managed to get the documentation of it, and created a convenience class to access the serial port though the Linux file.
Afterwards, I posted it to PHP Classes, and this probably is what brought it any visibility.
State of the project
Interestingly enough, this piece of code that is widely untested has created a lot if interest ever since it was created, and especially nowadays with everybody toying around with Arduinos and Raspberry Pis. I receive about 1 email every month asking for help with the code or sending patches/suggestions.
I think that it is time for me to remove the dust off this project and to give it a full visibility on modern tools, aka GitHub.
There is lots of bugs. I know there is. I just don’t know which are they.
- Linux: the initially supported platform, the one I used. Probably the less buggy one.
- MacOS: although I never tried it on MacOS, it is similar to Linux and some patches were submitted to me, so I guess it is OK
- Windows: it seems to be working for some people, not working for some others. Theoretically there should be a way to get it done.
I have a few concerns regarding the behaviour of this code.
- Inter-platform consistency. I seriously doubt that all operations go the same way across all platforms.
- Read operations. Reading was never needed in my project, so all the tests I did on that matter were theoretic. I was also quite naive, so the API is probably not optimal. What we need is to re-think reading from scratch.
- Configuration done by calling functions. This is so Java. It would be much better to be able to pass a configuration array once and for all. Furthermore, I suspect that the order of call matters, which is bad.
- Auto-closing the device. There is an auto-close function that is registered at PHP shutdown. This sounds quite ridiculous, something has to be done about that.
- Use exceptions. Currently there is an heavy use of the errors system to report errors (2007 baby), but this is seriously lame. They have to be replaced by actual exceptions.
Call for contribution
I have about 0 time to code or test this project. However, there is clearly a need for it.
As in all open-source projects, I need people to fit this to their needs and to contribute back their code.
What is needed, IMHO:
- Address the concerns listed above, and find new ones.
- Create a reproducible test environment for each OS, and prove that each feature works (basically, unit-testing).
- Report of use cases, bugs, missing features, etc.
If you feel like doing any of those, do not hesitate to create an issue or a pull-request, I’ll gladly consider consider it 🙂
PHP Serial Copyright (C) 2007-2014 PHP Serial’s contributors (see CONTRIBUTORS file)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
About
Multi-platform convenience class to access the serial port from PHP
PHP + COM порт
Добрый день. Стоит задача реализовать отправку смс через 3g модем средствами пхп. Воспользовался классом php_serial.class.php, но скрипт отправки отправки отказывается работать с com портом, указываю ошибку, что порт не верный. Проблема как для меня – доступ к com порту запрещен. Прежде никогда не работал с com портами, но считаю, что все должно работать, так как на сервере стоит два модема и на один модем комманды уходят, но он используется другим(аналогичным) ПО, написанным на делфи и его использовать нельзя. Модем Huawei, как мне заставить модем работать с php. утилита Putty отправляет сообщения с этого модема . Пример скрипта
PHP и Arduino. COM порт. Не сохраняется $_SESSION
Требуется управлять платой Arduino по usb – ком интерфейс. Ос ubuntu. Отправка в ком порт – как и в.
Ищу помошников, для того что бы закончить порт UglifyJS на PHP
Привет всем, я ищу помощь. Сам я программист но из за учебы сейчас не достаточно времени что бы.
В конфигурационном файле прописан порт, но пишет ошибку порт 80 занят другим приложением
Здравствуйте. Пишу решение с 2 проектами – сервер и клиент с дуплексным контрактом. Служба.
CarterSS, сегодня полдня точно так же проигрался с 3G модемом Huawei E173 и отправкой СМС с PHP-скрипта.
Все примеры в интернете перепробовал, но СМС не уходят. С штатной программы улетают на “раз-два”.
Но, есть одно “НО”. Пользуюсь так же программкой – и СМС улетают на УРА, при том что улетают как из самой программы, так и через VBS-скрипт.
Запуск VBS-скрипта идет с PHP-скрипта. Криво, но как-то работает. Но хотелось бы работать с модемом напрямую с PHP-скрипта.
Добавлено через 1 час 12 минут
Работает. 🙂
Оказывается, забыли включить в пример первоначальную АТ-команду “AT”
так же где-то в интернете читал, что желательно после каждой команды делать задержку и считывать информацию с порта – если кто знает, подскажите, нужно или нет.
Добавлено через 13 часов 54 минуты
CarterSS, Вы правы.
Huawei пингвин гордый. Нужно его “пинать” через heperterminal. И то, не всегда выходит
Этот класс write-only под Windows (и rw под *nix), не интересно.
Я для работы с COM-портами использую http://pecl.php.net/dio , работает прекрасно. Вероятно и в вашем случае компиляция (вру, там есть готовая DLL’ка под Windows!) этого расширения решит проблему без костылей вроде коннекта к порту из стороннего ПО. Правда конфигурировать КОМ-порт придется все равно через сторонние утилиты (аналогично тому, как это делает php_serial.class.php).
Правда после написания своих велосипедов на PHP, – я случайно наткнулся что в расширениях к Chroimium-based браузеру можно обращаться напрямую к COM-портам, что кстати тоже очень интересное решение в рамках стека веб-технологий, например (гуглить “chrome serial api”):
root, почему обязательно веб-сервер?
У меня это терминал на raspberry pi, у него есть картридер и ко всему этому счастью – веб-интерфейс, как раз на chromium. Работать с картридером прямо из JS очень даже логично (т.к. картридер напрямую связан с пользовательским интерфейсом), нежели гонять на локалхост запросы (и тут уже не важно, – общаешься ты дальше с ним из PHP или из C++, тут уже костыль), чтобы обратится к картридеру.
Или по-вашему делать терминалы на веб-технологиях – тоже бред. 😉
PS: Нет, не тормозит.
не знаю, вроде бы как раздел форума обязывает.. хотелось бы следовать.. ээ правилам..
Добавлено через 2 минуты
хороший у вас сервант.. У меня доступ к серверу только через веб.. к кардридерам доступ получу, если штурмом возьму датацентр
Добавлено через 1 минуту
а если я доступ получу, то не пых использовать буду для доступа к портам.. Но как обычно простые пути не для нас
А теперь попробуйте мне показать, как это можно сделать более, как вы говорите, “удобно”? – Отлично, покажите удобство =)
К слову, – этот код написан в крайне сжатые сроки и уже полгода в продакшне. За эти полгода – не было ни одного сбоя в работе картоприемника. Аптайм у терминала – 4 месяца, был ребут из-за отключения электричества.
gravataLonga / php_serial.class.php
define ( “SERIAL_DEVICE_NOTSET” , 0 ); |
define ( “SERIAL_DEVICE_SET” , 1 ); |
define ( “SERIAL_DEVICE_OPENED” , 2 ); |
/** |
* Serial port control class |
* |
* THIS PROGRAM COMES WITH ABSOLUTELY NO WARANTIES ! |
* USE IT AT YOUR OWN RISKS ! |
* |
* Changes added by Rizwan Kassim for OSX functionality |
* Further changes for OSX functionality added by Andrew Hutchings |
* default serial device for osx devices is /dev/tty.serial for machines with a built in serial device |
* |
* @author Rémy Sanchez |
* @thanks Aurélien Derouineau for finding how to open serial ports with windows |
* @thanks Alec Avedisyan for help and testing with reading |
* @copyright under GPL 2 licence |
*/ |
class phpSerial |
_os = “linux” ; |
if ( $ this -> _exec ( “stty –version” ) === 0 ) |
else |
> |
elseif ( substr ( $ sysname , 0 , 6 ) === “Darwin” ) |
_os = “osx” ; |
if ( $ this -> _exec ( “stty” ) === 0 ) |
else |
> |
elseif ( substr ( $ sysname , 0 , 7 ) === “Windows” ) |
_os = “windows” ; |
register_shutdown_function ( array ( $ this , “deviceClose” )); |
> |
else |
> |
// |
// OPEN/CLOSE DEVICE SECTION — |
// |
/** |
* Device set function : used to set the device name/address. |
* -> linux : use the device address, like /dev/ttyS0 |
* -> osx : use the device address, like /dev/tty.serial |
* -> windows : use the COMxx device name, like COM1 (can also be used |
* with linux) |
* |
* @param string $device the name of the device to be used |
* @return bool |
*/ |
function deviceSet ( $ device ) |
_dState !== SERIAL_DEVICE_OPENED ) |
_os === “linux” ) |
if ( $ this -> _exec ( “stty -F ” . $ device ) === 0 ) |
_device = $ device ; |
$ this -> _dState = SERIAL_DEVICE_SET ; |
return true ; |
> |
> |
elseif ( $ this -> _os === “osx” ) |
if ( $ this -> _exec ( “stty -f ” . $ device ) === 0 ) |
_device = $ device ; |
$ this -> _dState = SERIAL_DEVICE_SET ; |
return true ; |
> |
> |
elseif ( $ this -> _os === “windows” ) |
_exec ( exec ( “mode ” . $ device )) === 0 ) |
_windevice = “COM” . $ matches [ 1 ]; |
$ this -> _device = “\\.\com” . $ matches [ 1 ]; |
$ this -> _dState = SERIAL_DEVICE_SET ; |
return true ; |
> |
> |
trigger_error ( “Specified serial port is not valid” , E_USER_WARNING ); |
return false ; |
> |
else |
> |
/** |
* Opens the device for reading and/or writing. |
* |
* @param string $mode Opening mode : same parameter as fopen() |
* @return bool |
*/ |
function deviceOpen ( $ mode = “r+b” ) |
_dState === SERIAL_DEVICE_OPENED ) |
if ( $ this -> _dState === SERIAL_DEVICE_NOTSET ) |
if (! preg_match ( “@^[raw]\+?b?$@” , $ mode )) |
$ this -> _dHandle = @ fopen ( $ this -> _device , $ mode ); |
if ( $ this -> _dHandle !== false ) |
_dHandle , 0 ); |
$ this -> _dState = SERIAL_DEVICE_OPENED ; |
return true ; |
> |
$ this -> _dHandle = null ; |
trigger_error ( “Unable to open the device” , E_USER_WARNING ); |
return false ; |
> |
/** |
* Closes the device |
* |
* @return bool |
*/ |
function deviceClose () |
_dState !== SERIAL_DEVICE_OPENED ) |
if ( fclose ( $ this -> _dHandle )) |
_dHandle = null ; |
$ this -> _dState = SERIAL_DEVICE_SET ; |
return true ; |
> |
trigger_error ( “Unable to close the device” , E_USER_ERROR ); |
return false ; |
> |
// |
// OPEN/CLOSE DEVICE SECTION — |
// |
// |
// CONFIGURE SECTION — |
// |
/** |
* Configure the Baud Rate |
* Possible rates : 110, 150, 300, 600, 1200, 2400, 4800, 9600, 38400, |
* 57600 and 115200. |
* |
* @param int $rate the rate to set the port in |
* @return bool |
*/ |
function confBaudRate ( $ rate ) |
_dState !== SERIAL_DEVICE_SET ) |
$ validBauds = array ( |
110 => 11 , |
150 => 15 , |
300 => 30 , |
600 => 60 , |
1200 => 12 , |
2400 => 24 , |
4800 => 48 , |
9600 => 96 , |
19200 => 19 , |
38400 => 38400 , |
57600 => 57600 , |
115200 => 115200 |
); |
if ( isset ( $ validBauds [ $ rate ])) |
_os === “linux” ) |
_exec ( “stty -F ” . $ this -> _device . ” ” . ( int ) $ rate , $ out ); |
> |
if ( $ this -> _os === “osx” ) |
_exec ( “stty -f ” . $ this -> _device . ” ” . ( int ) $ rate , $ out ); |
> |
elseif ( $ this -> _os === “windows” ) |
_exec ( “mode ” . $ this -> _windevice . ” BAUD=” . $ validBauds [ $ rate ], $ out ); |
> |
else return false ; |
if ( $ ret !== 0 ) |
> |
> |
/** |
* Configure parity. |
* Modes : odd, even, none |
* |
* @param string $parity one of the modes |
* @return bool |
*/ |
function confParity ( $ parity ) |
_dState !== SERIAL_DEVICE_SET ) |
$ args = array ( |
“none” => “-parenb” , |
“odd” => “parenb parodd” , |
“even” => “parenb -parodd” , |
); |
if (! isset ( $ args [ $ parity ])) |
if ( $ this -> _os === “linux” ) |
_exec ( “stty -F ” . $ this -> _device . ” ” . $ args [ $ parity ], $ out ); |
> |
elseif ( $ this -> _os === “osx” ) |
_exec ( “stty -f ” . $ this -> _device . ” ” . $ args [ $ parity ], $ out ); |
> |
else |
_exec ( “mode ” . $ this -> _windevice . ” PARITY=” . $ parity , $ out ); |
> |
if ( $ ret === 0 ) |
trigger_error ( “Unable to set parity : ” . $ out [ 1 ], E_USER_WARNING ); |
return false ; |
> |
/** |
* Sets the length of a character. |
* |
* @param int $int length of a character (5 |
* @return bool |
*/ |
function confCharacterLength ( $ int ) |
_dState !== SERIAL_DEVICE_SET ) |
$ int = ( int ) $ int ; |
if ( $ int 5 ) $ int = 5 ; |
elseif ( $ int > 8 ) $ int = 8 ; |
if ( $ this -> _os === “linux” ) |
_exec ( “stty -F ” . $ this -> _device . ” cs” . $ int , $ out ); |
> |
elseif ( $ this -> _os === “osx” ) |
_exec ( “stty -f ” . $ this -> _device . ” cs” . $ int , $ out ); |
> |
else |
_exec ( “mode ” . $ this -> _windevice . ” DATA=” . $ int , $ out ); |
> |
if ( $ ret === 0 ) |
trigger_error ( “Unable to set character length : ” . $ out [ 1 ], E_USER_WARNING ); |
return false ; |
> |
/** |
* Sets the length of stop bits. |
* |
* @param float $length the length of a stop bit. It must be either 1, |
* 1.5 or 2. 1.5 is not supported under linux and on some computers. |
* @return bool |
*/ |
function confStopBits ( $ length ) |
_dState !== SERIAL_DEVICE_SET ) |
if ( $ length != 1 and $ length != 2 and $ length != 1.5 and !( $ length == 1.5 and $ this -> _os === “linux” )) |
if ( $ this -> _os === “linux” ) |
_exec ( “stty -F ” . $ this -> _device . ” ” . (( $ length == 1 ) ? “-” : “” ) . “cstopb” , $ out ); |
> else if ( $ this -> _os === “osx” ) |
_exec ( “stty -f ” . $ this -> _device . ” ” . (( $ length == 1 ) ? “-” : “” ) . “cstopb” , $ out ); |
> |
else |
_exec ( “mode ” . $ this -> _windevice . ” STOP=” . $ length , $ out ); |
> |
if ( $ ret === 0 ) |
trigger_error ( “Unable to set stop bit length : ” . $ out [ 1 ], E_USER_WARNING ); |
return false ; |
> |
/** |
* Configures the flow control |
* |
* @param string $mode Set the flow control mode. Availible modes : |
* -> “none” : no flow control |
* -> “rts/cts” : use RTS/CTS handshaking |
* -> “xon/xoff” : use XON/XOFF protocol |
* @return bool |
*/ |
function confFlowControl ( $ mode ) |
_dState !== SERIAL_DEVICE_SET ) |
$ linuxModes = array ( |
“none” => “clocal -crtscts -ixon -ixoff” , |
“rts/cts” => “-clocal crtscts -ixon -ixoff” , |
“xon/xoff” => “-clocal -crtscts ixon ixoff” |
); |
$ windowsModes = array ( |
“none” => “xon=off octs=off rts=on” , |
“rts/cts” => “xon=off octs=on rts=hs” , |
“xon/xoff” => “xon=on octs=off rts=on” , |
); |
if ( $ mode !== “none” and $ mode !== “rts/cts” and $ mode !== “xon/xoff” ) |
if ( $ this -> _os === “linux” ) |
$ ret = $ this -> _exec ( “stty -F ” . $ this -> _device . ” ” . $ linuxModes [ $ mode ], $ out ); |
elseif ( $ this -> _os === “osx” ) |
$ ret = $ this -> _exec ( “stty -f ” . $ this -> _device . ” ” . $ linuxModes [ $ mode ], $ out ); |
else |
$ ret = $ this -> _exec ( “mode ” . $ this -> _windevice . ” ” . $ windowsModes [ $ mode ], $ out ); |
if ( $ ret === 0 ) return true ; |
else |
> |
/** |
* Sets a setserial parameter (cf man setserial) |
* NO MORE USEFUL ! |
* -> No longer supported |
* -> Only use it if you need it |
* |
* @param string $param parameter name |
* @param string $arg parameter value |
* @return bool |
*/ |
function setSetserialFlag ( $ param , $ arg = “” ) |
_ckOpened ()) return false ; |
$ return = exec ( “setserial ” . $ this -> _device . ” ” . $ param . ” ” . $ arg . ” 2>&1″ ); |
if ( $ return === “I” ) |
elseif ( $ return === “/” ) |
else |
> |
// |
// CONFIGURE SECTION — |
// |
// |
// I/O SECTION — |
// |
/** |
* Sends a string to the device |
* |
* @param string $str string to be sent to the device |
* @param float $waitForReply time to wait for the reply (in seconds) |
*/ |
function sendMessage ( $ str , $ waitForReply = 0.1 ) |
_buffer .= $ str ; |
if ( $ this -> autoflush === true ) $ this -> serialflush (); |
usleep (( int ) ( $ waitForReply * 1000000 )); |
> |
/** |
* Reads the port until no new datas are availible, then return the content. |
* |
* @pararm int $count number of characters to be read (will stop before |
* if less characters are in the buffer) |
* @return string |
*/ |
function readPort ( $ count = 0 ) |
_dState !== SERIAL_DEVICE_OPENED ) |
if ( $ this -> _os === “linux” || $ this -> _os === “osx” ) |
$ count ) $ content .= fread ( $ this -> _dHandle , ( $ count – $ i )); |
else $ content .= fread ( $ this -> _dHandle , 128 ); |
> while (( $ i += 128 ) === strlen ( $ content )); |
> |
else |
_dHandle , 128 ); |
> while (( $ i += 128 ) === strlen ( $ content )); |
> |
return $ content ; |
> |
elseif ( $ this -> _os === “windows” ) |
trigger_error ( “Reading serial port is not implemented for Windows” , E_USER_WARNING ); |
return false ; |
> |
/** |
* Flushes the output buffer |
* Renamed from flush for osx compat. issues |
* |
* @return bool |
*/ |
function serialflush () |
_ckOpened ()) return false ; |
if ( fwrite ( $ this -> _dHandle , $ this -> _buffer ) !== false ) |
_buffer = “” ; |
return true ; |
> |
else |
_buffer = “” ; |
trigger_error ( “Error while sending message” , E_USER_WARNING ); |
return false ; |
> |
> |
// |
// I/O SECTION — |
// |
// |
// INTERNAL TOOLKIT — |
// |
function _ckOpened () |
_dState !== SERIAL_DEVICE_OPENED ) |
return true ; |
> |
function _ckClosed () |
_dState !== SERIAL_DEVICE_CLOSED ) |
return true ; |
> |
function _exec ( $ cmd , & $ out = null ) |
array ( “pipe” , “w” ), |
2 => array ( “pipe” , “w” ) |
); |
$ proc = proc_open ( $ cmd , $ desc , $ pipes ); |
$ ret = stream_get_contents ( $ pipes [ 1 ]); |
$ err = stream_get_contents ( $ pipes [ 2 ]); |
fclose ( $ pipes [ 1 ]); |
fclose ( $ pipes [ 2 ]); |
$ retVal = proc_close ( $ proc ); |
if ( func_num_args () == 2 ) $ out = array ( $ ret , $ err ); |
return $ retVal ; |
> |
// |
// INTERNAL TOOLKIT — |
// |
> |
?> |
This comment has been minimized.
Copy link Quote reply
const669 commented May 29, 2019
I think that in line 395 you need to insert “else”. Because if not osx, then always get on the line 401. And in Linux get “Unable to set character length : sh: 1: mode: not found”
This comment has been minimized.
Copy link Quote reply
mailworm commented Mar 9, 2020 •
Hey.. If in line 127 “stty -F /dev/ttyUSB0” doesn’t equals 0, but $retval is 1, what might be the issue? The serial device I want to control is 100% at ttyUSB0. The script worked before, when I was on RPi 3b+ with Rasbian Stretch. Now updated to Raspian Buster it doesn’t work anymore for beforementioned reason. Thank you. P.S.: PHP version is 7.3, unfortunately I don’t remember which version I ran on Stretch.
This comment has been minimized.
Copy link Quote reply
ElvisAns commented Oct 17, 2020
i m getting error with this lib
This comment has been minimized.
Copy link Quote reply
gravataLonga commented Oct 18, 2020
Hi everyone, first would like to said that this isn’t my library, wasn’t create by me. Secondly can update this gist first tell me more detail about your’s problems.
This comment has been minimized.
Copy link Quote reply
gravataLonga commented Oct 18, 2020
Hey.. If in line 127 “stty -F /dev/ttyUSB0” doesn’t equals 0, but $retval is 1, what might be the issue? The serial device I want to control is 100% at ttyUSB0. The script worked before, when I was on RPi 3b+ with Rasbian Stretch. Now updated to Raspian Buster it doesn’t work anymore for beforementioned reason. Thank you. P.S.: PHP version is 7.3, unfortunately I don’t remember which version I ran on Stretch.
Hi can give-me full example how to reproduce your problem?
I’ve update script to reflect your solution
This comment has been minimized.
Copy link Quote reply
mailworm commented Oct 20, 2020
Hey.. If in line 127 “stty -F /dev/ttyUSB0” doesn’t equals 0, but $retval is 1, what might be the issue? The serial device I want to control is 100% at ttyUSB0. The script worked before, when I was on RPi 3b+ with Rasbian Stretch. Now updated to Raspian Buster it doesn’t work anymore for beforementioned reason. Thank you. P.S.: PHP version is 7.3, unfortunately I don’t remember which version I ran on Stretch.
I figured it out. It wasn’t a problem with this script. I solely forgot, that I had installed and ran hamlib-3.3. Once figured out, all problems were gone. Hamlib-3.3 is a library that allows one to control amateur radio transceivers.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.