picocom Settings mismatch

Question

picocom -b 1500000 /dev/ttyUSB0 -g $HOME/logs/picocom-$(date "+%F-%H%M").log
picocom v3.1

port is        : /dev/ttyUSB0
flowcontrol    : none
baudrate is    : 1500000
parity is      : none
databits are   : 8
stopbits are   : 1
escape is      : C-a
local echo is  : no
noinit is      : no
noreset is     : no
hangup is      : no
nolock is      : no
send_cmd is    : sz -vv
receive_cmd is : rz -vv -E
imap is        :
omap is        :
emap is        : crcrlf,delbs,
logfile is     : /home/baifudong/logs/picocom-2023-12-27-1012.log
initstring     : none
exit_after is  : not set
exit is        : no

!! Settings mismatch !! Type [C-a] [C-v] to see actual port settings
Type [C-a] [C-h] to see available commands
Terminal ready
*** baud: 1500000 (1000000)
*** flow: none
*** parity: none
*** databits: 8
*** stopbits: 1
*** dtr: up
*** rts: up
*** mctl: DTR:1 DSR:0 DCD:0 RTS:1 CTS:0 RI:0

Answer

stty -F /dev/ttyUSB0 raw -echo 115200
echo $?
0

stty -F /dev/ttyUSB0 raw -echo 1500000
stty: /dev/ttyUSB0: unable to perform all requested operations

handy scripts:

for bauds in $(
    sed -r 's/^#define\s+B([1-9][0-9]+)\s+.*/\1/p;d' \
        /usr/include/asm-generic/termbits*.h ) ;do
    echo $bauds
    stty -F /dev/ttyUSB0 $bauds && echo Ok.
done  2>&1 |
    pr -at2

better one:

#!/bin/bash
shopt -s globstar extglob
devs=(/sys/devices/!(virtual)/**/device/tty/tty?*)
ans=yes hfile=(/usr/include/asm-generic/termbits*.h)
bauds=()
for file in "${hfile[@]}"; do
    while read -r lhs rhs _ ; do
         case $lhs$rhs in
             \#defineB[0-9]* ) bauds+=(${rhs#B}) ;;
         esac
    done < "$file"
done
declare -A devdone='()'
for tty in "${devs[@]##*/}";do
    if [[ ! -v devdone["$tty"] ]] &&
            read _ oldrate _ < <(stty -F /dev/$tty 2>/dev/null); then
        echo "[ $tty ]"
        for i in ${!bauds[@]}; do
            rate=${bauds[i]}   nc=' '
            (( i == ${#bauds[@]}-1 || ( (1+i) % 6 ) == 0 )) && nc=$'\n'
            stty -F /dev/$tty $rate &> /dev/null
            printf '%8d %-3s%s' $rate ${ans[$?]:-no} "$nc"
        done
        stty -F /dev/$tty $oldrate &>/dev/null
        devdone["$tty"]=yes
    fi
done

https://superuser.com/a/1482079

0%