18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _app-pri:
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci********************
68c2ecf20Sopenharmony_ciApplication Priority
78c2ecf20Sopenharmony_ci********************
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ciWhen multiple applications share a device it may be desirable to assign
108c2ecf20Sopenharmony_cithem different priorities. Contrary to the traditional "rm -rf /" school
118c2ecf20Sopenharmony_ciof thought, a video recording application could for example block other
128c2ecf20Sopenharmony_ciapplications from changing video controls or switching the current TV
138c2ecf20Sopenharmony_cichannel. Another objective is to permit low priority applications
148c2ecf20Sopenharmony_ciworking in background, which can be preempted by user controlled
158c2ecf20Sopenharmony_ciapplications and automatically regain control of the device at a later
168c2ecf20Sopenharmony_citime.
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciSince these features cannot be implemented entirely in user space V4L2
198c2ecf20Sopenharmony_cidefines the :ref:`VIDIOC_G_PRIORITY <VIDIOC_G_PRIORITY>` and
208c2ecf20Sopenharmony_ci:ref:`VIDIOC_S_PRIORITY <VIDIOC_G_PRIORITY>` ioctls to request and
218c2ecf20Sopenharmony_ciquery the access priority associate with a file descriptor. Opening a
228c2ecf20Sopenharmony_cidevice assigns a medium priority, compatible with earlier versions of
238c2ecf20Sopenharmony_ciV4L2 and drivers not supporting these ioctls. Applications requiring a
248c2ecf20Sopenharmony_cidifferent priority will usually call :ref:`VIDIOC_S_PRIORITY
258c2ecf20Sopenharmony_ci<VIDIOC_G_PRIORITY>` after verifying the device with the
268c2ecf20Sopenharmony_ci:ref:`VIDIOC_QUERYCAP` ioctl.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciIoctls changing driver properties, such as
298c2ecf20Sopenharmony_ci:ref:`VIDIOC_S_INPUT <VIDIOC_G_INPUT>`, return an ``EBUSY`` error code
308c2ecf20Sopenharmony_ciafter another application obtained higher priority.
31