Vietnamese (machine translation)

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:

ioctls CEC_G_MODE and CEC_S_MODE

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à:

Initiator Modes

CEC_MODE_NO_INITIATOR

0x0

This is not an initiator, i.e. it cannot transmit CEC messages or make any other changes to the CEC adapter.

CEC_MODE_INITIATOR

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.

CEC_MODE_EXCL_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 EBUSY error code error.

Các chế độ theo dõi có sẵn là:

Follower Modes

CEC_MODE_NO_FOLLOWER

0x00

This is not a follower (the default when the device is opened).

CEC_MODE_FOLLOWER

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 EINVAL error code is returned in that case.

CEC_MODE_EXCL_FOLLOWER

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 EBUSY error code. You cannot become a follower if CEC_CAP_TRANSMIT is not set or if CEC_MODE_NO_INITIATOR was specified, the EINVAL error code is returned in that case.

CEC_MODE_EXCL_FOLLOWER_PASSTHRU

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 EBUSY error code. You cannot become a follower if CEC_CAP_TRANSMIT is not set or if CEC_MODE_NO_INITIATOR was specified, the EINVAL error code is returned in that case.

CEC_MODE_MONITOR_PIN

0xd0

Put the file descriptor into pin monitoring mode. Can only be used in combination with CEC_MODE_NO_INITIATOR, otherwise the EINVAL error code will be returned. This mode requires that the CEC_CAP_MONITOR_PIN capability is set, otherwise the EINVAL error code is returned. While in pin monitoring mode this file descriptor can receive the CEC_EVENT_PIN_CEC_LOW and CEC_EVENT_PIN_CEC_HIGH events to see the low-level CEC pin transitions. This is very useful for debugging. This mode is only allowed if the process has the CAP_NET_ADMIN capability. If that is not set, then the EPERM error code is returned.

CEC_MODE_MONITOR

0xe0

Put the file descriptor into monitor mode. Can only be used in combination with CEC_MODE_NO_INITIATOR, otherwise the EINVAL error code will be returned. In monitor mode all messages this CEC device transmits and all messages it receives (both broadcast messages and directed messages for one its logical addresses) will be reported. This is very useful for debugging. This is only allowed if the process has the CAP_NET_ADMIN capability. If that is not set, then the EPERM error code is returned.

CEC_MODE_MONITOR_ALL

0xf0

Put the file descriptor into ‘monitor all’ mode. Can only be used in combination with CEC_MODE_NO_INITIATOR, otherwise the EINVAL error code will be returned. In ‘monitor all’ mode all messages this CEC device transmits and all messages it receives, including directed messages for other CEC devices, will be reported. This is very useful for debugging, but not all devices support this. This mode requires that the CEC_CAP_MONITOR_ALL capability is set, otherwise the EINVAL error code is returned. This is only allowed if the process has the CAP_NET_ADMIN capability. If that is not set, then the EPERM error code is returned.

Chi tiết xử lý thông điệp cốt lõi:

Core Message Processing

CEC_MSG_GET_CEC_VERSION

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.

CEC_MSG_GIVE_DEVICE_VENDOR_ID

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.

CEC_MSG_ABORT

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.

CEC_MSG_GIVE_PHYSICAL_ADDR

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.

CEC_MSG_GIVE_OSD_NAME

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.

CEC_MSG_GIVE_FEATURES

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.

CEC_MSG_USER_CONTROL_PRESSED

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).

CEC_MSG_USER_CONTROL_RELEASED

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).

CEC_MSG_REPORT_PHYSICAL_ADDR

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.