Lưu ý
Mục đích của file này là để độc giả tiếng Việt có thể đọc và hiểu tài liệu nhân kernel dễ dàng hơn, không phải để tạo ra một nhánh tài liệu riêng. Nếu bạn có bất kỳ nhận xét hoặc cập nhật nào cho file này, vui lòng thử cập nhật file tiếng Anh gốc trước. Nếu bạn thấy có sự khác biệt giữa bản dịch và bản gốc, hoặc có vấn đề về bản dịch, vui lòng gửi góp ý hoặc patch cho người dịch của file này, hoặc nhờ người bảo trì và người review tài liệu tiếng Việt giúp đỡ.
- Bản gốc:
- Người dịch:
Google Translate (machine translation)
- Phiên bản gốc:
8541d8f725c6
Cảnh báo
Tài liệu này được dịch tự động bằng máy và chưa được review bởi người dịch. Nội dung có thể không chính xác hoặc khó hiểu ở một số chỗ. Khi có sự khác biệt với bản gốc, bản gốc luôn là chuẩn. Bản dịch chất lượng cao (được review) được đặt trong thư mục vi_VN/.
2.10. ioctls CEC_G_MODE và CEC_S_MODE¶
CEC_G_MODE, CEC_S_MODE - Nhận hoặc đặt quyền sử dụng độc quyền bộ chuyển đổi CEC
2.10.1. Tóm tắt¶
-
CEC_G_MODE¶
ZZ0000ZZ
-
CEC_S_MODE¶
ZZ0000ZZ
2.10.2. Đối số¶
- ZZ0001ZZ
Bộ mô tả tệp được trả về bởi ZZ0000ZZ.
- ZZ0000ZZ
Con trỏ tới chế độ CEC.
2.10.3. Sự miêu tả¶
Theo mặc định, bất kỳ tước hiệu tệp nào cũng có thể sử dụng ZZ0000ZZ, nhưng để ngăn chặn các ứng dụng khỏi việc dẫm lên ngón chân của nhau thì phải có thể có quyền truy cập độc quyền vào bộ chuyển đổi CEC. Ioctl này thiết lập filehandle sang chế độ khởi tạo và/hoặc chế độ theo dõi có thể độc quyền tùy theo chế độ đã chọn. Bộ khởi tạo là filehandle được sử dụng để bắt đầu tin nhắn, tức là nó ra lệnh cho các thiết bị CEC khác. các người theo dõi là filehandle nhận tin nhắn được gửi đến CEC adapter và xử lý chúng. Cùng một tước hiệu tệp có thể vừa là người khởi tạo và người theo dõi, hoặc vai trò này có thể được đảm nhận bởi hai tước hiệu tệp khác nhau.
Khi nhận được tin nhắn CEC, khung CEC sẽ quyết định cách thức nó sẽ được xử lý. Nếu tin nhắn là câu trả lời trước đó tin nhắn được truyền đi, sau đó phản hồi sẽ được gửi trở lại filehandle đang chờ đợi nó. Ngoài ra, khung CEC sẽ xử lý nó.
Nếu tin nhắn không phải là phản hồi thì khung CEC sẽ xử lý nó đầu tiên. Nếu không có người theo dõi thì tin nhắn sẽ bị loại bỏ và việc hủy bỏ tính năng sẽ được gửi lại cho người khởi tạo nếu khung không thể xử lý nó. Nếu có người theo dõi thì tin nhắn sẽ được chuyển đến người theo dõi sẽ sử dụng ZZ0000ZZ để dequeue tin nhắn mới. Khuôn khổ kỳ vọng người theo sau sẽ làm đúng các quyết định.
Khung CEC sẽ xử lý các tin nhắn cốt lõi trừ khi có yêu cầu khác bởi người theo dõi. Người theo dõi có thể kích hoạt chế độ chuyển tiếp. Trong đó trường hợp, khung CEC sẽ truyền hầu hết các thông điệp cốt lõi mà không cần xử lý chúng và người theo dõi sẽ phải thực hiện những thông báo đó. Có một số thông báo mà lõi sẽ luôn xử lý, bất kể chế độ xuyên suốt. Xem ZZ0000ZZ để biết chi tiết.
Nếu không có trình khởi tạo thì bất kỳ tước hiệu tệp CEC nào cũng có thể sử dụng ZZ0000ZZ. Nếu có độc quyền người khởi xướng thì chỉ người khởi xướng đó mới có thể gọi ZZ0001ZZ. Tất nhiên người theo dõi có thể luôn gọi ZZ0002ZZ.
Các chế độ khởi tạo có sẵn là:
|
0x0 |
This is not an initiator, i.e. it cannot transmit CEC messages or make any other changes to the CEC adapter. |
|
0x1 |
This is an initiator (the default when the device is opened) and it can transmit CEC messages and make changes to the CEC adapter, unless there is an exclusive initiator. |
|
0x2 |
This is an exclusive initiator and this file descriptor is the
only one that can transmit CEC messages and make changes to the
CEC adapter. If someone else is already the exclusive initiator
then an attempt to become one will return the |
Các chế độ theo dõi có sẵn là:
|
0x00 |
This is not a follower (the default when the device is opened). |
|
0x10 |
This is a follower and it will receive CEC messages unless there
is an exclusive follower. You cannot become a follower if
CEC_CAP_TRANSMIT is not set or if CEC_MODE_NO_INITIATOR
was specified, the |
|
0x20 |
This is an exclusive follower and only this file descriptor will
receive CEC messages for processing. If someone else is already
the exclusive follower then an attempt to become one will return
the |
|
0x30 |
This is an exclusive follower and only this file descriptor will
receive CEC messages for processing. In addition it will put the
CEC device into passthrough mode, allowing the exclusive follower
to handle most core messages instead of relying on the CEC
framework for that. If someone else is already the exclusive
follower then an attempt to become one will return the |
|
0xd0 |
Put the file descriptor into pin monitoring mode. Can only be used in
combination with CEC_MODE_NO_INITIATOR,
otherwise the |
|
0xe0 |
Put the file descriptor into monitor mode. Can only be used in
combination with CEC_MODE_NO_INITIATOR,
otherwise the |
|
0xf0 |
Put the file descriptor into ‘monitor all’ mode. Can only be used
in combination with CEC_MODE_NO_INITIATOR, otherwise
the |
Chi tiết xử lý thông điệp cốt lõi:
|
The core will return the CEC version that was set with ioctl CEC_ADAP_S_LOG_ADDRS, except when in passthrough mode. In passthrough mode the core does nothing and this message has to be handled by a follower instead. |
|
The core will return the vendor ID that was set with ioctl CEC_ADAP_S_LOG_ADDRS, except when in passthrough mode. In passthrough mode the core does nothing and this message has to be handled by a follower instead. |
|
The core will return a Feature Abort message with reason ‘Feature Refused’ as per the specification, except when in passthrough mode. In passthrough mode the core does nothing and this message has to be handled by a follower instead. |
|
The core will report the current physical address, except when in passthrough mode. In passthrough mode the core does nothing and this message has to be handled by a follower instead. |
|
The core will report the current OSD name that was set with ioctl CEC_ADAP_S_LOG_ADDRS, except when in passthrough mode. In passthrough mode the core does nothing and this message has to be handled by a follower instead. |
|
The core will do nothing if the CEC version is older than 2.0, otherwise it will report the current features that were set with ioctl CEC_ADAP_S_LOG_ADDRS, except when in passthrough mode. In passthrough mode the core does nothing (for any CEC version) and this message has to be handled by a follower instead. |
|
If CEC_CAP_RC is set and if CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU is set, then generate a remote control key press. This message is always passed on to the follower(s). |
|
If CEC_CAP_RC is set and if CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU is set, then generate a remote control key release. This message is always passed on to the follower(s). |
|
The CEC framework will make note of the reported physical address and then just pass the message on to the follower(s). |
2.10.4. Giá trị trả về¶
Khi thành công, trả về 0, lỗi -1 và biến ZZ0001ZZ được đặt một cách thích hợp. Các mã lỗi chung được mô tả tại Chương ZZ0000ZZ.
ZZ0000ZZ có thể trả về như sau mã lỗi:
- EINVAL
Chế độ được yêu cầu không hợp lệ.
- EPERM
Chế độ giám sát được yêu cầu nhưng quy trình có ZZ0000ZZ khả năng.
- EBUSY
Người khác đã là người theo dõi hoặc người khởi xướng độc quyền.