0

Code:

 #!/usr/bin/env bash
    
BASEBPS=24000000
    
[ "$2" = "" ]  &&  { echo 'use args <dev> <bps>'; exit; }
dev=$1
bps=$2
    
setserial  $dev  divisor  $[ $BASEBPS / $bps ]  spd_cust
stty -F $dev 38400  2> /dev/null

Execution:

~$ sudo ./setbaud.sh /dev/ttyUSB0 256000
 Cannot get serial info: Innapropriate ioctl for device 

Someone know if there is a way to solve this?

  • A you sure target device supports custom speed? `setserial` is for 8250-compatible controllers but /dev/ttyUSB0 may be (and likely is) based on different type of serial controller. – dimich Jul 25 '22 at 20:54
  • Start by double-quoting `"$dev"` every where it occurs and avoid the deprecated `$[ .. ]` in favor of `$((BASEBPS / bps))` – David C. Rankin Jul 26 '22 at 01:23

0 Answers0