aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-01-27 04:11:08 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-17 10:57:22 -0400
commit10fa813de336673c02d62a7b90528b50cdb6f3e7 (patch)
tree2f2f78bf8ee9f5bc5117e5729fc20dd39e92a37e /Documentation/DocBook
parenta4c8c262f8ae71a842585d00db9fc10014061ddf (diff)
[media] DocBook media: fix coding style in the control example code
Use the proper kernel coding style in these examples. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'Documentation/DocBook')
-rw-r--r--Documentation/DocBook/media/v4l/controls.xml81
1 files changed, 40 insertions, 41 deletions
diff --git a/Documentation/DocBook/media/v4l/controls.xml b/Documentation/DocBook/media/v4l/controls.xml
index 47198eef75a4..00cf0a719a35 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -441,61 +441,60 @@ more menu type controls.</para>
441&v4l2-queryctrl; queryctrl; 441&v4l2-queryctrl; queryctrl;
442&v4l2-querymenu; querymenu; 442&v4l2-querymenu; querymenu;
443 443
444static void 444static void enumerate_menu(void)
445enumerate_menu (void)
446{ 445{
447 printf (" Menu items:\n"); 446 printf(" Menu items:\n");
448 447
449 memset (&amp;querymenu, 0, sizeof (querymenu)); 448 memset(&amp;querymenu, 0, sizeof(querymenu));
450 querymenu.id = queryctrl.id; 449 querymenu.id = queryctrl.id;
451 450
452 for (querymenu.index = queryctrl.minimum; 451 for (querymenu.index = queryctrl.minimum;
453 querymenu.index &lt;= queryctrl.maximum; 452 querymenu.index &lt;= queryctrl.maximum;
454 querymenu.index++) { 453 querymenu.index++) {
455 if (0 == ioctl (fd, &VIDIOC-QUERYMENU;, &amp;querymenu)) { 454 if (0 == ioctl(fd, &VIDIOC-QUERYMENU;, &amp;querymenu)) {
456 printf (" %s\n", querymenu.name); 455 printf(" %s\n", querymenu.name);
457 } 456 }
458 } 457 }
459} 458}
460 459
461memset (&amp;queryctrl, 0, sizeof (queryctrl)); 460memset(&amp;queryctrl, 0, sizeof(queryctrl));
462 461
463for (queryctrl.id = V4L2_CID_BASE; 462for (queryctrl.id = V4L2_CID_BASE;
464 queryctrl.id &lt; V4L2_CID_LASTP1; 463 queryctrl.id &lt; V4L2_CID_LASTP1;
465 queryctrl.id++) { 464 queryctrl.id++) {
466 if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) { 465 if (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) {
467 if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED) 466 if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED)
468 continue; 467 continue;
469 468
470 printf ("Control %s\n", queryctrl.name); 469 printf("Control %s\n", queryctrl.name);
471 470
472 if (queryctrl.type == V4L2_CTRL_TYPE_MENU) 471 if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
473 enumerate_menu (); 472 enumerate_menu();
474 } else { 473 } else {
475 if (errno == EINVAL) 474 if (errno == EINVAL)
476 continue; 475 continue;
477 476
478 perror ("VIDIOC_QUERYCTRL"); 477 perror("VIDIOC_QUERYCTRL");
479 exit (EXIT_FAILURE); 478 exit(EXIT_FAILURE);
480 } 479 }
481} 480}
482 481
483for (queryctrl.id = V4L2_CID_PRIVATE_BASE;; 482for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;
484 queryctrl.id++) { 483 queryctrl.id++) {
485 if (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) { 484 if (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) {
486 if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED) 485 if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED)
487 continue; 486 continue;
488 487
489 printf ("Control %s\n", queryctrl.name); 488 printf("Control %s\n", queryctrl.name);
490 489
491 if (queryctrl.type == V4L2_CTRL_TYPE_MENU) 490 if (queryctrl.type == V4L2_CTRL_TYPE_MENU)
492 enumerate_menu (); 491 enumerate_menu();
493 } else { 492 } else {
494 if (errno == EINVAL) 493 if (errno == EINVAL)
495 break; 494 break;
496 495
497 perror ("VIDIOC_QUERYCTRL"); 496 perror("VIDIOC_QUERYCTRL");
498 exit (EXIT_FAILURE); 497 exit(EXIT_FAILURE);
499 } 498 }
500} 499}
501</programlisting> 500</programlisting>
@@ -508,53 +507,53 @@ for (queryctrl.id = V4L2_CID_PRIVATE_BASE;;
508&v4l2-queryctrl; queryctrl; 507&v4l2-queryctrl; queryctrl;
509&v4l2-control; control; 508&v4l2-control; control;
510 509
511memset (&amp;queryctrl, 0, sizeof (queryctrl)); 510memset(&amp;queryctrl, 0, sizeof(queryctrl));
512queryctrl.id = V4L2_CID_BRIGHTNESS; 511queryctrl.id = V4L2_CID_BRIGHTNESS;
513 512
514if (-1 == ioctl (fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) { 513if (-1 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;queryctrl)) {
515 if (errno != EINVAL) { 514 if (errno != EINVAL) {
516 perror ("VIDIOC_QUERYCTRL"); 515 perror("VIDIOC_QUERYCTRL");
517 exit (EXIT_FAILURE); 516 exit(EXIT_FAILURE);
518 } else { 517 } else {
519 printf ("V4L2_CID_BRIGHTNESS is not supported\n"); 518 printf("V4L2_CID_BRIGHTNESS is not supported\n");
520 } 519 }
521} else if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED) { 520} else if (queryctrl.flags &amp; V4L2_CTRL_FLAG_DISABLED) {
522 printf ("V4L2_CID_BRIGHTNESS is not supported\n"); 521 printf("V4L2_CID_BRIGHTNESS is not supported\n");
523} else { 522} else {
524 memset (&amp;control, 0, sizeof (control)); 523 memset(&amp;control, 0, sizeof (control));
525 control.id = V4L2_CID_BRIGHTNESS; 524 control.id = V4L2_CID_BRIGHTNESS;
526 control.value = queryctrl.default_value; 525 control.value = queryctrl.default_value;
527 526
528 if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &amp;control)) { 527 if (-1 == ioctl(fd, &VIDIOC-S-CTRL;, &amp;control)) {
529 perror ("VIDIOC_S_CTRL"); 528 perror("VIDIOC_S_CTRL");
530 exit (EXIT_FAILURE); 529 exit(EXIT_FAILURE);
531 } 530 }
532} 531}
533 532
534memset (&amp;control, 0, sizeof (control)); 533memset(&amp;control, 0, sizeof(control));
535control.id = V4L2_CID_CONTRAST; 534control.id = V4L2_CID_CONTRAST;
536 535
537if (0 == ioctl (fd, &VIDIOC-G-CTRL;, &amp;control)) { 536if (0 == ioctl(fd, &VIDIOC-G-CTRL;, &amp;control)) {
538 control.value += 1; 537 control.value += 1;
539 538
540 /* The driver may clamp the value or return ERANGE, ignored here */ 539 /* The driver may clamp the value or return ERANGE, ignored here */
541 540
542 if (-1 == ioctl (fd, &VIDIOC-S-CTRL;, &amp;control) 541 if (-1 == ioctl(fd, &VIDIOC-S-CTRL;, &amp;control)
543 &amp;&amp; errno != ERANGE) { 542 &amp;&amp; errno != ERANGE) {
544 perror ("VIDIOC_S_CTRL"); 543 perror("VIDIOC_S_CTRL");
545 exit (EXIT_FAILURE); 544 exit(EXIT_FAILURE);
546 } 545 }
547/* Ignore if V4L2_CID_CONTRAST is unsupported */ 546/* Ignore if V4L2_CID_CONTRAST is unsupported */
548} else if (errno != EINVAL) { 547} else if (errno != EINVAL) {
549 perror ("VIDIOC_G_CTRL"); 548 perror("VIDIOC_G_CTRL");
550 exit (EXIT_FAILURE); 549 exit(EXIT_FAILURE);
551} 550}
552 551
553control.id = V4L2_CID_AUDIO_MUTE; 552control.id = V4L2_CID_AUDIO_MUTE;
554control.value = TRUE; /* silence */ 553control.value = 1; /* silence */
555 554
556/* Errors ignored */ 555/* Errors ignored */
557ioctl (fd, VIDIOC_S_CTRL, &amp;control); 556ioctl(fd, VIDIOC_S_CTRL, &amp;control);
558</programlisting> 557</programlisting>
559 </example> 558 </example>
560 </section> 559 </section>
@@ -675,12 +674,12 @@ control class is found:</para>
675 <informalexample> 674 <informalexample>
676 <programlisting> 675 <programlisting>
677qctrl.id = V4L2_CTRL_CLASS_MPEG | V4L2_CTRL_FLAG_NEXT_CTRL; 676qctrl.id = V4L2_CTRL_CLASS_MPEG | V4L2_CTRL_FLAG_NEXT_CTRL;
678while (0 == ioctl (fd, &VIDIOC-QUERYCTRL;, &amp;qctrl)) { 677while (0 == ioctl(fd, &VIDIOC-QUERYCTRL;, &amp;qctrl)) {
679 if (V4L2_CTRL_ID2CLASS (qctrl.id) != V4L2_CTRL_CLASS_MPEG) 678 if (V4L2_CTRL_ID2CLASS(qctrl.id) != V4L2_CTRL_CLASS_MPEG)
680 break; 679 break;
681 /* ... */ 680 /* ... */
682 qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL; 681 qctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
683 } 682}
684</programlisting> 683</programlisting>
685 </informalexample> 684 </informalexample>
686 685