bind -a '#t' dir dir/eia0 dir/eia0ctl dir/eia1 dir/eia1ctl dir/eia2 dir/eia2ctl dir/eia3 dir/eia3ctl
The data file can be read and written to use that port. Reads will block until at least one character is available.
The ctl file can be used to push stream modules onto the port . One can also write one of the following commands to a ctl file:
init(ctxt: ref Draw->Context, argv: list of string)
{
sys = load Sys Sys->PATH;
if (len argv != 2) {
sys->print("Usage: %s {serial_device_path}\n",hd
argv);
return;
}
path := hd tl argv;
data := sys->open(path, Sys->ORDWR);
if (data == nil) {
sys->print("unable to open %s: %r\n",path);
return;
}
ctl := sys->open(path+"ctl",Sys->ORDWR);
if (ctl == nil) {
sys->print("unable to open %s: %r\n",path+"ctl");
return;
}
# set the speed to 9600 bps
bps := array of byte "b 9600";
if(sys->write(ctl,bps,len bps) == -1) {
sys->print("change speed failed: %r\n");
return;
}
# read and write to the data fd reads and writes to the
# serial port
}
eia0 eia0ctl eia1 eia1ctl eia2 eia2ctl eia3 eia3ctl