1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="user-func.html" title="Appendix&#160;A.&#160;Function Reference"><link rel="prev" href="vidioc-g-fmt.html" title="ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT"><link rel="next" href="vidioc-g-input.html" title="ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-g-fmt.html">Prev</a>&#160;</td><th width="60%" align="center">Appendix&#160;A.&#160;Function Reference</th><td width="20%" align="right">&#160;<a accesskey="n" href="vidioc-g-input.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-g-frequency"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY &#8212; Get or set tuner or modulator radio
2frequency</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">request</var>, </td></tr><tr><td>&#160;</td><td>struct v4l2_frequency
3*<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td>&#160;</td><td>int <var class="pdparam">request</var>, </td></tr><tr><td>&#160;</td><td>const struct v4l2_frequency
4*<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1114604836"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="func-open.html" title="V4L2 open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>VIDIOC_G_FREQUENCY, VIDIOC_S_FREQUENCY</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1"><a name="idp1114608948"></a><h2>Description</h2><p>To get the current tuner or modulator radio frequency
5applications set the <em class="structfield"><code>tuner</code></em> field of a
6struct&#160;<a class="link" href="vidioc-g-frequency.html#v4l2-frequency" title="Table&#160;A.73.&#160;struct v4l2_frequency">v4l2_frequency</a> to the respective tuner or modulator number (only
7input devices have tuners, only output devices have modulators), zero
8out the <em class="structfield"><code>reserved</code></em> array and
9call the <code class="constant">VIDIOC_G_FREQUENCY</code> ioctl with a pointer
10to this structure. The driver stores the current frequency in the
11<em class="structfield"><code>frequency</code></em> field.</p><p>To change the current tuner or modulator radio frequency
12applications initialize the <em class="structfield"><code>tuner</code></em>,
13<em class="structfield"><code>type</code></em> and
14<em class="structfield"><code>frequency</code></em> fields, and the
15<em class="structfield"><code>reserved</code></em> array of a struct&#160;<a class="link" href="vidioc-g-frequency.html#v4l2-frequency" title="Table&#160;A.73.&#160;struct v4l2_frequency">v4l2_frequency</a> and
16call the <code class="constant">VIDIOC_S_FREQUENCY</code> ioctl with a pointer
17to this structure. When the requested frequency is not possible the
18driver assumes the closest possible value. However
19<code class="constant">VIDIOC_S_FREQUENCY</code> is a write-only ioctl, it does
20not return the actual new frequency.</p><div class="table"><a name="v4l2-frequency"></a><p class="title"><b>Table&#160;A.73.&#160;struct <span class="structname">v4l2_frequency</span></b></p><div class="table-contents"><table summary="struct v4l2_frequency" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>tuner</code></em></td><td valign="top">The tuner or modulator index number. This is the
21same value as in the struct&#160;<a class="link" href="vidioc-enuminput.html#v4l2-input" title="Table&#160;A.39.&#160;struct v4l2_input">v4l2_input</a> <em class="structfield"><code>tuner</code></em>
22field and the struct&#160;<a class="link" href="vidioc-g-tuner.html#v4l2-tuner" title="Table&#160;A.87.&#160;struct v4l2_tuner">v4l2_tuner</a> <em class="structfield"><code>index</code></em> field, or
23the struct&#160;<a class="link" href="vidioc-enumoutput.html#v4l2-output" title="Table&#160;A.43.&#160;struct v4l2_output">v4l2_output</a> <em class="structfield"><code>modulator</code></em> field and the
24struct&#160;<a class="link" href="vidioc-g-modulator.html#v4l2-modulator" title="Table&#160;A.76.&#160;struct v4l2_modulator">v4l2_modulator</a> <em class="structfield"><code>index</code></em> field.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>type</code></em></td><td valign="top">The tuner type. This is the same value as in the
25struct&#160;<a class="link" href="vidioc-g-tuner.html#v4l2-tuner" title="Table&#160;A.87.&#160;struct v4l2_tuner">v4l2_tuner</a> <em class="structfield"><code>type</code></em> field. The type must be set
26to <code class="constant">V4L2_TUNER_RADIO</code> for <code class="filename">/dev/radioX</code>
27device nodes, and to <code class="constant">V4L2_TUNER_ANALOG_TV</code>
28for all others. Set this field to <code class="constant">V4L2_TUNER_RADIO</code> for
29modulators (currently only radio modulators are supported).
30See <a class="xref" href="vidioc-g-tuner.html#v4l2-tuner-type" title="Table&#160;A.88.&#160;enum v4l2_tuner_type">Table&#160;A.88, &#8220;enum v4l2_tuner_type&#8221;</a></td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>frequency</code></em></td><td valign="top">Tuning frequency in units of 62.5 kHz, or if the
31struct&#160;<a class="link" href="vidioc-g-tuner.html#v4l2-tuner" title="Table&#160;A.87.&#160;struct v4l2_tuner">v4l2_tuner</a> or struct&#160;<a class="link" href="vidioc-g-modulator.html#v4l2-modulator" title="Table&#160;A.76.&#160;struct v4l2_modulator">v4l2_modulator</a> <em class="structfield"><code>capability</code></em> flag
32<code class="constant">V4L2_TUNER_CAP_LOW</code> is set, in units of 62.5
33Hz. A 1 Hz unit is used when the <em class="structfield"><code>capability</code></em> flag
34<code class="constant">V4L2_TUNER_CAP_1HZ</code> is set.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[8]</td><td valign="top">Reserved for future extensions. Drivers and
35	    applications must set the array to zero.</td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="idp1114626492"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table&#160;19.1.&#160;Generic error codes">Generic Error Codes</a> chapter.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><span class="errorcode">EINVAL</span></span></dt><dd><p>The <em class="structfield"><code>tuner</code></em> index is out of
36bounds or the value in the <em class="structfield"><code>type</code></em> field is
37wrong.</p></dd><dt><span class="term"><span class="errorcode">EBUSY</span></span></dt><dd><p>A hardware seek is in progress.</p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="vidioc-g-fmt.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="user-func.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="vidioc-g-input.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_G_FMT, VIDIOC_S_FMT,
38VIDIOC_TRY_FMT&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;ioctl VIDIOC_G_INPUT, VIDIOC_S_INPUT</td></tr></table></div></body></html>
39