Skip to content

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

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

Activity

  1. changed the title [-]Add latest termios constants[/-] [+]Add `TIOCM_OUT1`, `TIOCM_OUT2`, and `TIOCM_LOOP` constants to `termios`[/+] on Nov 29, 2024
  2. erlend-aasland commented on Nov 29, 2024

    @erlend-aasland
    Contributor

    This issue suggests adding new termios constants.

    Which constants? What do they do? Why are you proposing to add these flags? Always explain proposed changes in detail.

  3. erlend-aasland commented on Jan 4, 2025

    @erlend-aasland
    Contributor

    This issue suggests adding new termios constants.

    Which constants? What do they do? Why are you proposing to add these flags? Always explain proposed changes in detail.

    You did not follow up this remark. Moreover, the example code in the OP is C code. Can you provide Python examples of how these are intended to be used?

  4. rruuaanng commented on Jan 5, 2025

    @rruuaanng
    ContributorAuthor

    This issue suggests adding new termios constants.

    Which constants? What do they do? Why are you proposing to add these flags? Always explain proposed changes in detail.

    You did not follow up this remark. Moreover, the example code in the OP is C code. Can you provide Python examples of how these are intended to be used?

    I mistakenly thought I had modified it, but I hadn't :(. But now, I have changed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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