I've encountered strange problem - I have to change serial port baud rate (from initial 300 baud to something higher) in runtime of PHP code and every time I try, next readed bytes are simply ZEROs.
I've already tried multiple ways of serial connection in PHP:
- fopen/fread/fwrite of standard file (in that case "/dev/ttyUSB0"), configured with exec and stty commands
- dio_open/dio_read/dio_write, configured with dio_tcsetattr
- fopen/fread/fwrite of dio stream (dio.serial type)
I'm pretty sure that there's something wrong in PHP itself, because similar code in Perl works correctly and baud rate doesn't affect reading at all. I've checked strace log of PHP and Perl scripts and they look almost identical in case of serial port configuration, so problem lies somewhere else.