<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://bugs.maemo.com/skins/common/feed.css?207"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://bugs.maemo.com/index.php?action=history&amp;feed=atom&amp;title=Programming_N800_FM_radio_receiver</id>
		<title>Programming N800 FM radio receiver - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://bugs.maemo.com/index.php?action=history&amp;feed=atom&amp;title=Programming_N800_FM_radio_receiver"/>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;action=history"/>
		<updated>2026-04-04T18:18:34Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.15.5-7</generator>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=38602&amp;oldid=prev</id>
		<title>amigadave:&amp;#32;cut section headings</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=38602&amp;oldid=prev"/>
				<updated>2010-09-14T09:33:32Z</updated>
		
		<summary type="html">&lt;p&gt;cut section headings&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 09:33, 14 September 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;== How to control the FM tuner chip in the N800 ==&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The [[Nokia N800|N800]] internet tablet features a tea5761 FM tuner chip for listening&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The [[Nokia N800|N800]] internet tablet features a tea5761 FM tuner chip for listening&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;to FM radio. The kernel driver for this chip was written by Nokia and is GPL'd open source. You can look at it by downloading the Maemo kernel source code.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;to FM radio. The kernel driver for this chip was written by Nokia and is GPL'd open source. You can look at it by downloading the Maemo kernel source code.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The driver implements the V4L2 radio interface and is thus controlled like a V4L2 device.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The driver implements the V4L2 radio interface and is thus controlled like a V4L2 device.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;== How to do it in Python &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== How to do it in Python ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;By using Python's &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; function, you can directly talk to the driver, so there is no need for wrapping some C library.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;By using Python's &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; function, you can directly talk to the driver, so there is no need for wrapping some C library.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;=== Prerequisites &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Prerequisites ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's first import the required modules:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Let's first import the required modules:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 74:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 72:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;=== Opening the device &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Opening the device ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You gain access to the radio driver by opening the &amp;lt;code&amp;gt;/dev/radio&amp;lt;/code&amp;gt; device. Since you need a system FD instead of a native Python FD, we use &amp;lt;code&amp;gt;os.open&amp;lt;/code&amp;gt; instead of the built-in function &amp;lt;code&amp;gt;open&amp;lt;/code&amp;gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You gain access to the radio driver by opening the &amp;lt;code&amp;gt;/dev/radio&amp;lt;/code&amp;gt; device. Since you need a system FD instead of a native Python FD, we use &amp;lt;code&amp;gt;os.open&amp;lt;/code&amp;gt; instead of the built-in function &amp;lt;code&amp;gt;open&amp;lt;/code&amp;gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 82:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If there's no tuner chip available (for example, if you run this code on the [[Nokia 770|770]] or the [[Nokia N810|N810]]), this line will throw an &amp;lt;code&amp;gt;OSError&amp;lt;/code&amp;gt;. Don't forget to catch it.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;If there's no tuner chip available (for example, if you run this code on the [[Nokia 770|770]] or the [[Nokia N810|N810]]), this line will throw an &amp;lt;code&amp;gt;OSError&amp;lt;/code&amp;gt;. Don't forget to catch it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;=== Retrieving information about the FM tuner &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Retrieving information about the FM tuner ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now it's time to talk to the FM tuner. We do this by placing an &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt;'' call on the device. &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; calls consist of a number (those we have defined above), and some argument. The argument is a pointer for passing a C structure to the driver. The driver may read from this structure or write into it.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now it's time to talk to the FM tuner. We do this by placing an &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt;'' call on the device. &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; calls consist of a number (those we have defined above), and some argument. The argument is a pointer for passing a C structure to the driver. The driver may read from this structure or write into it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 115:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 113:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We should save the &amp;lt;code&amp;gt;tuner_index&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;tuner_name&amp;lt;/code&amp;gt; for later, because this is how we address that particular tuner.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;We should save the &amp;lt;code&amp;gt;tuner_index&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;tuner_name&amp;lt;/code&amp;gt; for later, because this is how we address that particular tuner.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;=== Setting the frequency &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Setting the frequency ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next, we are going to tune into a radio station. For this, we have to set a frequency on the tuner. This is done by the V4L2 &amp;lt;code&amp;gt;_VIDIOC_G_FREQUENCY&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; invokation.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Next, we are going to tune into a radio station. For this, we have to set a frequency on the tuner. This is done by the V4L2 &amp;lt;code&amp;gt;_VIDIOC_G_FREQUENCY&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;ioctl&amp;lt;/code&amp;gt; invokation.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 143:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 141:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;=== Unmuting the tuner and setting the volume &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Unmuting the tuner and setting the volume ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You still do not hear anything from the radio. This is because the tuner is muted and its volume is set to 0. Let's change this:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;You still do not hear anything from the radio. This is because the tuner is muted and its volume is set to 0. Let's change this:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 182:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 180:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now you can listen to the radio.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Now you can listen to the radio.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;=== Cleaning up &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;===&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;=== Cleaning up ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you have finished listening to the radio, you should clean up and &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;When you have finished listening to the radio, you should clean up and &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 200:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 198:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;== Code ready for use &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;=&lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Code ready for use ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a pure Python module available for controlling the FM tuner. It is based on the information here. You can get it from [http://pyfmradio.garage.maemo.org the PyFMRadio project page].&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;There is a pure Python module available for controlling the FM tuner. It is based on the information here. You can get it from [http://pyfmradio.garage.maemo.org the PyFMRadio project page].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-04 18:18:34 --&gt;
&lt;/table&gt;</summary>
		<author><name>amigadave</name></author>	</entry>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=38598&amp;oldid=prev</id>
		<title>amigadave:&amp;#32;Programming FM radio moved to Programming N800 FM radio receiver: device-specific</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=38598&amp;oldid=prev"/>
				<updated>2010-09-14T09:31:56Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;a href=&quot;/Programming_FM_radio&quot; class=&quot;mw-redirect&quot; title=&quot;Programming FM radio&quot;&gt;Programming FM radio&lt;/a&gt; moved to &lt;a href=&quot;/Programming_N800_FM_radio_receiver&quot; title=&quot;Programming N800 FM radio receiver&quot;&gt;Programming N800 FM radio receiver&lt;/a&gt;: device-specific&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 09:31, 14 September 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;!-- diff generator: internal 2026-04-04 18:18:35 --&gt;
&lt;/table&gt;</summary>
		<author><name>amigadave</name></author>	</entry>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=38596&amp;oldid=prev</id>
		<title>amigadave:&amp;#32;wikify slightly, use &lt;source&gt;, add Category:Python</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=38596&amp;oldid=prev"/>
				<updated>2010-09-14T09:28:56Z</updated>
		
		<summary type="html">&lt;p&gt;wikify slightly, use &amp;lt;source&amp;gt;, add &lt;a href=&quot;/Category:Python&quot; title=&quot;Category:Python&quot;&gt;Category:Python&lt;/a&gt;&lt;/p&gt;
&lt;a href=&quot;http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;amp;diff=38596&amp;amp;oldid=33461&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>amigadave</name></author>	</entry>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=33461&amp;oldid=prev</id>
		<title>amigadave:&amp;#32;/* Introduction */ link to Nokia N800</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=33461&amp;oldid=prev"/>
				<updated>2010-04-26T09:19:07Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Introduction:&amp;#32;&lt;/span&gt; link to &lt;a href=&quot;/Nokia_N800&quot; title=&quot;Nokia N800&quot;&gt;Nokia N800&lt;/a&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 09:19, 26 April 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 5:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Introduction ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Introduction ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The N800 internet tablet features a tea5761 FM tuner chip for listening&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;[[Nokia &lt;/ins&gt;N800&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;|N800]] &lt;/ins&gt;internet tablet features a tea5761 FM tuner chip for listening&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;to FM radio. The kernel driver for this chip was written by Nokia and is GPL'd open source. You can look at it by downloading the Maemo kernel source code.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;to FM radio. The kernel driver for this chip was written by Nokia and is GPL'd open source. You can look at it by downloading the Maemo kernel source code.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-04 18:18:36 --&gt;
&lt;/table&gt;</summary>
		<author><name>amigadave</name></author>	</entry>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=28342&amp;oldid=prev</id>
		<title>amigadave:&amp;#32;fix category</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=28342&amp;oldid=prev"/>
				<updated>2010-02-04T13:14:40Z</updated>
		
		<summary type="html">&lt;p&gt;fix category&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:14, 4 February 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 195:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 195:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Development]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Development]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;N800&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;N8x0&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Midgard wiki]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Midgard wiki]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-04 18:18:36 --&gt;
&lt;/table&gt;</summary>
		<author><name>amigadave</name></author>	</entry>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=28341&amp;oldid=prev</id>
		<title>amigadave:&amp;#32;add N800 category</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=28341&amp;oldid=prev"/>
				<updated>2010-02-04T13:14:14Z</updated>
		
		<summary type="html">&lt;p&gt;add N800 category&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 13:14, 4 February 2010&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 195:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 195:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Development]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Development]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;[[Category:N800]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Midgard wiki]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[Category:Midgard wiki]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-04 18:18:36 --&gt;
&lt;/table&gt;</summary>
		<author><name>amigadave</name></author>	</entry>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=9159&amp;oldid=prev</id>
		<title>dneary:&amp;#32;/* Introduction */</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=9159&amp;oldid=prev"/>
				<updated>2008-12-03T21:14:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Introduction&lt;/span&gt;&lt;/p&gt;

		&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;col class='diff-marker' /&gt;
		&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:14, 3 December 2008&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{Midgard article}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{Midgard article}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 6:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The N800 internet tablet features a tea5761 FM tuner chip for listening&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The N800 internet tablet features a tea5761 FM tuner chip for listening&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;to FM radio. The kernel driver for this chip was written by Nokia and is GPL'd open source. You can look at it by downloading the &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;maemo &lt;/del&gt;kernel source code.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;to FM radio. The kernel driver for this chip was written by Nokia and is GPL'd open source. You can look at it by downloading the &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Maemo &lt;/ins&gt;kernel source code.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The driver implements the V4L2 radio interface and is thus controlled like a V4L2 device.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The driver implements the V4L2 radio interface and is thus controlled like a V4L2 device.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del style=&quot;color: red; font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== How to do it in Python ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== How to do it in Python ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff generator: internal 2026-04-04 18:18:36 --&gt;
&lt;/table&gt;</summary>
		<author><name>dneary</name></author>	</entry>

	<entry>
		<id>http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=1353&amp;oldid=prev</id>
		<title>dneary:&amp;#32;Initial import of FM Radio programming</title>
		<link rel="alternate" type="text/html" href="http://bugs.maemo.com/index.php?title=Programming_N800_FM_radio_receiver&amp;diff=1353&amp;oldid=prev"/>
				<updated>2008-06-11T09:53:36Z</updated>
		
		<summary type="html">&lt;p&gt;Initial import of FM Radio programming&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
{{Midgard article}}&lt;br /&gt;
&lt;br /&gt;
= How to control the FM tuner chip in the N800 =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The N800 internet tablet features a tea5761 FM tuner chip for listening&lt;br /&gt;
to FM radio. The kernel driver for this chip was written by Nokia and is GPL'd open source. You can look at it by downloading the maemo kernel source code.&lt;br /&gt;
&lt;br /&gt;
The driver implements the V4L2 radio interface and is thus controlled like a V4L2 device.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to do it in Python ==&lt;br /&gt;
&lt;br /&gt;
By using Pythons `ioctl` function, you can directly talk to the driver, so there's no need for wrapping some C library.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Prerequisites ===&lt;br /&gt;
&lt;br /&gt;
Let's first import the required modules:&lt;br /&gt;
&lt;br /&gt;
    import os                 # for opening the device files&lt;br /&gt;
    import struct             # for packing and unpacking C structs&lt;br /&gt;
    from fcntl import ioctl   # for invoking ioctl calls on the device files&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Since we are going to talk to kernel drivers, we have to use weird numbers. C users would just include the appropriate Linux kernel header files, but Python users have to do it by hand. So let's make some defines for kernel level ioctl stuff:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    # kernel definitions for ioctl commands&lt;br /&gt;
    _IOC_NRBITS   = 8&lt;br /&gt;
    _IOC_TYPEBITS = 8&lt;br /&gt;
    _IOC_SIZEBITS = 14&lt;br /&gt;
    _IOC_DIRBITS  = 2&lt;br /&gt;
    &lt;br /&gt;
    _IOC_NRSHIFT   = 0&lt;br /&gt;
    _IOC_TYPESHIFT = _IOC_NRSHIFT + _IOC_NRBITS&lt;br /&gt;
    _IOC_SIZESHIFT = _IOC_TYPESHIFT + _IOC_TYPEBITS&lt;br /&gt;
    _IOC_DIRSHIFT  = _IOC_SIZESHIFT + _IOC_SIZEBITS&lt;br /&gt;
    &lt;br /&gt;
    _IOC_WRITE = 1&lt;br /&gt;
    _IOC_READ  = 2&lt;br /&gt;
    &lt;br /&gt;
    _IOC = lambda d,t,nr,size: (d &amp;lt;&amp;lt; _IOC_DIRSHIFT) | (ord(t) &amp;lt;&amp;lt; _IOC_TYPESHIFT) | \&lt;br /&gt;
        (nr &amp;lt;&amp;lt; _IOC_NRSHIFT) | (size &amp;lt;&amp;lt; _IOC_SIZESHIFT)&lt;br /&gt;
    _IOW  = lambda t,nr,size: _IOC(_IOC_WRITE, t, nr, size)&lt;br /&gt;
    _IOR  = lambda t,nr,size: _IOC(_IOC_READ, t, nr, size)&lt;br /&gt;
    _IOWR = lambda t,nr,size: _IOC(_IOC_READ | _IOC_WRITE, t, nr, size)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The functions ''_IOW'', ''_IOR'', and ''_IOWR'' (macros in C) are used for write-access, read-access, and read-write-access, respectively. They basically just take some input values and compute a number which can be sent to the device driver. You can think of the number as the signature of the function which you want to call on the driver.&lt;br /&gt;
&lt;br /&gt;
Now we can generate those weird numbers for the V4L2 functions we are&lt;br /&gt;
going to invoke on the driver:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    # V4L2 stuff for accessing the tuner driver&lt;br /&gt;
    _VIDIOC_G_TUNER     = _IOWR('V', 29, 84)&lt;br /&gt;
    _VIDIOC_G_AUDIO     = _IOR ('V', 33, 52)&lt;br /&gt;
    _VIDIOC_S_AUDIO     = _IOW ('V', 34, 52)&lt;br /&gt;
    _VIDIOC_G_FREQUENCY = _IOWR('V', 56, 44)&lt;br /&gt;
    _VIDIOC_S_FREQUENCY = _IOW ('V', 57, 44)&lt;br /&gt;
    _VIDIOC_G_CTRL      = _IOWR('V', 27, 8)&lt;br /&gt;
    _VIDIOC_S_CTRL      = _IOWR('V', 28, 8)&lt;br /&gt;
&lt;br /&gt;
    # user-class control IDs defined by V4L2&lt;br /&gt;
    _V4L2_CTRL_CLASS_USER = 0x00980000&lt;br /&gt;
    _V4L2_CID_BASE        = _V4L2_CTRL_CLASS_USER | 0x900&lt;br /&gt;
    _V4L2_CID_AUDIO_MUTE  = _V4L2_CID_BASE + 9&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And last, let's define some numbers for working with the mixer device:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    # mixer control constants&lt;br /&gt;
    _SOUND_MIXER_FMRADIO         = 0x06&lt;br /&gt;
    _SOUND_MIXER_READ            = 0x80044D00&lt;br /&gt;
    _SOUND_MIXER_WRITE           = 0xC0044D00&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Opening the device ===&lt;br /&gt;
&lt;br /&gt;
You gain access to the radio driver by opening the ''/dev/radio''&lt;br /&gt;
device. Since you need a system FD instead of a native Python FD, we use&lt;br /&gt;
''os.open'' instead of the built-in function ''open'':&lt;br /&gt;
&lt;br /&gt;
    radio_fd = os.open(&amp;quot;/dev/radio&amp;quot;, os.O_RDONLY)&lt;br /&gt;
&lt;br /&gt;
If there's no tuner chip available (e.g. if you run this code on the 770 or the N810), this line will throw an `OSError`. Don't forget to catch it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Retrieving information about the FM tuner ===&lt;br /&gt;
&lt;br /&gt;
Now it's time to talk to the FM tuner. We do this by placing an ''ioctl'' call on the device. ''ioctl'' calls consist of a number (those we have defined above), and some argument. The argument is a pointer for passing a C structure to the driver. The driver may read from this structure or write into it.&lt;br /&gt;
&lt;br /&gt;
A C structure can be built in Python with the ''struct'' module. Because the following ''ioctl'' call only retrieves information from the driver, we may provide an empty structure of the right size, like this:&lt;br /&gt;
&lt;br /&gt;
    info = struct.pack(&amp;quot;84x&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Let's place the ''ioctl'' call, and retrieve the results. For unpacking the&lt;br /&gt;
structure, we have to provide the correct format string (see ''help(struct)'' for details):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    data = ioctl(radio_fd, _VIDIOC_G_TUNER, info)&lt;br /&gt;
    &lt;br /&gt;
    # unpack the C struct&lt;br /&gt;
    fields = struct.unpack(&amp;quot;L32sLLLLLLll4L&amp;quot;, data)    &lt;br /&gt;
    tuner_index = fields[0]&lt;br /&gt;
    tuner_name = fields[1]&lt;br /&gt;
    tuner_type = fields[2]&lt;br /&gt;
    capability = fields[3]&lt;br /&gt;
    rangelow = fields[4]&lt;br /&gt;
    rangehigh = fields[5]&lt;br /&gt;
    rxsubchans = fields[6]&lt;br /&gt;
    audmode = fields[7]&lt;br /&gt;
    signal = fields[8]&lt;br /&gt;
    afc = fields[9]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We should save the ''tuner_index'' and ''tuner_name'' for later, because this is how we address that particular tuner.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Setting the frequency ===&lt;br /&gt;
&lt;br /&gt;
Next, we are going to tune into a radio station. For this, we have to set a frequency on the tuner. This is done by the V4L2 ''_VIDIOC_G_FREQUENCY'' ''ioctl'' invokation.&lt;br /&gt;
&lt;br /&gt;
But a word of warning first: the driver doesn't take the frequency in KHz. You have to multiply your value with a constant factor first. The factor is either 0.016 or 16, depending on the device driver. On the N800, it is 16:&lt;br /&gt;
&lt;br /&gt;
    FREQ_FACTOR = 16&lt;br /&gt;
&lt;br /&gt;
We are going to tune into 107.6 MHz now:&lt;br /&gt;
&lt;br /&gt;
    freq = 107600 * FREQ_FACTOR&lt;br /&gt;
&lt;br /&gt;
Set up the C structure to pass to the driver:&lt;br /&gt;
&lt;br /&gt;
    data = struct.pack(&amp;quot;LLL8L&amp;quot;, tuner_index, tuner_type, freq, 0, 0, 0, 0, 0, 0, 0, 0)&lt;br /&gt;
&lt;br /&gt;
Pass it to the driver:&lt;br /&gt;
&lt;br /&gt;
    ioctl(radio_fd, _VIDIOC_S_FREQUENCY, data)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Unmuting the tuner and setting the volume ===&lt;br /&gt;
&lt;br /&gt;
You still don't hear anything from the radio. This is because the tuner is muted and its volume is set to 0. Let's change this:&lt;br /&gt;
&lt;br /&gt;
Unmuting is easy:&lt;br /&gt;
&lt;br /&gt;
    data = struct.pack(&amp;quot;Ll&amp;quot;, _V4L2_CID_AUDIO_MUTE, 0)&lt;br /&gt;
    ioctl(radio_fd, _VIDIOC_S_CTRL, data)&lt;br /&gt;
&lt;br /&gt;
Changing the volume requires us to open the mixer device:&lt;br /&gt;
&lt;br /&gt;
    mixer_fd = os.open(&amp;quot;/dev/mixer&amp;quot;, os.O_RDONLY)&lt;br /&gt;
&lt;br /&gt;
Now we can set the volume for the left and right speaker:&lt;br /&gt;
&lt;br /&gt;
    left_volume = 50&lt;br /&gt;
    right_volume = 50&lt;br /&gt;
&lt;br /&gt;
... and send it to the driver:&lt;br /&gt;
&lt;br /&gt;
    data = struct.pack(&amp;quot;bb&amp;quot;, left_volume, right_volume)&lt;br /&gt;
    ioctl(mixer, _SOUND_MIXER_WRITE | _SOUND_MIXER_FMRADIO, data)&lt;br /&gt;
&lt;br /&gt;
Don't forget to close the mixer device after this:&lt;br /&gt;
&lt;br /&gt;
    os.close(mixer_fd)&lt;br /&gt;
&lt;br /&gt;
Now you can listen to the radio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Cleaning up ===&lt;br /&gt;
&lt;br /&gt;
When you have finished listening to the radio, you should clean up and &lt;br /&gt;
close the device again.&lt;br /&gt;
&lt;br /&gt;
It's important to mute the radio, or you will hear it forever.&lt;br /&gt;
&lt;br /&gt;
    data = struct.pack(&amp;quot;Ll&amp;quot;, _V4L2_CID_AUDIO_MUTE, 1)&lt;br /&gt;
    ioctl(radio_fd, _VIDIOC_S_CTRL, data)&lt;br /&gt;
&lt;br /&gt;
And don't forget to close the device:&lt;br /&gt;
&lt;br /&gt;
    os.close(radio_fd)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Code ready for use ==&lt;br /&gt;
&lt;br /&gt;
There is a pure Python module available for controlling the FM tuner. It's based on the information here.&lt;br /&gt;
You can get it from [http://pyfmradio.garage.maemo.org the PyFMRadio project page].&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Midgard wiki]]&lt;/div&gt;</summary>
		<author><name>dneary</name></author>	</entry>

	</feed>