18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: V4L
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _VIDIOC_G_PRIORITY:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci******************************************
78c2ecf20Sopenharmony_ciioctl VIDIOC_G_PRIORITY, VIDIOC_S_PRIORITY
88c2ecf20Sopenharmony_ci******************************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciVIDIOC_G_PRIORITY - VIDIOC_S_PRIORITY - Query or request the access priority associated with a file descriptor
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_G_PRIORITY
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_G_PRIORITY, enum v4l2_priority *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci.. c:macro:: VIDIOC_S_PRIORITY
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci``int ioctl(int fd, VIDIOC_S_PRIORITY, const enum v4l2_priority *argp)``
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciArguments
278c2ecf20Sopenharmony_ci=========
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci``fd``
308c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci``argp``
338c2ecf20Sopenharmony_ci    Pointer to an enum :c:type:`v4l2_priority` type.
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciDescription
368c2ecf20Sopenharmony_ci===========
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ciTo query the current access priority applications call the
398c2ecf20Sopenharmony_ci:ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` ioctl with a pointer to an enum v4l2_priority
408c2ecf20Sopenharmony_civariable where the driver stores the current priority.
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ciTo request an access priority applications store the desired priority in
438c2ecf20Sopenharmony_cian enum v4l2_priority variable and call :ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctl
448c2ecf20Sopenharmony_ciwith a pointer to this variable.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci.. c:type:: v4l2_priority
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci.. flat-table:: enum v4l2_priority
518c2ecf20Sopenharmony_ci    :header-rows:  0
528c2ecf20Sopenharmony_ci    :stub-columns: 0
538c2ecf20Sopenharmony_ci    :widths:       3 1 4
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci    * - ``V4L2_PRIORITY_UNSET``
568c2ecf20Sopenharmony_ci      - 0
578c2ecf20Sopenharmony_ci      -
588c2ecf20Sopenharmony_ci    * - ``V4L2_PRIORITY_BACKGROUND``
598c2ecf20Sopenharmony_ci      - 1
608c2ecf20Sopenharmony_ci      - Lowest priority, usually applications running in background, for
618c2ecf20Sopenharmony_ci	example monitoring VBI transmissions. A proxy application running
628c2ecf20Sopenharmony_ci	in user space will be necessary if multiple applications want to
638c2ecf20Sopenharmony_ci	read from a device at this priority.
648c2ecf20Sopenharmony_ci    * - ``V4L2_PRIORITY_INTERACTIVE``
658c2ecf20Sopenharmony_ci      - 2
668c2ecf20Sopenharmony_ci      -
678c2ecf20Sopenharmony_ci    * - ``V4L2_PRIORITY_DEFAULT``
688c2ecf20Sopenharmony_ci      - 2
698c2ecf20Sopenharmony_ci      - Medium priority, usually applications started and interactively
708c2ecf20Sopenharmony_ci	controlled by the user. For example TV viewers, Teletext browsers,
718c2ecf20Sopenharmony_ci	or just "panel" applications to change the channel or video
728c2ecf20Sopenharmony_ci	controls. This is the default priority unless an application
738c2ecf20Sopenharmony_ci	requests another.
748c2ecf20Sopenharmony_ci    * - ``V4L2_PRIORITY_RECORD``
758c2ecf20Sopenharmony_ci      - 3
768c2ecf20Sopenharmony_ci      - Highest priority. Only one file descriptor can have this priority,
778c2ecf20Sopenharmony_ci	it blocks any other fd from changing device properties. Usually
788c2ecf20Sopenharmony_ci	applications which must not be interrupted, like video recording.
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ciReturn Value
818c2ecf20Sopenharmony_ci============
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
848c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
858c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciEINVAL
888c2ecf20Sopenharmony_ci    The requested priority value is invalid.
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ciEBUSY
918c2ecf20Sopenharmony_ci    Another application already requested higher priority.
92