[gambit-list] Is there a way to adjust serial port settings?
Marc Feeley
feeley at iro.umontreal.ca
Mon Jul 30 23:26:04 EDT 2007
The settings for serial ports (aka "ttys" in the Unix world) can be
changed with the procedure tty-mode-set!. Here is an example on
MacOS X using a bluetooth modem:
(let ((modem (open-file "/dev/tty.Bluetooth-Modem")))
(tty-mode-set! modem #f #f #t #t 38400)
(display "at\r" modem)
(force-output modem)
(pp (read-line modem)) ;; prints: "at\r\r"
(pp (read-line modem))) ;; prints: "OK\r"
Only some settings can be changed with tty-mode-set!. The parameters
are:
(tty-mode-set! <input-allow-special> <input-echo> <input-raw>
<output-raw> <speed>)
<input-allow-special>: boolean, #f = disable ctr-c handling, etc
<input-echo>: boolean, #f = characters received are not echoed
<input-raw>: boolean, #t = pass each character read unchanged ("RAW"
mode)
<output-raw>: boolean, #t = pass each character to the output
unchanged ("RAW" mode)
<speed>: integer = baud rate
Marc
More information about the Gambit-list
mailing list