在驱动中如何设置串口的波特率?
环境:linux os
问题:因为项目需要,要在驱动中设置串口的波特率。
目前的进展是:
在驱动程序中,已经通过接口获取了文件指针,即
struct file *filep = filp_open("/dev/ttyS0",O_RDWR,0);
并且在tty驱动中,可知filp->private_data = (struct tty_struct*)tty;
那么就可通过如下进行波特率设置了:
tty->termios->c_ispeed = ;
tty->termios->c_ospeed = ;
但试了后,发现不可以...