mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-25 02:52:07 +00:00
Add carrier detect to autocons sample
For genesis, not necessarily relevant, but may be very relevant for OS behaviors in other contexts.
This commit is contained in:
parent
163b29a07c
commit
f1e83d938b
@ -1,3 +1,4 @@
|
||||
import fcntl
|
||||
import os
|
||||
import struct
|
||||
import termios
|
||||
@ -46,6 +47,8 @@ def do_serial_config():
|
||||
currattr = termios.tcgetattr(ttyf)
|
||||
currattr[4:6] = [0, termiobaud[retval['speed']]]
|
||||
termios.tcsetattr(ttyf, termios.TCSANOW, currattr)
|
||||
retval['connected'] = bool(struct.unpack('<I', fcntl.ioctl(
|
||||
ttyf, termios.TIOCMGET, '\x00\x00\x00\x00'))[0] & termios.TIOCM_CAR)
|
||||
return retval
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user