In expect
script, I'm trying to replace the spawn kermit
with a direct access to the serial port/console under Ubuntu 14.04.
The code is fairly simple:
set device "/dev/ttyUSB1"
set device_handle [open $device w+]
fconfigure $device_handle -mode "921600,n,8,1" -handshake none
#spawn -open $device_handle
My problem is that the Tcl (8.6) or Expect (5.45) refuse to set the baud rate to 921600.
From the strace
output, I can see that the baud rate is set to 460800 instead (in TCSETSW
command to ioctl()
). Like this:
$ grep TCSETSW strace.out.*
strace.out.28667:ioctl(6, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B460800 -opost -isig -icanon -echo ...}) = 0
strace.out.28667:ioctl(6, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B460800 -opost -isig -icanon -echo ...}) = 0
strace.out.28667:ioctl(6, SNDCTL_TMR_STOP or SNDRV_TIMER_IOCTL_GINFO or TCSETSW, {B460800 -opost -isig -icanon -echo ...}) = 0
I have tested with lower baud rates - 9600, 115200, 460800 - and Tcl calls the ioctl()
with the correct baud rates. Only if I try to set the 921600, Tcl sets the 460800 instead. (The kermit
uses the same ioctl()
call and sets the correct baudrate.)
Any ideas?