Add `TIOCM_OUT1`, `TIOCM_OUT2`, and `TIOCM_LOOP` constants to `termios`
未關閉
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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 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