1 The RS485 mode ioctls need a serial driver that implements them, which a 2 pseudo terminal does not, so both calls report an error there and leave it 3 in serial.error(). A non terminal descriptor fails the same way. An 4 argument that is neither an object nor a boolean is rejected before any 5 ioctl happens. 6 7 -- Testcase -- 8 import * as serial from 'serial'; 9 import { open } from 'fs'; 10 11 // old valgrind versions reject the probed ioctl, skip there 12 if (index(getenv('LD_PRELOAD') ?? '', 'vgpreload') >= 0) 13 exit(77); 14 15 let f = open('/dev/ptmx', 'r+'); 16 print(serial.getrs485(f) == null, "\n"); 17 print(serial.error() != null, "\n"); 18 19 print(serial.setrs485(f, { enabled: true, rts_on_send: true }) == null, "\n"); 20 print(serial.error() != null, "\n"); 21 22 print(serial.setrs485(f, true) == null, "\n"); 23 print(serial.error() != null, "\n"); 24 25 print(serial.setrs485(f, "yes") == null, "\n"); 26 print(serial.error(), "\n"); 27 28 let g = open('/dev/null', 'r'); 29 print(serial.getrs485(g) == null, "\n"); 30 print(serial.error() != null, "\n"); 31 -- End -- 32 33 -- Args -- 34 -R 35 -- End -- 36 37 -- Expect stdout -- 38 true 39 true 40 true 41 true 42 true 43 true 44 true 45 Invalid argument 46 true 47 true 48 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt