1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> 2 <HTML 3 ><HEAD 4 ><TITLE 5 >User Controls</TITLE 6 ><META 7 NAME="GENERATOR" 8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK 9 REL="HOME" 10 TITLE="Video for Linux Two API Specification" 11 HREF="book1.htm"><LINK 12 REL="UP" 13 TITLE="Common API Elements" 14 HREF="c174.htm"><LINK 15 REL="PREVIOUS" 16 TITLE="Video Standards" 17 HREF="x448.htm"><LINK 18 REL="NEXT" 19 TITLE="Extended Controls" 20 HREF="x802.htm"></HEAD 21 ><BODY 22 CLASS="SECTION" 23 BGCOLOR="#FFFFFF" 24 TEXT="#000000" 25 LINK="#0000FF" 26 VLINK="#840084" 27 ALINK="#0000FF" 28 ><DIV 29 CLASS="NAVHEADER" 30 ><TABLE 31 SUMMARY="Header navigation table" 32 WIDTH="100%" 33 BORDER="0" 34 CELLPADDING="0" 35 CELLSPACING="0" 36 ><TR 37 ><TH 38 COLSPAN="3" 39 ALIGN="center" 40 >Video for Linux Two API Specification: Revision 0.24</TH 41 ></TR 42 ><TR 43 ><TD 44 WIDTH="10%" 45 ALIGN="left" 46 VALIGN="bottom" 47 ><A 48 HREF="x448.htm" 49 ACCESSKEY="P" 50 >Prev</A 51 ></TD 52 ><TD 53 WIDTH="80%" 54 ALIGN="center" 55 VALIGN="bottom" 56 >Chapter 1. Common API Elements</TD 57 ><TD 58 WIDTH="10%" 59 ALIGN="right" 60 VALIGN="bottom" 61 ><A 62 HREF="x802.htm" 63 ACCESSKEY="N" 64 >Next</A 65 ></TD 66 ></TR 67 ></TABLE 68 ><HR 69 ALIGN="LEFT" 70 WIDTH="100%"></DIV 71 ><DIV 72 CLASS="SECTION" 73 ><H1 74 CLASS="SECTION" 75 ><A 76 NAME="CONTROL" 77 >1.8. User Controls</A 78 ></H1 79 ><P 80 >Devices typically have a number of user-settable controls 81 such as brightness, saturation and so on, which would be presented to 82 the user on a graphical user interface. But, different devices 83 will have different controls available, and furthermore, the range of 84 possible values, and the default value will vary from device to 85 device. The control ioctls provide the information and a mechanism to 86 create a nice user interface for these controls that will work 87 correctly with any device.</P 88 ><P 89 >All controls are accessed using an ID value. V4L2 defines 90 several IDs for specific purposes. Drivers can also implement their 91 own custom controls using <CODE 92 CLASS="CONSTANT" 93 >V4L2_CID_PRIVATE_BASE</CODE 94 > 95 and higher values. The pre-defined control IDs have the prefix 96 <CODE 97 CLASS="CONSTANT" 98 >V4L2_CID_</CODE 99 >, and are listed in <A 100 HREF="x542.htm#CONTROL-ID" 101 >Table 1-1</A 102 >. The ID is used when querying the attributes of 103 a control, and when getting or setting the current value.</P 104 ><P 105 >Generally applications should present controls to the user 106 without assumptions about their purpose. Each control comes with a 107 name string the user is supposed to understand. When the purpose is 108 non-intuitive the driver writer should provide a user manual, a user 109 interface plug-in or a driver specific panel application. Predefined 110 IDs were introduced to change a few controls programmatically, for 111 example to mute a device during a channel switch.</P 112 ><P 113 >Drivers may enumerate different controls after switching 114 the current video input or output, tuner or modulator, or audio input 115 or output. Different in the sense of other bounds, another default and 116 current value, step size or other menu items. A control with a certain 117 <SPAN 118 CLASS="emphasis" 119 ><I 120 CLASS="EMPHASIS" 121 >custom</I 122 ></SPAN 123 > ID can also change name and 124 type.<A 125 NAME="AEN552" 126 HREF="x542.htm#FTN.AEN552" 127 ><SPAN 128 CLASS="footnote" 129 >[1]</SPAN 130 ></A 131 > Control values are stored globally, they do not 132 change when switching except to stay within the reported bounds. They 133 also do not change e. g. when the device is opened or closed, when the 134 tuner radio frequency is changed or generally never without 135 application request. Since V4L2 specifies no event mechanism, panel 136 applications intended to cooperate with other panel applications (be 137 they built into a larger application, as a TV viewer) may need to 138 regularly poll control values to update their user 139 interface.<A 140 NAME="AEN555" 141 HREF="x542.htm#FTN.AEN555" 142 ><SPAN 143 CLASS="footnote" 144 >[2]</SPAN 145 ></A 146 ></P 147 ><DIV 148 CLASS="TABLE" 149 ><A 150 NAME="CONTROL-ID" 151 ></A 152 ><P 153 ><B 154 >Table 1-1. Control IDs</B 155 ></P 156 ><TABLE 157 BORDER="0" 158 FRAME="void" 159 WIDTH="100%" 160 CLASS="CALSTABLE" 161 ><COL 162 WIDTH="38%" 163 TITLE="C1"><COL 164 WIDTH="12%" 165 TITLE="C2"><COL 166 WIDTH="50%" 167 TITLE="C3"><THEAD 168 ><TR 169 ><TH 170 >ID</TH 171 ><TH 172 >Type</TH 173 ><TH 174 >Description</TH 175 ></TR 176 ></THEAD 177 ><TBODY 178 VALIGN="TOP" 179 ><TR 180 ><TD 181 ><CODE 182 CLASS="CONSTANT" 183 >V4L2_CID_BASE</CODE 184 ></TD 185 ><TD 186 > </TD 187 ><TD 188 >First predefined ID, equal to 189 <CODE 190 CLASS="CONSTANT" 191 >V4L2_CID_BRIGHTNESS</CODE 192 >.</TD 193 ></TR 194 ><TR 195 ><TD 196 ><CODE 197 CLASS="CONSTANT" 198 >V4L2_CID_USER_BASE</CODE 199 ></TD 200 ><TD 201 > </TD 202 ><TD 203 >Synonym of <CODE 204 CLASS="CONSTANT" 205 >V4L2_CID_BASE</CODE 206 >.</TD 207 ></TR 208 ><TR 209 ><TD 210 ><CODE 211 CLASS="CONSTANT" 212 >V4L2_CID_BRIGHTNESS</CODE 213 ></TD 214 ><TD 215 >integer</TD 216 ><TD 217 >Picture brightness, or more precisely, the black 218 level.</TD 219 ></TR 220 ><TR 221 ><TD 222 ><CODE 223 CLASS="CONSTANT" 224 >V4L2_CID_CONTRAST</CODE 225 ></TD 226 ><TD 227 >integer</TD 228 ><TD 229 >Picture contrast or luma gain.</TD 230 ></TR 231 ><TR 232 ><TD 233 ><CODE 234 CLASS="CONSTANT" 235 >V4L2_CID_SATURATION</CODE 236 ></TD 237 ><TD 238 >integer</TD 239 ><TD 240 >Picture color saturation or chroma gain.</TD 241 ></TR 242 ><TR 243 ><TD 244 ><CODE 245 CLASS="CONSTANT" 246 >V4L2_CID_HUE</CODE 247 ></TD 248 ><TD 249 >integer</TD 250 ><TD 251 >Hue or color balance.</TD 252 ></TR 253 ><TR 254 ><TD 255 ><CODE 256 CLASS="CONSTANT" 257 >V4L2_CID_AUDIO_VOLUME</CODE 258 ></TD 259 ><TD 260 >integer</TD 261 ><TD 262 >Overall audio volume. Note some drivers also 263 provide an OSS or ALSA mixer interface.</TD 264 ></TR 265 ><TR 266 ><TD 267 ><CODE 268 CLASS="CONSTANT" 269 >V4L2_CID_AUDIO_BALANCE</CODE 270 ></TD 271 ><TD 272 >integer</TD 273 ><TD 274 >Audio stereo balance. Minimum corresponds to all 275 the way left, maximum to right.</TD 276 ></TR 277 ><TR 278 ><TD 279 ><CODE 280 CLASS="CONSTANT" 281 >V4L2_CID_AUDIO_BASS</CODE 282 ></TD 283 ><TD 284 >integer</TD 285 ><TD 286 >Audio bass adjustment.</TD 287 ></TR 288 ><TR 289 ><TD 290 ><CODE 291 CLASS="CONSTANT" 292 >V4L2_CID_AUDIO_TREBLE</CODE 293 ></TD 294 ><TD 295 >integer</TD 296 ><TD 297 >Audio treble adjustment.</TD 298 ></TR 299 ><TR 300 ><TD 301 ><CODE 302 CLASS="CONSTANT" 303 >V4L2_CID_AUDIO_MUTE</CODE 304 ></TD 305 ><TD 306 >boolean</TD 307 ><TD 308 >Mute audio, i. e. set the volume to zero, however 309 without affecting <CODE 310 CLASS="CONSTANT" 311 >V4L2_CID_AUDIO_VOLUME</CODE 312 >. Like 313 ALSA drivers, V4L2 drivers must mute at load time to avoid excessive 314 noise. Actually the entire device should be reset to a low power 315 consumption state.</TD 316 ></TR 317 ><TR 318 ><TD 319 ><CODE 320 CLASS="CONSTANT" 321 >V4L2_CID_AUDIO_LOUDNESS</CODE 322 ></TD 323 ><TD 324 >boolean</TD 325 ><TD 326 >Loudness mode (bass boost).</TD 327 ></TR 328 ><TR 329 ><TD 330 ><CODE 331 CLASS="CONSTANT" 332 >V4L2_CID_BLACK_LEVEL</CODE 333 ></TD 334 ><TD 335 >integer</TD 336 ><TD 337 >Another name for brightness (not a synonym of 338 <CODE 339 CLASS="CONSTANT" 340 >V4L2_CID_BRIGHTNESS</CODE 341 >). This control is deprecated 342 and should not be used in new drivers and applications.</TD 343 ></TR 344 ><TR 345 ><TD 346 ><CODE 347 CLASS="CONSTANT" 348 >V4L2_CID_AUTO_WHITE_BALANCE</CODE 349 ></TD 350 ><TD 351 >boolean</TD 352 ><TD 353 >Automatic white balance (cameras).</TD 354 ></TR 355 ><TR 356 ><TD 357 ><CODE 358 CLASS="CONSTANT" 359 >V4L2_CID_DO_WHITE_BALANCE</CODE 360 ></TD 361 ><TD 362 >button</TD 363 ><TD 364 >This is an action control. When set (the value is 365 ignored), the device will do a white balance and then hold the current 366 setting. Contrast this with the boolean 367 <CODE 368 CLASS="CONSTANT" 369 >V4L2_CID_AUTO_WHITE_BALANCE</CODE 370 >, which, when 371 activated, keeps adjusting the white balance.</TD 372 ></TR 373 ><TR 374 ><TD 375 ><CODE 376 CLASS="CONSTANT" 377 >V4L2_CID_RED_BALANCE</CODE 378 ></TD 379 ><TD 380 >integer</TD 381 ><TD 382 >Red chroma balance.</TD 383 ></TR 384 ><TR 385 ><TD 386 ><CODE 387 CLASS="CONSTANT" 388 >V4L2_CID_BLUE_BALANCE</CODE 389 ></TD 390 ><TD 391 >integer</TD 392 ><TD 393 >Blue chroma balance.</TD 394 ></TR 395 ><TR 396 ><TD 397 ><CODE 398 CLASS="CONSTANT" 399 >V4L2_CID_GAMMA</CODE 400 ></TD 401 ><TD 402 >integer</TD 403 ><TD 404 >Gamma adjust.</TD 405 ></TR 406 ><TR 407 ><TD 408 ><CODE 409 CLASS="CONSTANT" 410 >V4L2_CID_WHITENESS</CODE 411 ></TD 412 ><TD 413 >integer</TD 414 ><TD 415 >Whiteness for grey-scale devices. This is a synonym 416 for <CODE 417 CLASS="CONSTANT" 418 >V4L2_CID_GAMMA</CODE 419 >. This control is deprecated 420 and should not be used in new drivers and applications.</TD 421 ></TR 422 ><TR 423 ><TD 424 ><CODE 425 CLASS="CONSTANT" 426 >V4L2_CID_EXPOSURE</CODE 427 ></TD 428 ><TD 429 >integer</TD 430 ><TD 431 >Exposure (cameras). [Unit?]</TD 432 ></TR 433 ><TR 434 ><TD 435 ><CODE 436 CLASS="CONSTANT" 437 >V4L2_CID_AUTOGAIN</CODE 438 ></TD 439 ><TD 440 >boolean</TD 441 ><TD 442 >Automatic gain/exposure control.</TD 443 ></TR 444 ><TR 445 ><TD 446 ><CODE 447 CLASS="CONSTANT" 448 >V4L2_CID_GAIN</CODE 449 ></TD 450 ><TD 451 >integer</TD 452 ><TD 453 >Gain control.</TD 454 ></TR 455 ><TR 456 ><TD 457 ><CODE 458 CLASS="CONSTANT" 459 >V4L2_CID_HFLIP</CODE 460 ></TD 461 ><TD 462 >boolean</TD 463 ><TD 464 >Mirror the picture horizontally.</TD 465 ></TR 466 ><TR 467 ><TD 468 ><CODE 469 CLASS="CONSTANT" 470 >V4L2_CID_VFLIP</CODE 471 ></TD 472 ><TD 473 >boolean</TD 474 ><TD 475 >Mirror the picture vertically.</TD 476 ></TR 477 ><TR 478 ><TD 479 ><CODE 480 CLASS="CONSTANT" 481 >V4L2_CID_HCENTER_DEPRECATED</CODE 482 > (formerly <CODE 483 CLASS="CONSTANT" 484 >V4L2_CID_HCENTER</CODE 485 >)</TD 486 ><TD 487 >integer</TD 488 ><TD 489 >Horizontal image centering. This control is 490 deprecated. New drivers and applications should use the <A 491 HREF="x802.htm#CAMERA-CONTROLS" 492 >Camera class controls</A 493 > 494 <CODE 495 CLASS="CONSTANT" 496 >V4L2_CID_PAN_ABSOLUTE</CODE 497 >, 498 <CODE 499 CLASS="CONSTANT" 500 >V4L2_CID_PAN_RELATIVE</CODE 501 > and 502 <CODE 503 CLASS="CONSTANT" 504 >V4L2_CID_PAN_RESET</CODE 505 > instead.</TD 506 ></TR 507 ><TR 508 ><TD 509 ><CODE 510 CLASS="CONSTANT" 511 >V4L2_CID_VCENTER_DEPRECATED</CODE 512 > 513 (formerly <CODE 514 CLASS="CONSTANT" 515 >V4L2_CID_VCENTER</CODE 516 >)</TD 517 ><TD 518 >integer</TD 519 ><TD 520 >Vertical image centering. Centering is intended to 521 <SPAN 522 CLASS="emphasis" 523 ><I 524 CLASS="EMPHASIS" 525 >physically</I 526 ></SPAN 527 > adjust cameras. For image cropping see 528 <A 529 HREF="x1904.htm" 530 >Section 1.11</A 531 >, for clipping <A 532 HREF="x6570.htm" 533 >Section 4.2</A 534 >. This 535 control is deprecated. New drivers and applications should use the 536 <A 537 HREF="x802.htm#CAMERA-CONTROLS" 538 >Camera class controls</A 539 > 540 <CODE 541 CLASS="CONSTANT" 542 >V4L2_CID_TILT_ABSOLUTE</CODE 543 >, 544 <CODE 545 CLASS="CONSTANT" 546 >V4L2_CID_TILT_RELATIVE</CODE 547 > and 548 <CODE 549 CLASS="CONSTANT" 550 >V4L2_CID_TILT_RESET</CODE 551 > instead.</TD 552 ></TR 553 ><TR 554 ><TD 555 ><CODE 556 CLASS="CONSTANT" 557 >V4L2_CID_POWER_LINE_FREQUENCY</CODE 558 ></TD 559 ><TD 560 >integer</TD 561 ><TD 562 >Enables a power line frequency filter to avoid 563 flicker. Possible values are: 564 <CODE 565 CLASS="CONSTANT" 566 >V4L2_CID_POWER_LINE_FREQUENCY_DISABLED</CODE 567 > (0), 568 <CODE 569 CLASS="CONSTANT" 570 >V4L2_CID_POWER_LINE_FREQUENCY_50HZ</CODE 571 > (1) and 572 <CODE 573 CLASS="CONSTANT" 574 >V4L2_CID_POWER_LINE_FREQUENCY_60HZ</CODE 575 > (2).</TD 576 ></TR 577 ><TR 578 ><TD 579 ><CODE 580 CLASS="CONSTANT" 581 >V4L2_CID_HUE_AUTO</CODE 582 ></TD 583 ><TD 584 >boolean</TD 585 ><TD 586 >Enables automatic hue control by the device. The 587 effect of setting <CODE 588 CLASS="CONSTANT" 589 >V4L2_CID_HUE</CODE 590 > while automatic 591 hue control is enabled is undefined, drivers should ignore such 592 request.</TD 593 ></TR 594 ><TR 595 ><TD 596 ><CODE 597 CLASS="CONSTANT" 598 >V4L2_CID_WHITE_BALANCE_TEMPERATURE</CODE 599 ></TD 600 ><TD 601 >integer</TD 602 ><TD 603 >This control specifies the white balance settings 604 as a color temperature in Kelvin. A driver should have a minimum of 605 2800 (incandescent) to 6500 (daylight). For more information about 606 color temperature see <A 607 HREF="http://en.wikipedia.org/wiki/Color_temperature" 608 TARGET="_top" 609 >Wikipedia</A 610 >.</TD 611 ></TR 612 ><TR 613 ><TD 614 ><CODE 615 CLASS="CONSTANT" 616 >V4L2_CID_SHARPNESS</CODE 617 ></TD 618 ><TD 619 >integer</TD 620 ><TD 621 >Adjusts the sharpness filters in a camera. The 622 minimum value disables the filters, higher values give a sharper 623 picture.</TD 624 ></TR 625 ><TR 626 ><TD 627 ><CODE 628 CLASS="CONSTANT" 629 >V4L2_CID_BACKLIGHT_COMPENSATION</CODE 630 ></TD 631 ><TD 632 >integer</TD 633 ><TD 634 >Adjusts the backlight compensation in a camera. The 635 minimum value disables backlight compensation.</TD 636 ></TR 637 ><TR 638 ><TD 639 ><CODE 640 CLASS="CONSTANT" 641 >V4L2_CID_LASTP1</CODE 642 ></TD 643 ><TD 644 > </TD 645 ><TD 646 >End of the predefined control IDs (currently 647 <CODE 648 CLASS="CONSTANT" 649 >V4L2_CID_BACKLIGHT_COMPENSATION</CODE 650 > + 1).</TD 651 ></TR 652 ><TR 653 ><TD 654 ><CODE 655 CLASS="CONSTANT" 656 >V4L2_CID_PRIVATE_BASE</CODE 657 ></TD 658 ><TD 659 > </TD 660 ><TD 661 >ID of the first custom (driver specific) control. 662 Applications depending on particular custom controls should check the 663 driver name and version, see <A 664 HREF="x282.htm" 665 >Section 1.2</A 666 >.</TD 667 ></TR 668 ></TBODY 669 ></TABLE 670 ></DIV 671 ><P 672 >Applications can enumerate the available controls with the 673 <A 674 HREF="r13317.htm" 675 ><CODE 676 CLASS="CONSTANT" 677 >VIDIOC_QUERYCTRL</CODE 678 ></A 679 > and <A 680 HREF="r13317.htm" 681 ><CODE 682 CLASS="CONSTANT" 683 >VIDIOC_QUERYMENU</CODE 684 ></A 685 > ioctls, get and set a 686 control value with the <A 687 HREF="r10104.htm" 688 ><CODE 689 CLASS="CONSTANT" 690 >VIDIOC_G_CTRL</CODE 691 ></A 692 > and <A 693 HREF="r10104.htm" 694 ><CODE 695 CLASS="CONSTANT" 696 >VIDIOC_S_CTRL</CODE 697 ></A 698 > ioctls. 699 Drivers must implement <CODE 700 CLASS="CONSTANT" 701 >VIDIOC_QUERYCTRL</CODE 702 >, 703 <CODE 704 CLASS="CONSTANT" 705 >VIDIOC_G_CTRL</CODE 706 > and 707 <CODE 708 CLASS="CONSTANT" 709 >VIDIOC_S_CTRL</CODE 710 > when the device has one or more 711 controls, <CODE 712 CLASS="CONSTANT" 713 >VIDIOC_QUERYMENU</CODE 714 > when it has one or 715 more menu type controls.</P 716 ><DIV 717 CLASS="EXAMPLE" 718 ><A 719 NAME="AEN778" 720 ></A 721 ><P 722 ><B 723 >Example 1-8. Enumerating all controls</B 724 ></P 725 ><PRE 726 CLASS="PROGRAMLISTING" 727 >struct <A 728 HREF="r13317.htm#V4L2-QUERYCTRL" 729 >v4l2_queryctrl</A 730 > queryctrl; 731 struct <A 732 HREF="r13317.htm#V4L2-QUERYMENU" 733 >v4l2_querymenu</A 734 > querymenu; 735 736 static void 737 enumerate_menu (void) 738 { 739 printf (" Menu items:\n"); 740 741 memset (&querymenu, 0, sizeof (querymenu)); 742 querymenu.id = queryctrl.id; 743 744 for (querymenu.index = queryctrl.minimum; 745 querymenu.index <= queryctrl.maximum; 746 querymenu.index++) { 747 if (0 == ioctl (fd, <A 748 HREF="r13317.htm" 749 ><CODE 750 CLASS="CONSTANT" 751 >VIDIOC_QUERYMENU</CODE 752 ></A 753 >, &querymenu)) { 754 printf (" %s\n", querymenu.name); 755 } else { 756 perror ("VIDIOC_QUERYMENU"); 757 exit (EXIT_FAILURE); 758 } 759 } 760 } 761 762 memset (&queryctrl, 0, sizeof (queryctrl)); 763 764 for (queryctrl.id = V4L2_CID_BASE; 765 queryctrl.id < V4L2_CID_LASTP1; 766 queryctrl.id++) { 767 if (0 == ioctl (fd, <A 768 HREF="r13317.htm" 769 ><CODE 770 CLASS="CONSTANT" 771 >VIDIOC_QUERYCTRL</CODE 772 ></A 773 >, &queryctrl)) { 774 if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) 775 continue; 776 777 printf ("Control %s\n", queryctrl.name); 778 779 if (queryctrl.type == V4L2_CTRL_TYPE_MENU) 780 enumerate_menu (); 781 } else { 782 if (errno == EINVAL) 783 continue; 784 785 perror ("VIDIOC_QUERYCTRL"); 786 exit (EXIT_FAILURE); 787 } 788 } 789 790 for (queryctrl.id = V4L2_CID_PRIVATE_BASE;; 791 queryctrl.id++) { 792 if (0 == ioctl (fd, <A 793 HREF="r13317.htm" 794 ><CODE 795 CLASS="CONSTANT" 796 >VIDIOC_QUERYCTRL</CODE 797 ></A 798 >, &queryctrl)) { 799 if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) 800 continue; 801 802 printf ("Control %s\n", queryctrl.name); 803 804 if (queryctrl.type == V4L2_CTRL_TYPE_MENU) 805 enumerate_menu (); 806 } else { 807 if (errno == EINVAL) 808 break; 809 810 perror ("VIDIOC_QUERYCTRL"); 811 exit (EXIT_FAILURE); 812 } 813 }</PRE 814 ></DIV 815 ><DIV 816 CLASS="EXAMPLE" 817 ><A 818 NAME="AEN789" 819 ></A 820 ><P 821 ><B 822 >Example 1-9. Changing controls</B 823 ></P 824 ><PRE 825 CLASS="PROGRAMLISTING" 826 >struct <A 827 HREF="r13317.htm#V4L2-QUERYCTRL" 828 >v4l2_queryctrl</A 829 > queryctrl; 830 struct <A 831 HREF="r10104.htm#V4L2-CONTROL" 832 >v4l2_control</A 833 > control; 834 835 memset (&queryctrl, 0, sizeof (queryctrl)); 836 queryctrl.id = V4L2_CID_BRIGHTNESS; 837 838 if (-1 == ioctl (fd, <A 839 HREF="r13317.htm" 840 ><CODE 841 CLASS="CONSTANT" 842 >VIDIOC_QUERYCTRL</CODE 843 ></A 844 >, &queryctrl)) { 845 if (errno != EINVAL) { 846 perror ("VIDIOC_QUERYCTRL"); 847 exit (EXIT_FAILURE); 848 } else { 849 printf ("V4L2_CID_BRIGHTNESS is not supported\n"); 850 } 851 } else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) { 852 printf ("V4L2_CID_BRIGHTNESS is not supported\n"); 853 } else { 854 memset (&control, 0, sizeof (control)); 855 control.id = V4L2_CID_BRIGHTNESS; 856 control.value = queryctrl.default_value; 857 858 if (-1 == ioctl (fd, <A 859 HREF="r10104.htm" 860 ><CODE 861 CLASS="CONSTANT" 862 >VIDIOC_S_CTRL</CODE 863 ></A 864 >, &control)) { 865 perror ("VIDIOC_S_CTRL"); 866 exit (EXIT_FAILURE); 867 } 868 } 869 870 memset (&control, 0, sizeof (control)); 871 control.id = V4L2_CID_CONTRAST; 872 873 if (0 == ioctl (fd, <A 874 HREF="r10104.htm" 875 ><CODE 876 CLASS="CONSTANT" 877 >VIDIOC_G_CTRL</CODE 878 ></A 879 >, &control)) { 880 control.value += 1; 881 882 /* The driver may clamp the value or return ERANGE, ignored here */ 883 884 if (-1 == ioctl (fd, <A 885 HREF="r10104.htm" 886 ><CODE 887 CLASS="CONSTANT" 888 >VIDIOC_S_CTRL</CODE 889 ></A 890 >, &control) 891 && errno != ERANGE) { 892 perror ("VIDIOC_S_CTRL"); 893 exit (EXIT_FAILURE); 894 } 895 /* Ignore if V4L2_CID_CONTRAST is unsupported */ 896 } else if (errno != EINVAL) { 897 perror ("VIDIOC_G_CTRL"); 898 exit (EXIT_FAILURE); 899 } 900 901 control.id = V4L2_CID_AUDIO_MUTE; 902 control.value = TRUE; /* silence */ 903 904 /* Errors ignored */ 905 ioctl (fd, VIDIOC_S_CTRL, &control);</PRE 906 ></DIV 907 ></DIV 908 ><H3 909 CLASS="FOOTNOTES" 910 >Notes</H3 911 ><TABLE 912 BORDER="0" 913 CLASS="FOOTNOTES" 914 WIDTH="100%" 915 ><TR 916 ><TD 917 ALIGN="LEFT" 918 VALIGN="TOP" 919 WIDTH="5%" 920 ><A 921 NAME="FTN.AEN552" 922 HREF="x542.htm#AEN552" 923 ><SPAN 924 CLASS="footnote" 925 >[1]</SPAN 926 ></A 927 ></TD 928 ><TD 929 ALIGN="LEFT" 930 VALIGN="TOP" 931 WIDTH="95%" 932 ><P 933 >It will be more convenient for applications if drivers 934 make use of the <CODE 935 CLASS="CONSTANT" 936 >V4L2_CTRL_FLAG_DISABLED</CODE 937 > flag, but 938 that was never required.</P 939 ></TD 940 ></TR 941 ><TR 942 ><TD 943 ALIGN="LEFT" 944 VALIGN="TOP" 945 WIDTH="5%" 946 ><A 947 NAME="FTN.AEN555" 948 HREF="x542.htm#AEN555" 949 ><SPAN 950 CLASS="footnote" 951 >[2]</SPAN 952 ></A 953 ></TD 954 ><TD 955 ALIGN="LEFT" 956 VALIGN="TOP" 957 WIDTH="95%" 958 ><P 959 >Applications could call an ioctl to request events. 960 After another process called <A 961 HREF="r10104.htm" 962 ><CODE 963 CLASS="CONSTANT" 964 >VIDIOC_S_CTRL</CODE 965 ></A 966 > or another ioctl changing 967 shared properties the <A 968 HREF="r14390.htm" 969 ><CODE 970 CLASS="FUNCTION" 971 >select()</CODE 972 ></A 973 > function would indicate 974 readability until any ioctl (querying the properties) is 975 called.</P 976 ></TD 977 ></TR 978 ></TABLE 979 ><DIV 980 CLASS="NAVFOOTER" 981 ><HR 982 ALIGN="LEFT" 983 WIDTH="100%"><TABLE 984 SUMMARY="Footer navigation table" 985 WIDTH="100%" 986 BORDER="0" 987 CELLPADDING="0" 988 CELLSPACING="0" 989 ><TR 990 ><TD 991 WIDTH="33%" 992 ALIGN="left" 993 VALIGN="top" 994 ><A 995 HREF="x448.htm" 996 ACCESSKEY="P" 997 >Prev</A 998 ></TD 999 ><TD 1000 WIDTH="34%" 1001 ALIGN="center" 1002 VALIGN="top" 1003 ><A 1004 HREF="book1.htm" 1005 ACCESSKEY="H" 1006 >Home</A 1007 ></TD 1008 ><TD 1009 WIDTH="33%" 1010 ALIGN="right" 1011 VALIGN="top" 1012 ><A 1013 HREF="x802.htm" 1014 ACCESSKEY="N" 1015 >Next</A 1016 ></TD 1017 ></TR 1018 ><TR 1019 ><TD 1020 WIDTH="33%" 1021 ALIGN="left" 1022 VALIGN="top" 1023 >Video Standards</TD 1024 ><TD 1025 WIDTH="34%" 1026 ALIGN="center" 1027 VALIGN="top" 1028 ><A 1029 HREF="c174.htm" 1030 ACCESSKEY="U" 1031 >Up</A 1032 ></TD 1033 ><TD 1034 WIDTH="33%" 1035 ALIGN="right" 1036 VALIGN="top" 1037 >Extended Controls</TD 1038 ></TR 1039 ></TABLE 1040 ></DIV 1041 ></BODY 1042 ></HTML 1043 > 1044