• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/05_lib_serial/01_termios

  1 The serial module configures tty/serial devices through file handles
  2 created by the fs module. Termios line settings, the VMIN/VTIME read
  3 controls and raw mode operate on a pseudo terminal here, while the modem
  4 control ioctls report an error on a non terminal device.
  5 
  6 -- Testcase --
  7 import * as serial from 'serial';
  8 import { open } from 'fs';
  9 
 10 let f = open('/dev/ptmx', 'r+');
 11 print(serial.isatty(f), "\n");
 12 
 13 let a = serial.attr(f);
 14 print(type(a.cflag) == 'int', "\n");
 15 print(length(a.cc) > 0, "\n");
 16 
 17 serial.setblocking(f, 5, 0);
 18 print(serial.attr(f).cc[serial.VMIN], "\n");
 19 
 20 serial.setraw(f);
 21 print((serial.attr(f).lflag & serial.ICANON) == 0, "\n");
 22 
 23 print((serial.CS8 & serial.CSIZE) == serial.CS8, "\n");
 24 print(serial.B9600 > 0, "\n");
 25 
 26 let g = open('/dev/null', 'r');
 27 print(serial.mget(g) == null, "\n");
 28 print(serial.error() != null, "\n");
 29 -- End --
 30 
 31 -- Args --
 32 -R
 33 -- End --
 34 
 35 -- Expect stdout --
 36 true
 37 true
 38 true
 39 5
 40 true
 41 true
 42 true
 43 true
 44 true
 45 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt