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>ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY</TITLE 6><META 7NAME="GENERATOR" 8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK 9REL="HOME" 10TITLE="Video for Linux Two API Specification" 11HREF="book1.htm"><LINK 12REL="UP" 13TITLE="Function Reference" 14HREF="r7624.htm"><LINK 15REL="PREVIOUS" 16TITLE="ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, 17VIDIOC_TRY_FMT" 18HREF="r10944.htm"><LINK 19REL="NEXT" 20TITLE="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT" 21HREF="r11217.htm"></HEAD 22><BODY 23CLASS="REFENTRY" 24BGCOLOR="#FFFFFF" 25TEXT="#000000" 26LINK="#0000FF" 27VLINK="#840084" 28ALINK="#0000FF" 29><DIV 30CLASS="NAVHEADER" 31><TABLE 32SUMMARY="Header navigation table" 33WIDTH="100%" 34BORDER="0" 35CELLPADDING="0" 36CELLSPACING="0" 37><TR 38><TH 39COLSPAN="3" 40ALIGN="center" 41>Video for Linux Two API Specification: Revision 0.24</TH 42></TR 43><TR 44><TD 45WIDTH="10%" 46ALIGN="left" 47VALIGN="bottom" 48><A 49HREF="r10944.htm" 50ACCESSKEY="P" 51>Prev</A 52></TD 53><TD 54WIDTH="80%" 55ALIGN="center" 56VALIGN="bottom" 57></TD 58><TD 59WIDTH="10%" 60ALIGN="right" 61VALIGN="bottom" 62><A 63HREF="r11217.htm" 64ACCESSKEY="N" 65>Next</A 66></TD 67></TR 68></TABLE 69><HR 70ALIGN="LEFT" 71WIDTH="100%"></DIV 72><H1 73><A 74NAME="VIDIOC-G-FREQUENCY" 75></A 76>ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY</H1 77><DIV 78CLASS="REFNAMEDIV" 79><A 80NAME="AEN11098" 81></A 82><H2 83>Name</H2 84>VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY -- Get or set tuner or modulator radio 85frequency</DIV 86><DIV 87CLASS="REFSYNOPSISDIV" 88><A 89NAME="AEN11102" 90></A 91><H2 92>Synopsis</H2 93><DIV 94CLASS="FUNCSYNOPSIS" 95><P 96></P 97><A 98NAME="AEN11103" 99></A 100><P 101><CODE 102><CODE 103CLASS="FUNCDEF" 104>int ioctl</CODE 105>(int fd, int request, struct v4l2_frequency 106*argp);</CODE 107></P 108><P 109></P 110></DIV 111><DIV 112CLASS="FUNCSYNOPSIS" 113><P 114></P 115><A 116NAME="AEN11113" 117></A 118><P 119><CODE 120><CODE 121CLASS="FUNCDEF" 122>int ioctl</CODE 123>(int fd, int request, const struct v4l2_frequency 124*argp);</CODE 125></P 126><P 127></P 128></DIV 129></DIV 130><DIV 131CLASS="REFSECT1" 132><A 133NAME="AEN11123" 134></A 135><H2 136>Arguments</H2 137><P 138></P 139><DIV 140CLASS="VARIABLELIST" 141><DL 142><DT 143><CODE 144CLASS="PARAMETER" 145>fd</CODE 146></DT 147><DD 148><P 149>File descriptor returned by <A 150HREF="r14090.htm" 151><CODE 152CLASS="FUNCTION" 153>open()</CODE 154></A 155>.</P 156></DD 157><DT 158><CODE 159CLASS="PARAMETER" 160>request</CODE 161></DT 162><DD 163><P 164>VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY</P 165></DD 166><DT 167><CODE 168CLASS="PARAMETER" 169>argp</CODE 170></DT 171><DD 172><P 173></P 174></DD 175></DL 176></DIV 177></DIV 178><DIV 179CLASS="REFSECT1" 180><A 181NAME="AEN11143" 182></A 183><H2 184>Description</H2 185><P 186>To get the current tuner or modulator radio frequency 187applications set the <CODE 188CLASS="STRUCTFIELD" 189>tuner</CODE 190> field of a 191struct <A 192HREF="r11094.htm#V4L2-FREQUENCY" 193>v4l2_frequency</A 194> to the respective tuner or modulator number (only 195input devices have tuners, only output devices have modulators), zero 196out the <CODE 197CLASS="STRUCTFIELD" 198>reserved</CODE 199> array and 200call the <CODE 201CLASS="CONSTANT" 202>VIDIOC_G_FREQUENCY</CODE 203> ioctl with a pointer 204to this structure. The driver stores the current frequency in the 205<CODE 206CLASS="STRUCTFIELD" 207>frequency</CODE 208> field.</P 209><P 210>To change the current tuner or modulator radio frequency 211applications initialize the <CODE 212CLASS="STRUCTFIELD" 213>tuner</CODE 214>, 215<CODE 216CLASS="STRUCTFIELD" 217>type</CODE 218> and 219<CODE 220CLASS="STRUCTFIELD" 221>frequency</CODE 222> fields, and the 223<CODE 224CLASS="STRUCTFIELD" 225>reserved</CODE 226> array of a struct <A 227HREF="r11094.htm#V4L2-FREQUENCY" 228>v4l2_frequency</A 229> and 230call the <CODE 231CLASS="CONSTANT" 232>VIDIOC_S_FREQUENCY</CODE 233> ioctl with a pointer 234to this structure. When the requested frequency is not possible the 235driver assumes the closest possible value. However 236<CODE 237CLASS="CONSTANT" 238>VIDIOC_S_FREQUENCY</CODE 239> is a write-only ioctl, it does 240not return the actual new frequency.</P 241><DIV 242CLASS="TABLE" 243><A 244NAME="V4L2-FREQUENCY" 245></A 246><P 247><B 248>Table 1. struct <CODE 249CLASS="STRUCTNAME" 250>v4l2_frequency</CODE 251></B 252></P 253><TABLE 254BORDER="0" 255FRAME="void" 256WIDTH="100%" 257CLASS="CALSTABLE" 258><COL 259WIDTH="25%" 260TITLE="C1"><COL 261WIDTH="25%" 262TITLE="C2"><COL 263WIDTH="50%" 264TITLE="C3"><TBODY 265VALIGN="TOP" 266><TR 267><TD 268>__u32</TD 269><TD 270><CODE 271CLASS="STRUCTFIELD" 272>tuner</CODE 273></TD 274><TD 275>The tuner or modulator index number. This is the 276same value as in the struct <A 277HREF="r8936.htm#V4L2-INPUT" 278>v4l2_input</A 279> <CODE 280CLASS="STRUCTFIELD" 281>tuner</CODE 282> 283field and the struct <A 284HREF="r12342.htm#V4L2-TUNER" 285>v4l2_tuner</A 286> <CODE 287CLASS="STRUCTFIELD" 288>index</CODE 289> field, or 290the struct <A 291HREF="r9149.htm#V4L2-OUTPUT" 292>v4l2_output</A 293> <CODE 294CLASS="STRUCTFIELD" 295>modulator</CODE 296> field and the 297struct <A 298HREF="r11430.htm#V4L2-MODULATOR" 299>v4l2_modulator</A 300> <CODE 301CLASS="STRUCTFIELD" 302>index</CODE 303> field.</TD 304></TR 305><TR 306><TD 307>enum <A 308HREF="r12342.htm#V4L2-TUNER-TYPE" 309>v4l2_tuner_type</A 310></TD 311><TD 312><CODE 313CLASS="STRUCTFIELD" 314>type</CODE 315></TD 316><TD 317>The tuner type. This is the same value as in the 318struct <A 319HREF="r12342.htm#V4L2-TUNER" 320>v4l2_tuner</A 321> <CODE 322CLASS="STRUCTFIELD" 323>type</CODE 324> field. The field is not 325applicable to modulators, i. e. ignored by drivers.</TD 326></TR 327><TR 328><TD 329>__u32</TD 330><TD 331><CODE 332CLASS="STRUCTFIELD" 333>frequency</CODE 334></TD 335><TD 336>Tuning frequency in units of 62.5 kHz, or if the 337struct <A 338HREF="r12342.htm#V4L2-TUNER" 339>v4l2_tuner</A 340> or struct <A 341HREF="r11430.htm#V4L2-MODULATOR" 342>v4l2_modulator</A 343> <CODE 344CLASS="STRUCTFIELD" 345>capabilities</CODE 346> flag 347<CODE 348CLASS="CONSTANT" 349>V4L2_TUNER_CAP_LOW</CODE 350> is set, in units of 62.5 351Hz.</TD 352></TR 353><TR 354><TD 355>__u32</TD 356><TD 357><CODE 358CLASS="STRUCTFIELD" 359>reserved</CODE 360>[8];</TD 361><TD 362>Reserved for future extensions. Drivers and 363 applications must set the array to zero.</TD 364></TR 365></TBODY 366></TABLE 367></DIV 368></DIV 369><DIV 370CLASS="REFSECT1" 371><A 372NAME="AEN11203" 373></A 374><H2 375>Return Value</H2 376><P 377>On success <SPAN 378CLASS="RETURNVALUE" 379>0</SPAN 380> is returned, on error <SPAN 381CLASS="RETURNVALUE" 382>-1</SPAN 383> and the <CODE 384CLASS="VARNAME" 385>errno</CODE 386> variable is set appropriately:</P 387><P 388></P 389><DIV 390CLASS="VARIABLELIST" 391><DL 392><DT 393><SPAN 394CLASS="ERRORCODE" 395>EINVAL</SPAN 396></DT 397><DD 398><P 399>The <CODE 400CLASS="STRUCTFIELD" 401>tuner</CODE 402> index is out of 403bounds or the value in the <CODE 404CLASS="STRUCTFIELD" 405>type</CODE 406> field is 407wrong.</P 408></DD 409></DL 410></DIV 411></DIV 412><DIV 413CLASS="NAVFOOTER" 414><HR 415ALIGN="LEFT" 416WIDTH="100%"><TABLE 417SUMMARY="Footer navigation table" 418WIDTH="100%" 419BORDER="0" 420CELLPADDING="0" 421CELLSPACING="0" 422><TR 423><TD 424WIDTH="33%" 425ALIGN="left" 426VALIGN="top" 427><A 428HREF="r10944.htm" 429ACCESSKEY="P" 430>Prev</A 431></TD 432><TD 433WIDTH="34%" 434ALIGN="center" 435VALIGN="top" 436><A 437HREF="book1.htm" 438ACCESSKEY="H" 439>Home</A 440></TD 441><TD 442WIDTH="33%" 443ALIGN="right" 444VALIGN="top" 445><A 446HREF="r11217.htm" 447ACCESSKEY="N" 448>Next</A 449></TD 450></TR 451><TR 452><TD 453WIDTH="33%" 454ALIGN="left" 455VALIGN="top" 456>ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, 457VIDIOC_TRY_FMT</TD 458><TD 459WIDTH="34%" 460ALIGN="center" 461VALIGN="top" 462><A 463HREF="r7624.htm" 464ACCESSKEY="U" 465>Up</A 466></TD 467><TD 468WIDTH="33%" 469ALIGN="right" 470VALIGN="top" 471>ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT</TD 472></TR 473></TABLE 474></DIV 475></BODY 476></HTML 477> 478