python / python/cpython

Add `TIOCM_OUT1`, `TIOCM_OUT2`, and `TIOCM_LOOP` constants to `termios`

未關閉
#127,335 3 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

@rruuaanng 已經在處理了。

開始於 2024年11月27日。

  • #127336 來自 @rruuaanng —— 未關閉
extension-modules type-feature
主要語言
Python
星號
77.2k
分支
36k
PR 合併指標
PR 指標待擷取

描述

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
  • gh-127336

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先閱讀 issue 中的 termios 範例和所參照的 Linux termios 標頭檔,接著檢查連結的 PR gh-127336,以了解已在進行的工作。當這三個常數可透過 Python 的 termios 介面用於所述的 ioctl 遮罩檢查時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
linux, python
領域
operating-systems
Issue 類型
功能
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。