<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>logIt &#187; driver</title>
	<atom:link href="https://lakm.us/logit/tag/driver/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Compile USB Serial Modem Using option.c (Ubuntu on Beagleboard xM)</title>
		<link>https://lakm.us/logit/2012/01/compile-usb-serial-modem-using-option-c-ubuntu-on-beagleboard-xm/</link>
		<comments>https://lakm.us/logit/2012/01/compile-usb-serial-modem-using-option-c-ubuntu-on-beagleboard-xm/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 08:54:18 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[General Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[embedded system]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[modem]]></category>
		<category><![CDATA[OMAP3]]></category>
		<category><![CDATA[USB]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/it/?p=341</guid>
		<description><![CDATA[Despite possibility to use (1) $ modprobe -v usbserial vendor=0x05c6 product=0x0015 or (2) usb-modeswitch, (3) Matthias Urlichs initially wrote option.c driver as a way to insert USB modem as kernel module. This driver exists because the &#8220;normal&#8221; serial driver doesn&#8217;t work too well with GSM modems. Issues: - data loss &#8212; one single Receive URB [...]]]></description>
				<content:encoded><![CDATA[<p>Despite possibility to use (1)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ modprobe <span style="color: #660033;">-v</span> usbserial <span style="color: #007800;">vendor</span>=0x05c6 <span style="color: #007800;">product</span>=0x0015</pre></div></div>

<p>or (2) <code>usb-modeswitch</code>, (3) <a href="http://matthias.urlichs.de/">Matthias Urlichs</a> initially wrote <code>option.c</code> driver as a way to insert USB modem as kernel module.</p>
<blockquote><p>This driver exists because the &#8220;normal&#8221; serial driver doesn&#8217;t work too well<br />
with GSM modems. Issues:<br />
- data loss &#8212; one single Receive URB is not nearly enough<br />
- nonstandard flow (Option devices) control<br />
- controlling the baud rate doesn&#8217;t make sense</p></blockquote>
<p>Most modems will be successfully attached with this driver, appearing in one of the typical <code>/dev/ttyUSB0</code> to <code>/dev/ttyUSB2</code>. The product ID <code>0x0015</code> for GSM modem compiled here is a Qualcomm (vendor ID 0x05c6) OEM modem I received from <a href="http://www.armkits.com/product/devkit8500d.asp">Embest DevKit8500D</a> order. There are more than one form factor when searching for its images on Google. Closest one we have in Indonesia is ADVAN DT8-HT bundled in <a href="http://www.telkomsel.com/telkomselflash">Telkomsel Flash</a>.</p>
<div class="wp-caption aligncenter" style="width: 510px"><img alt="qualcomm-05c6-0015-telkomsel-advan.jpg" src="../../../../images/qualcomm-05c6-0015-telkomsel-advan.jpg" title="qualcomm-05c6-0015-telkomsel-advan.jpg" class="aligncenter" width="250" height="172" /><p class="wp-caption-text">Qualcomm 05c6:0015 from Indonesian operator</p></div>
<p>I&#8217;m compiling it for the <a href="http://beagleboard.org/hardware-xM">Beagleboard xM</a> Rev C running Ubuntu Oneiric (installed in <a href="../2011/12/ubuntu-on-beagleboard-xm-with-easycap-video-capture-compiling-driver">this post</a>). A quick look gives:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation <span style="color: #000000;">2.0</span> root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation <span style="color: #000000;">2.0</span> root hub
Bus 001 Device 002: ID 0424:<span style="color: #000000;">9514</span> Standard Microsystems Corp.
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 005: ID 05c6:0015 Qualcomm, Inc.</pre></div></div>

<p>The above <code>0x0015</code> product ID doesn&#8217;t exist inside <code>option.c</code> of linux <a href="https://launchpad.net/ubuntu/+source/linux/3.0.0-12.20">kernel 3.0.0-12 source</a>. Adding this to series of existing Qualcomm modems gives:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>635
636
637
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">	<span style="color: #7a0874; font-weight: bold;">&#123;</span> USB_DEVICE<span style="color: #7a0874; font-weight: bold;">&#40;</span>QUALCOMM_VENDOR_ID, 0x6000<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>, <span style="color: #000000; font-weight: bold;">/*</span> ZTE AC8700 <span style="color: #000000; font-weight: bold;">*/</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span> USB_DEVICE<span style="color: #7a0874; font-weight: bold;">&#40;</span>QUALCOMM_VENDOR_ID, 0x6613<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>, <span style="color: #000000; font-weight: bold;">/*</span> Onda H600<span style="color: #000000; font-weight: bold;">/</span>ZTE MF330 <span style="color: #000000; font-weight: bold;">*/</span>
	<span style="color: #7a0874; font-weight: bold;">&#123;</span> USB_DEVICE<span style="color: #7a0874; font-weight: bold;">&#40;</span>QUALCOMM_VENDOR_ID, 0x0015<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>, <span style="color: #000000; font-weight: bold;">/*</span> Qualcomm no brand <span style="color: #000000; font-weight: bold;">*/</span></pre></td></tr></table></div>

<p>The <code>include</code> also needs <code>usb-wwan.h</code> from that kernel source. Copy them both under  <code>/usr/src/linux-headers-3.0.6-x3/drivers/usb/serial/</code>. For other <code>include</code> files, install:</p>
<ol>
<li><a href="http://ports.ubuntu.com/ubuntu-ports/pool/main/l/linux/linux-headers-3.0.0-12_3.0.0-12.20_all.deb">linux-headers-3.0.0-12_3.0.0-12.20_all.deb</a></li>
<li><a href="https://launchpad.net/ubuntu/oneiric/armel/linux-image-3.0.0-12-omap/3.0.0-12.20">linux-image-3.0.0-12-omap_3.0.0-12.20_armel.deb</a></li>
</ol>
<p>and create this link as <code>root</code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>
$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.0-<span style="color: #000000;">12</span><span style="color: #000000; font-weight: bold;">/</span>arch<span style="color: #000000; font-weight: bold;">/</span>arm<span style="color: #000000; font-weight: bold;">/</span>mach-versatile<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>mach mach</pre></td></tr></table></div>

<p>After removing the old one (pointed to <code>build -> /build/buildd/linux-3.0</code>), create a link inside <code>/lib/modules/3.0.6-x3</code> named <code>build</code> pointing to:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">build -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3</pre></div></div>

<p>Modify the original <code>Makefile</code> to contain only rule for <code>option.o</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">obj-m			+= option.o</pre></div></div>

<p>and then build the driver</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-C</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>build<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #007800;">M</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>usb<span style="color: #000000; font-weight: bold;">/</span>serial<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>: Entering directory <span style="color: #000000; font-weight: bold;">`/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #ff0000;">'
  LD      /usr/src/linux-headers-3.0.6-x3/drivers/usb/serial/built-in.o
  CC [M]  /usr/src/linux-headers-3.0.6-x3/drivers/usb/serial/option.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /usr/src/linux-headers-3.0.6-x3/drivers/usb/serial/option.mod.o
  LD [M]  /usr/src/linux-headers-3.0.6-x3/drivers/usb/serial/option.ko
make: Leaving directory `/usr/src/linux-headers-3.0.6-x3`</span></pre></div></div>

<p>Copy the build and deploy</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>linux-headers-3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>usb<span style="color: #000000; font-weight: bold;">/</span>serial<span style="color: #000000; font-weight: bold;">/</span>option.ko <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>3.0.6-x3<span style="color: #000000; font-weight: bold;">/</span>kernel<span style="color: #000000; font-weight: bold;">/</span>drivers<span style="color: #000000; font-weight: bold;">/</span>usb<span style="color: #000000; font-weight: bold;">/</span>serial<span style="color: #000000; font-weight: bold;">/</span>
$ depmod <span style="color: #660033;">-a</span></pre></div></div>

<p>Now <code>syslog</code> will show the following lines if the modem is inserted:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4790.229888</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> usb <span style="color: #000000;">1</span>-<span style="color: #000000;">2.5</span>: GSM modem <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>-port<span style="color: #7a0874; font-weight: bold;">&#41;</span> converter now attached to ttyUSB0
kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4790.237121</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> option <span style="color: #000000;">1</span>-<span style="color: #000000;">2.5</span>:<span style="color: #000000;">1.0</span>: GSM modem <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>-port<span style="color: #7a0874; font-weight: bold;">&#41;</span> converter detected
kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4790.238250</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> usb <span style="color: #000000;">1</span>-<span style="color: #000000;">2.5</span>: GSM modem <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>-port<span style="color: #7a0874; font-weight: bold;">&#41;</span> converter now attached to ttyUSB1
kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4790.240142</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> option <span style="color: #000000;">1</span>-<span style="color: #000000;">2.5</span>:<span style="color: #000000;">1.1</span>: GSM modem <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>-port<span style="color: #7a0874; font-weight: bold;">&#41;</span> converter detected
kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4790.241210</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> usb <span style="color: #000000;">1</span>-<span style="color: #000000;">2.5</span>: GSM modem <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span>-port<span style="color: #7a0874; font-weight: bold;">&#41;</span> converter now attached to ttyUSB2
mtp-probe: checking bus <span style="color: #000000;">1</span>, device <span style="color: #000000;">9</span>: <span style="color: #ff0000;">&quot;/sys/devices/platform/usbhs-omap.0/ehci-omap.0/usb1/1-2/1-2.5&quot;</span>
mtp-probe: bus: <span style="color: #000000;">1</span>, device: <span style="color: #000000;">9</span> was not an MTP device
kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4791.227294</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> scsi <span style="color: #000000;">2</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>: Direct-Access     Qualcomm MMC Storage      <span style="color: #000000;">2.31</span> PQ: <span style="color: #000000;">0</span> ANSI: <span style="color: #000000;">2</span>
kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4791.232238</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> sd <span style="color: #000000;">2</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>: Attached scsi generic sg0 <span style="color: #7a0874; font-weight: bold;">type</span> <span style="color: #000000;">0</span>
kernel:<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000;">4791.246887</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> sd <span style="color: #000000;">2</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>: <span style="color: #7a0874; font-weight: bold;">&#91;</span>sda<span style="color: #7a0874; font-weight: bold;">&#93;</span> Attached SCSI removable disk</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/01/compile-usb-serial-modem-using-option-c-ubuntu-on-beagleboard-xm/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
