pyserial with 250000 bit/s
i want to use the usb connected to a usb2serial adapter with 250000 bits/s. But the pyserial packet allows only 115000. Can anyone give me a hint to upgrade the packet? There are a few informations about this problem using a rpi (http://www.alexenglish.info/2014/04/patching-pyserial-fix-baud-rate-limitations) but as far as I understand this only happens in older versions of pyserial. Since 2.7 it should be solved. I use 3.4.
So mybe it's not a problem with pyserial but with a kernel modul?
Thanks for help
Short update to my question. As far as I understand the problem isn't the pyserial library. It seems like the problem is how linux works with serial devices. Often the tty port itselfs don't allow more than 115kbits. So normally you can modify the port to support higher speeds. Some informations are here: https://discuss.96boards.org/t/linaro-ttymsm1-uart0-dmx-250000-baudrate/887
So I have to execute the following commands:
apt-get install setserial
setserial -a /dev/ttyUSB0 spd_cust
setserial -a /dev/ttyUSB0 divisor 96
stty cs8 -parenb cstopb -F /dev/ttyUSB0 38400
setserial -a /dev/ttyUSB0
But unfortunately setserial and stty are not availible in the repros. But I found them in some newer repros at openwrt. Next problem I have is, that setserial is not working. I get the following error:
root@Omega-11E7:~# setserial -a /dev/ttyUSB0 spd_cust
Cannot get serial info: Not a tty
Some additional infos I have found: https://www.downtowndougbrown.com/2013/11/linux-custom-serial-baud-rates/
But I don't understand how I can use this formations. I am not a C developer.
Hopefully someone can help me with this new informations.
Thanks a lot.
I'm having this problem as well.
As far as I can tell I should have 250k baud rate support.
I ran into the same problem and found the root cause: pySerial v3.2 (and PySerial's master branch up till 2020-4) uses hard coded IOCTL values and these are wrong for the MIPS processor as used in the Onion. It is just impossible to set any custom baud rate different from the default Linux provided baud rates without getting the "not a tty" error.
The changes required to fix this are small. Use the correct IOCTL hard coded values and change the offset values for the baudrate settings to the correct position in the underlying C-struct.
I submitted my fix to have this incorporated into pySerial: https://github.com/pyserial/pyserial/pull/496