Specifying non-standard baud rate for FTDI virtual serial port under Linux

后端 未结 2 476
死守一世寂寞
死守一世寂寞 2020-12-18 11:18

I have a USB device I\'m trying to communicate with over a virtual serial port provided by the ftdi_sio kernel module. However, I\'m having some trouble setting the baud rat

2条回答
  •  情话喂你
    2020-12-18 11:43

    You can't change baud base, I suppose it is hardware related. So messing with the module won't do you any good. In your third point you only talk about the first method proposed for setting a custom baudrate, where you need to access the tty->alt_speed. It seems there is no interface to directly set tty struct from userspace, at least not with the ftdi_sio driver.
    However, there is another method explained in the comments :

         * 3. You can also set baud rate by setting custom divisor as follows
         *    - set tty->termios->c_cflag speed to B38400
         *    - call TIOCSSERIAL ioctl with (struct serial_struct) set as
         *      follows:
         *      o flags & ASYNC_SPD_MASK == ASYNC_SPD_CUST
         *      o custom_divisor set to baud_base / your_new_baudrate
    

    Did you try it ?

提交回复
热议问题