[REBOL] Serial-Ports Linux / Psion Link Protocol
From: fsievert::uos::de at: 13-Nov-2003 8:57
Hi!
If you want to use the serial ports with linux, the following function
could help. Rebol does not set all serial-parameters correctly. Use the
set-serial-port function to the port after it is opened to fix it. You
have to use latest BETA-Version of REBOL because it needs the
set-browser-path feature.
If you want to use browse within your program, you will have to
set-browser-path again after using this function.
USAGE:
port: open/direct/binary [scheme: 'serial rts-cts: no speed: 115600]
set-serial-port port
Maybe you will want to use this, too:
if find [3 4] system/version/4 [
system/ports/serial: [ttyS0 ttyS1]
]
Is someone interested in my psion-protocol (read psion://port1/c/..) or
psion-backup.r to transfer files from/to Psion-S5 devices?
CU
Frank
set-serial-port: func [port /local] [
if system/version = 1.2.10.4.2 [
set-browser-path "bash"
browse rejoin [
{-c "stty --file /dev/}
pick system/ports/serial to-integer skip
form port/device 4
{ }
either port/rts-cts [""] ["-"]
{crtscts }
{cs} any [port/data-bits 8] { }
either 2 = port/stop-bits [""] ["-"] {cstopb }
switch/default port/parity [
none ["-parenb"]
odd ["parenb parodd"]
even ["parenb -parodd"]
] [
"-parenb"
]
{ }
{ -ixon -ixoff ispeed } port/speed { ospeed }
port/speed {"}
]
]
]