chickadee » stty » stty

(stty [port] settings ...)procedure

Sets the terminal attributes for PORT (defaulting to current-input-port) according to the SETTINGS, which should be a list of symbols corresponding to modes in the stty(1) man page, or one or more symbols wrapped in a (not ...) list.

To enable a character setting, use a list of the setting name followed by the character (or #f to disable), as in

     (stty '(erase #\delete))

To set a baudrate, set the ispeed and ospeed settings in the same way, as in

     (define (set-baudrate! port baudrate)
       (stty port `((ispeed ,baudrate) (ospeed ,baudrate))))

     (let ((S0 (file-open "/dev/ttyS0" (+ open/rdwr open/excl))))
       ;;set baudrate to 9600
       (set-baudrate! S0 9600)
       ;;send some stuff
       (write "HELLO AT 9600" S0)
       (flush-output S0)
       ;;set baudrate to 38400
       (set-baudrate! S0 38400)
       ;;send some stuff
       (write "HELLO AT 38400" S0)
       (flush-output S0))

The following settings are supported:

    clocal cread crtscts cs5 cs6 cs7 cs8 cstopb hup hupcl parenb
    parodd brkint icrnl ignbrk igncr ignpar imaxbel inpck ispeed
    istrip ixany ixoff ixon parmrk tandem ocrnl onlcr onlret onocr
    opost ospeed tab0 tab1 tab2 tab3 tabs crterase crtkill ctlecho
    echo echoctl echoe echoke echonl echoprt icanon iexten isig
    noflsh prterase tostop xcase eof eol eol2 erase intr kill lnext
    quit rprnt start stop susp werase raw sane