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 VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL and VIDIOC_QUERYMENU
- 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/.
7.49. ioctls VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL và VIDIOC_QUERYMENU¶
7.49.1. Tên¶
VIDIOC_QUERYCTRL - VIDIOC_QUERY_EXT_CTRL - VIDIOC_QUERYMENU - Liệt kê các điều khiển và các mục điều khiển menu
7.49.2. Tóm tắt¶
-
VIDIOC_QUERY_CTRL¶
ZZ0000ZZ
-
VIDIOC_QUERY_EXT_CTRL¶
ZZ0000ZZ
-
VIDIOC_QUERYMENU¶
ZZ0000ZZ
7.49.3. Đối số¶
- ZZ0001ZZ
Bộ mô tả tệp được trả về bởi ZZ0000ZZ.
- ZZ0003ZZ
Con trỏ tới cấu trúc ZZ0000ZZ, ZZ0001ZZ hoặc ZZ0002ZZ (tùy thuộc vào ioctl).
7.49.4. Sự miêu tả¶
Để truy vấn các thuộc tính của ứng dụng điều khiển, hãy đặt trường ZZ0001ZZ của cấu trúc ZZ0000ZZ và gọi ZZ0002ZZ ioctl với một con trỏ tới cấu trúc này. Người lái xe lấp đầy phần còn lại của cấu trúc hoặc trả về mã lỗi ZZ0003ZZ khi ZZ0004ZZ không hợp lệ.
Có thể liệt kê các điều khiển bằng cách gọi ZZ0000ZZ với các giá trị ZZ0001ZZ liên tiếp bắt đầu từ ZZ0002ZZ cho đến và ZZ0003ZZ độc quyền. Trình điều khiển có thể trả về ZZ0004ZZ nếu có điều khiển trong phạm vi này không được hỗ trợ. Các ứng dụng khác có thể liệt kê riêng tư các điều khiển không được xác định trong thông số kỹ thuật này bằng cách bắt đầu từ ZZ0005ZZ và tăng dần ZZ0006ZZ cho đến khi có driver trả về ZZ0007ZZ.
Trong cả hai trường hợp, khi trình điều khiển đặt cờ ZZ0000ZZ trong trường ZZ0001ZZ, điều khiển này bị vô hiệu hóa vĩnh viễn và sẽ bị ứng dụng bỏ qua. [1]
Khi ứng dụng HOẶC ZZ0000ZZ với ZZ0001ZZ, trình điều khiển trả về điều khiển không kết hợp được hỗ trợ tiếp theo hoặc ZZ0002ZZ nếu không có. Ngoài ra, cờ ZZ0003ZZ có thể được chỉ định để liệt kê tất cả các điều khiển phức hợp (tức là các điều khiển có nói cách khác là loại ≥ ZZ0004ZZ và/hoặc điều khiển mảng điều khiển có chứa nhiều hơn một giá trị). Chỉ định cả hai ZZ0005ZZ và ZZ0006ZZ trong để liệt kê tất cả các điều khiển, phức tạp hay không. Trình điều khiển không hỗ trợ những lá cờ này nhưng luôn trả về ZZ0007ZZ.
ZZ0001ZZ ioctl được giới thiệu để cải thiện
hỗ trợ các điều khiển có thể sử dụng các loại kết hợp và để hiển thị các điều khiển bổ sung
thông tin kiểm soát không thể được trả về trong struct
ZZ0000ZZ vì cấu trúc đó đã đầy.
ZZ0000ZZ được sử dụng theo cách tương tự như ZZ0001ZZ, ngoại trừ mảng ZZ0002ZZ phải bằng 0 cũng vậy.
Thông tin bổ sung cần thiết cho việc điều khiển menu: tên của các mục thực đơn. Để truy vấn các ứng dụng này, hãy đặt ZZ0002ZZ và ZZ0003ZZ các trường của cấu trúc ZZ0000ZZ và gọi ZZ0004ZZ ioctl với một con trỏ tới cấu trúc này. Người lái xe lấp đầy phần còn lại của cấu trúc hoặc trả về mã lỗi ZZ0005ZZ khi ZZ0006ZZ hoặc ZZ0007ZZ không hợp lệ. Các mục menu được liệt kê bằng cách gọi ZZ0008ZZ với các giá trị ZZ0009ZZ liên tiếp từ cấu trúc ZZ0001ZZ ZZ0010ZZ đến ZZ0011ZZ, bao gồm.
Lưu ý
It is possible for VIDIOC_QUERYMENU to return
an EINVAL error code for some indices between minimum and
maximum. In that case that particular menu item is not supported by
this driver. Also note that the minimum value is not necessarily 0.
Xem thêm các ví dụ trong ZZ0000ZZ.
-
struct v4l2_queryctrl¶
__u32 |
|
Identifies the control, set by the application. See
Control IDs for predefined IDs. When the ID is ORed with
V4L2_CTRL_FLAG_NEXT_CTRL the driver clears the flag and
returns the first control with a higher ID. Drivers which do not
support this flag yet always return an |
__u32 |
|
Type of control, see |
__u8 |
|
Name of the control, a NUL-terminated ASCII string. This information is intended for the user. |
__s32 |
|
Minimum value, inclusive. This field gives a lower bound for the
control. See enum |
__s32 |
|
Maximum value, inclusive. This field gives an upper bound for the
control. See enum |
__s32 |
|
This field gives a step size for the control. See enum
Generally drivers should not scale hardware control values. It may
be necessary for example when the This field gives the smallest change of an integer control actually affecting hardware. Often the information is needed when the user can change controls by keyboard or GUI buttons, rather than a slider. When for example a hardware register accepts values 0-511 and the driver reports 0-65535, step should be 128. Note that although signed, the step value is supposed to be always positive. |
__s32 |
|
The default value of a Lưu ý Drivers reset controls to their default value only when the driver is first loaded, never afterwards. |
__u32 |
|
Control flags, see Control Flags. |
__u32 |
|
Reserved for future extensions. Drivers must set the array to zero. |
-
struct v4l2_query_ext_ctrl¶
__u32 |
|
Identifies the control, set by the application. See
Control IDs for predefined IDs. When the ID is ORed with
|
__u32 |
|
Type of control, see |
char |
|
Name of the control, a NUL-terminated ASCII string. This information is intended for the user. |
__s64 |
|
Minimum value, inclusive. This field gives a lower bound for the
control. See enum |
__s64 |
|
Maximum value, inclusive. This field gives an upper bound for the
control. See enum |
__u64 |
|
This field gives a step size for the control. See enum
Generally drivers should not scale hardware control values. It may
be necessary for example when the This field gives the smallest change of an integer control actually affecting hardware. Often the information is needed when the user can change controls by keyboard or GUI buttons, rather than a slider. When for example a hardware register accepts values 0-511 and the driver reports 0-65535, step should be 128. |
__s64 |
|
The default value of a Lưu ý Drivers reset controls to their default value only when the driver is first loaded, never afterwards. |
__u32 |
|
Control flags, see Control Flags. |
__u32 |
|
The size in bytes of a single element of the array. Given a char
pointer |
__u32 |
|
The number of elements in the N-dimensional array. If this control
is not an array, then |
__u32 |
|
The number of dimension in the N-dimensional array. If this control is not an array, then this field is 0. |
__u32 |
|
The size of each dimension. The first |
__u32 |
|
Reserved for future extensions. Applications and drivers must set the array to zero. |
-
struct v4l2_querymenu¶
__u32 |
|
Identifies the control, set by the application from the respective
struct v4l2_queryctrl |
__u32 |
|
Index of the menu item, starting at zero, set by the application. |
union { |
(anonymous) |
|
__u8 |
|
Name of the menu item, a NUL-terminated ASCII string. This
information is intended for the user. This field is valid for
|
__s64 |
|
Value of the integer menu item. This field is valid for
|
} |
||
__u32 |
|
Reserved for future extensions. Drivers must set the array to zero. |
-
type v4l2_ctrl_type¶
Type |
|
|
|
Description |
|---|---|---|---|---|
|
any |
any |
any |
An integer-valued control ranging from minimum to maximum inclusive. The step value indicates the increment between values. |
|
0 |
1 |
1 |
A boolean-valued control. Zero corresponds to “disabled”, and one means “enabled”. |
|
≥ 0 |
1 |
N-1 |
The control has a menu of N choices. The names of the menu items
can be enumerated with the |
|
≥ 0 |
1 |
N-1 |
The control has a menu of N choices. The values of the menu items
can be enumerated with the |
|
0 |
n/a |
any |
A bitmask field. The maximum value is the set of bits that can be used, all other bits are to be 0. The maximum value is interpreted as a __u32, allowing the use of bit 31 in the bitmask. |
|
0 |
0 |
0 |
A control which performs an action when set. Drivers must ignore
the value passed with |
|
any |
any |
any |
A 64-bit integer valued control. Minimum, maximum and step size
cannot be queried using |
|
≥ 0 |
≥ 1 |
≥ 0 |
The minimum and maximum string lengths. The step size means that
the string must be (minimum + N * step) characters long for N ≥ 0.
These lengths do not include the terminating zero, so in order to
pass a string of length 8 to
VIDIOC_S_EXT_CTRLS you need to
set the |
|
n/a |
n/a |
n/a |
This is not a control. When |
|
any |
any |
any |
An unsigned 8-bit valued control ranging from minimum to maximum inclusive. The step value indicates the increment between values. |
|
any |
any |
any |
An unsigned 16-bit valued control ranging from minimum to maximum inclusive. The step value indicates the increment between values. |
|
any |
any |
any |
An unsigned 32-bit valued control ranging from minimum to maximum inclusive. The step value indicates the increment between values. |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
n/a |
n/a |
n/a |
A struct |
|
0x0001 |
This control is permanently disabled and should be ignored by the
application. Any attempt to change the control will result in an
|
|
0x0002 |
This control is temporarily unchangeable, for example because
another application took over control of the respective resource.
Such controls may be displayed specially in a user interface.
Attempts to change the control may result in an |
|
0x0004 |
This control is permanently readable only. Any attempt to change
the control will result in an |
|
0x0008 |
A hint that changing this control may affect the value of other controls within the same control class. Applications should update their user interface accordingly. |
|
0x0010 |
This control is not applicable to the current configuration and should be displayed accordingly in a user interface. For example the flag may be set on a MPEG audio level 2 bitrate control when MPEG audio encoding level 1 was selected with another control. |
|
0x0020 |
A hint that this control is best represented as a slider-like element in a user interface. |
|
0x0040 |
This control is permanently writable only. Any attempt to read the
control will result in an |
|
0x0080 |
This control is volatile, which means that the value of the control changes continuously. A typical example would be the current gain value if the device is in auto-gain mode. In such a case the hardware calculates the gain value based on the lighting conditions which can change over time. Lưu ý Setting a new value for a volatile control will be ignored unless V4L2_CTRL_FLAG_EXECUTE_ON_WRITE is also set. Setting a new value for a volatile control will never trigger a V4L2_EVENT_CTRL_CH_VALUE event. |
|
0x0100 |
This control has a pointer type, so its value has to be accessed
using one of the pointer fields of struct
|
|
0x0200 |
The value provided to the control will be propagated to the driver
even if it remains constant. This is required when the control
represents an action on the hardware. For example: clearing an
error flag or triggering the flash. All the controls of the type
|
|
0x0400 |
Changing this control value may modify the layout of the buffer (for video devices) or the media bus format (for sub-devices). A typical example would be the Note that typically controls with this flag will also set the
|
|
0x0800 |
This control is a dynamically sized 1-dimensional array. It
behaves the same as a regular array, except that the number
of elements as reported by the |
|
0x1000 |
This control supports getting minimum and maximum values using vidioc_g_ext_ctrls with V4L2_CTRL_WHICH_MIN/MAX_VAL. |
7.49.5. 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.
- EINVAL
Cấu trúc ZZ0000ZZ ZZ0002ZZ là không hợp lệ. Cấu trúc ZZ0001ZZ ZZ0003ZZ không hợp lệ hoặc ZZ0004ZZ nằm ngoài phạm vi (nhỏ hơn ZZ0005ZZ hoặc lớn hơn ZZ0006ZZ) hoặc mục menu cụ thể này không được tài xế hỗ trợ.
- EACCES
Một nỗ lực đã được thực hiện để đọc điều khiển chỉ ghi.