Skip to content

Add TIOCM_OUT1, TIOCM_OUT2, and TIOCM_LOOP constants to termios #127335

@rruuaanng

Description

@rruuaanng

Feature or enhancement

Proposal:

This issue suggests adding new termios constants.

TIOCM_LOOP
TIOCM_OUT1
TIOCM_OUT2

example:

import array
import fcntl
import termios

f = open('/dev/ttyS0', 'r')
buf = array.array('h', [0])

# return a mask
fcntl.ioctl(f, termios.TIOCMGET, buf)

# some mask operation
# check if the target device has this flag activated
if buf[0] & TIOCM_OUT1: ...
if /* more compare */: ...

It's suitable for the physical characteristics of the terminal equipment, such as interrupt and chip select output

for example, a library like this uses.

https://github.com/makerbot/pyserial

ref:
https://github.com/torvalds/linux/blob/master/include/uapi/asm-generic/termios.h

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions