Add `TIOCM_OUT1`, `TIOCM_OUT2`, and `TIOCM_LOOP` constants to `termios`
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách đọc ví dụ termios của issue và tệp header termios Linux được tham chiếu, sau đó kiểm tra PR được liên kết gh-127336 để xem phần công việc đã được triển khai. Công việc được xem là hoàn tất khi ba hằng số có thể được sử dụng thông qua giao diện termios của Python cho các phép kiểm tra mask ioctl được mô tả.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- linux, python
- Lĩnh vực
- operating-systems
- Loại issue
- Tính năng
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100