<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://www.datenfreihafen.org/~stefan/weblog/"?>
<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Filed under: linux | My place to share some bits and bytes</title>
<atom:link href="http://www.datenfreihafen.org/~stefan/weblog/archives/linux/index-rss.xml" rel="self" type="application/rss+xml" />
<link>http://www.datenfreihafen.org/~stefan/weblog</link>
<description>datenfreihafen.org, linux, and computer science.</description>
<dc:language>en-us</dc:language>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:date>2010-05-10T12:31:20+02:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2010/05/index.html#e2010-05-10T12_31_03.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2010/05/index.html#e2010-05-10T12_31_03.txt</guid>
<title>Towards a dfu-util 0.1 release</title>
<dc:date>2010-05-10T12:31:03+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>linux, openmoko</dc:subject>
<description>
<![CDATA[<p>We are making good progress towards a first release of dfu-util. Harald was kind
enough to prepare a subdomain for it under <a href="http://gnumonks.org/">gnumonks.org</a>
and I already setup a simple <a href="http://dfu-util.gnumonks.org/">website</a>, a <a href="http://git.openezx.org/dfu-util.git">git
repo</a> with the complete svn history imported
and pushed out a <a href="http://dfu-util.gnumonks.org/releases/dfu-util-0.1-rc1.tar.gz">release
candidate</a> for 0.1.</p>
<p>If no show-stopper crosses my way I will make the release Sunday 2010-05-23. Once
this is done I will try to make sure that this release replaces the various svn
snapshots distros have already packaged while waiting for a real release.</p>
<p>This is of course only the first step. On my agenda is better support for other
hardware, more DFU 1.0 compliance and support for the changes from DFU 1.1. Next
to this improvements I'm also thinking about the ecosystem around DFU on
embedded linux systems. Getting the DFU u-boot patches fixed and merged would be
a nice target as well. Be warned though that this will progress slowly as it is
just one of my spare time projects and has to compete with others.</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2010/05/index.html#e2010-05-07T11_51_50.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2010/05/index.html#e2010-05-07T11_51_50.txt</guid>
<title>Playing with 802.15.4 under linux</title>
<dc:date>2010-05-07T11:51:50+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>linux, computer science</dc:subject>
<description>
<![CDATA[<p>Until recently I had not much interest to play with the low-rate wireless
personal area networks, thats what the formal description of
<a href="http://standards.ieee.org/getieee802/download/802.15.4-2006.pdf">802.15.4</a> is.
Often it is also referenced as ZigBee, but while Zigbee is based on it it adds some
more layers on top which I'm not going to play with.</p>
<p>The main reason why I so far had not much interest in 802.15.4 is that it was
almost always used in small micro-controller based systems. While I understand
that for low power consumption products like sensor network nodes it is the
right approach I never felt like I would enjoy to work on such systems.</p>
<p>In my study thesis I'm doing right now I have to get <a href="http://www.rfc-editor.org/rfc/rfc5050.txt">delay tolerant
networking</a>
working over a 802.15.4 link. For this I'm using a setup with two
<a href="http://www.xbow.com/Products/productdetails.aspx?sid=253">iMote2</a> boards
which are based on a powerful PXA27x SoC and are able to run linux. The linux
port of the board was already in a really good shape and already included in the
mainline kernel which gave me a good base to work from.</p>
<p>On the board is a Chipcon <a href="http://focus.ti.com/docs/prod/folders/print/cc2420.html">CC2420 802.15.4 RF
transceiver</a> which
connected over SPI with some additional GPIO and IRQ lines. The linux kernel
already is prepared with a <a href="http://sourceforge.net/apps/trac/linux-zigbee/">802.15.4
stack</a> and luckily there was
already posted a driver for the cc2420 which I had to bug fix it a bit over the
last weeks. All my changes are already in, or on the way to, the linux zigbee tree
which contains the mac802154 layer for the driver. This layer had not made its way
upstream yet, but I hope that will happen within the next 2 or 3 release cycles.
Next step on my agenda is to make it work with
<a href="http://www.ibr.cs.tu-bs.de/projects/ibr-dtn/">ibrdtn</a>.</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2010/04/index.html#e2010-04-26T12_30_18.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2010/04/index.html#e2010-04-26T12_30_18.txt</guid>
<title>Angular rate driver work finished</title>
<dc:date>2010-04-26T12:30:18+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>linux, openmoko, freelancer</dc:subject>
<description>
<![CDATA[<p>Last week I finished the contract work for the angular rate drivers I mentioned in
my last post.</p>
<p>During the final meeting we also verified that the output of the sensors are
what we expect them to be. While coding them I was able to check that I'm using
the right registers, values are changing when I turn the device, but I had no
test equipment to see if the measurement is really correct.</p>
<p>At the DLR we could use an angular rate table for this. The device itself was
mounted on the rotating table with power and data connection on sliding
contacts. Some pictures of the setup can be found
<a href="http://www.datenfreihafen.org/~stefan/DLR/Drehtisch/">here</a>.</p>
<p>From the measurement point the MLX90609 and the SAR100 variant we used are quite
different. The MLX is capable of 300 degree per second while the SAR100 was able
to measure 1500. In our test we even had good results with 1800. During this
testing we found a bit different offsets as described in the data sheets but
still pretty close to what we expected.</p>
<p>I'm really looking forward to the launch of the rocket to hear about the results
the sensors produced and how it compares to the big money equipment that it used for
the flight control of the rocket. Once the rocket is back and the data is
analyzed I also should be able to get a board back and do my part on getting the
drivers into mainline. For now I have posted them as demo to the openmoko kernel
list.</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2010/02/index.html#e2010-02-28T15_40_36.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2010/02/index.html#e2010-02-28T15_40_36.txt</guid>
<title>Freerunner preparing for his second outer space trip</title>
<dc:date>2010-02-28T15:40:36+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>linux, openmoko, freelancer</dc:subject>
<description>
<![CDATA[<p><img src="http://www.datenfreihafen.org/~stefan/DLR/IMG_2557-small.JPG"
alt="Freerunner with case" align="left" hspace="10" vspace="0">
In May last year the Freerunner had its debut in outer space. The <a href="http://www.dlr.de/rb/desktopdefault.aspx/tabid-4711/7804_read-12180/">Mobile Rocket Base</a>
department of the <a href="http://www.dlr.de/en/desktopdefault.aspx">German Aerospace Center</a>
<a href="http://www.dlr.de/en/desktopdefault.aspx/tabid-1/86_read-17565/">launched</a> a
research rocket into the aerospace (140Km height). On board was the pictured
Freerunner. Although the metal case you can see on the picture is new and was
not used.</p>
<p>The mission of the rocket was to experiment with materials physics under
conditions of weightlessness. The Freerunner had nothing to do with this
experiments and was only on board to verify that it survives the launch, travel and
landing. Battery, GSM and GPS antenna has been removed before launch. Everything
survived. During the flight the accelerometers have been used to collect
measurements.</p>
<p>In May this year it will enjoy its second trip into space. The case was designed
and build to offer space for the Freerunner as well as an extension board
connected to it. The board is connected to the debug board connector of
the Freerunner which offers a SPI and an I2C bus. It was designed to hold
different sensors the Freerunner does not offer and is equipped
with a <a href="http://www.bosch-sensortec.com/content/language1/downloads/BMP085_DataSheet_Rev.1.0_01July2008.pdf">BMP085 pressure sensor</a>
and two gyroscopes. The <a href="http://melexis.com/Sensor_ICs_Inertia/General/MLX90609_582.aspx">Melexis MLX90609</a> and
the <a href="http://www.sensonor.com/gyro-products/gyro-sensors/high-performance/sar100.aspx">Sensonor SAR100</a>.</p>
<img src="http://www.datenfreihafen.org/~stefan/DLR/IMG_2530-small.JPG"
alt="Freerunner with board" align="right" hspace="10" vspace="0">

<p>Over the next month I'll working on drivers for these two gyroscopes and after
the flight we will see if the chips survived and if the data they had produced will
show that they are good enough for further testing.</p>
<p>All in all this shows pretty nicely how an open device with available
schematics, CAD files and hardware interfaces can serve together with an open
software stack for vertical markets. Be it for research purpose like in this case
or a crazy business idea on the other side. The fact that you have all resources
to understand the electrical design as well as being able to make changes over
the complete software stack brings you into the position to easily adapt it for
your needs.</p>
<p>Some more picture with a higher resolution can be found
<a href="http://www.datenfreihafen.org/~stefan/DLR/">here</a>.
<br />
<br />
UPDATE: Fix typos and rewrite some parts so people have a chance to understand
it.</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2009/12/index.html#e2009-12-15T15_00_23.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2009/12/index.html#e2009-12-15T15_00_23.txt</guid>
<title>Linux support for Intel Corporation Turbo Memory Controller, ever?</title>
<dc:date>2009-12-15T15:00:23+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>Thinkpad X200s, linux</dc:subject>
<description>
<![CDATA[<p>Over a year ago I wrote a
<a href="http://lkml.indiana.edu/hypermail/linux/kernel/0812.0/01887.html">mail</a> to LKML
asking about Linux support for the turbo memory controller. All I got was
silence.</p>
<p>It really should not be more then a NAND flash controller with the flash
attached to it. I wonder what the problem is here. Neither the really active
kernel hackers form the Intel Open Source Labs are giving any comment on it nor
is any kind of documentation available for it. At least none that I was able to
find.</p>
<p>I'm well aware that it is marketed as Windows Vista, and now Windows 7, only,
but to be frank, its hardware. There is no technical limitation to write a
driver for it.</p>
<p>Given that I heard once that Intel has a great rule in place that there needs to
be a good reason if <em>no</em> GPL driver is available for Intel hardware I wonder
what is the blocker here. If it is no technical reason it must be something
else. A completely wild guess would be that Microsoft is paying for the
exclusive rights and active harm of other systems. I thought we were behind such
things. Anyone knows more and wants to enlighten me?</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-25T16_50_12.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-25T16_50_12.txt</guid>
<title>NEON (simd) based resampler from Palm for pulseaudio</title>
<dc:date>2009-06-25T16:50:12+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>linux</dc:subject>
<description>
<![CDATA[<p>Interested piece of information we just stumpled over is that the pulseaudio
<a href="http://palm.cdnetworks.net/opensource/1.0.1/pulseaudio-0.9.14-patch.gz">patch</a>
for the Palm Pre does contain a resampler module using the NEON support of the
OMAP device. Strange to read, but should give them a good performance:</p>
<pre>
+#ifdef __ARM_NEON__
+
+int16_t fir_simd(int16_t *x, int16_t *h, unsigned taps)
+{
+       int32_t sum;
+       int16x4_t h_vec, x_vec;
+       int32x4_t result_vec;
+   unsigned i;
+   
+   /* Clear the scalar and vector sums */
+    result_vec = vdupq_n_s32(0);
+
+    h_vec = vld1_s16(h);
+    x_vec = vld1_s16(x);
+    result_vec = vmlal_s16(result_vec, h_vec, x_vec);
+      
+    h_vec = vld1_s16(h + 4);
+    x_vec = vld1_s16(x + 4);
+    result_vec = vmlal_s16(result_vec, h_vec, x_vec);  
+
+    h_vec = vld1_s16(h + 8);
+    x_vec = vld1_s16(x + 8);
+    result_vec = vmlal_s16(result_vec, h_vec, x_vec);  
+
+    h_vec = vld1_s16(h + 12);
+    x_vec = vld1_s16(x + 12);
+    result_vec = vmlal_s16(result_vec, h_vec, x_vec);  
+      
+    h_vec = vld1_s16(h + 16);
+    x_vec = vld1_s16(x + 16);
+    result_vec = vmlal_s16(result_vec, h_vec, x_vec);  
+
+    h_vec = vld1_s16(h + 20);
+    x_vec = vld1_s16(x + 20);
+    result_vec = vmlal_s16(result_vec, h_vec, x_vec);  
+
+   /* Reduction operation - add each vector lane result to the sum */
+    sum = vgetq_lane_s32(result_vec, 0);
+    sum += vgetq_lane_s32(result_vec, 1);
+    sum += vgetq_lane_s32(result_vec, 2);
+    sum += vgetq_lane_s32(result_vec, 3);
+      
+   /* consume the last few data using scalar operations */
+   if(i > 24) {
+       h += 24;
+       x += 24;
+       sum += *h++ * *x++;
+       sum += *h++ * *x++;
+       sum += *h++ * *x++;
+       sum += *h * *x;
+   }
.....
</pre>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-24T08_40_20.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-24T08_40_20.txt</guid>
<title>Compile a kernel for the Palm Pre</title>
<dc:date>2009-06-24T08:40:20+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>openembedded, linux</dc:subject>
<description>
<![CDATA[<p>I just did a test compile of the Palm Pre kernel using the released sources.
Worked out fine. At least the patching and compiling, no real tests without the
hardware.</p>
<p>I took the kernel package and patch from the Palm open source website and used a
toolchain built by OpenEmbedded for the beagleboard. Using OMAP3 and armv7a
should match here.</p>
<p>The 2.6.24 kernel package itself while renamed has the same MD5 and SHA1 sum as
the original tarball from kernel.org (tar.gz, plain 2.6.24 no stable version).</p>
<p>The 9.5 MB patch applied fine and using the omap_sirloin_3430_defconfig as
config let me compile a zImage without problems. Another developer seem to have
tested a selfcompiled kernel, should match mine, already. Hopefully we can
expect some updates <a href="http://predev.wikidot.com/custom-kernels">here</a>.</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-14T02_15_53.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-14T02_15_53.txt</guid>
<title>Hacking on the Samsung SGH-i900 Omnia Phone</title>
<dc:date>2009-06-14T02:15:53+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>omnia, linux</dc:subject>
<description>
<![CDATA[<p>I continue my work on different phones and phone platforms. Last monday I
received a Samsung SGH-i900 Omnia device for some initial Linux hacking and
especially trying to figure out how the modem interface is working.</p>
<p>It was an interesting adventure so far. :)</p>
<p>I updated Harald's initial
<a href="http://gnufiish.org/trac/wiki/Samsung_Omnia">findings</a> with some new facts and
corrections. In a nutshell the device looks like this:</p>
<ul>
<li>Application Processor: 624MHz Marvell PXA312, probably a PXA310 with NAND</li>
<li>(256MB) + DDR (128MB) in one package</li>
<li>GSM/UMTS Modem: Qualcomm MSM6281, interfaced via dual-ported RAM</li>
<li>Wifi: Marvell 8686 (SDIO on mmc2)</li>
<li>Bluetooth: CSR 41814</li>
<li>8/16 GB external SD flash (on mmc1)</li>
<li>Audio Codec / Touchscreen: Wolfson WM9713</li>
<li>Screen: 240x400 pixels, 3.2"</li>
<li>5MP Sony IMX034 camera with LED flash</li>
<li>Bosch Sensortec BMA020 Accelerometer</li>
<li>Ambient light sensor</li>
</ul>
<p>We have linux mainline support for the PXA312, Marvell 8686 wifi, CSR bluetooth
and the WM9713 audio codec and touchscreen combination. That's a nice start.
Given the fact that the device seems to be pretty near to what the Marvell
zylonite reference design is doing an initial linux port should be pretty
straight forward. I gave it a shot and it really worked out pretty smooth for
the initial bits.
<a href="http://marc.info/?l=linux-arm-kernel&amp;m=124493504823473&amp;w=2">Patch</a> for
inclusion just sent. I can boot into a rootfs on the microSD card with this,
including working framebuffer. :)</p>
<p>To get more informations about a windows mobile based system Haret is the tool
of choice. Naturally I used it to gather some more informations about which
GPIOs are connected to what, power up and down sequences of different chips,
etc. On the other hand Haret had PXA support up to PXA27x so far. That works not
that bad, but the IRQ and clock register have changed a lot. Thanks to Marvell
the PXA3xx data-sheet are public available. Based on that I started some initial
<a href="http://handhelds.org/hypermail/haret/current/1860.html">PXA3xx support for
Haret</a>. Not finished,
but helped me already a bit on understanding the Omnia system.</p>
<p>I also started to investigate the modem interface, which is still the primary
goal here. The MSM6xxx modem chips are used in other Samsung devices and the A
(for CDMA) variant is also used in the new Palm Pre. Getting support for this
modem into linux would help a lot on the open phone front.</p>
<p>The modem is connected to one side of a dual port ram chip. The other side
interfaces to the PXA SoC. Next to this we have at least one GPIO connected for
power up and down. I should have found that one with haret watching GPIO changes
when powering the modem on and off in windows mobile. What I don't know yet is
if there are other GPIOs for out of band signaling when the ram buffers are
filed, etc. Future will tell.</p>
<p>What blocks my work on the modem is the non-functional USB device controller.
Without is I can't get a shell on the device, which makes the testing and
debugging pretty hard. Getting this blocker out of my way the next big item
on my list. I may also get a connector that features JTAG and serial console for
the device. That would of course also helps a lot.</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-10T18_35_59.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2009/06/index.html#e2009-06-10T18_35_59.txt</guid>
<title>Garret about the Palm Pre system</title>
<dc:date>2009-06-10T18:35:59+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>openembedded, linux, openmoko</dc:subject>
<description>
<![CDATA[<p>Matthew Garret is blogging about the Linux based <a href="http://mjg59.livejournal.com/111453.html">Palm Pre
system</a>.</p>
<p>I like a lot what I read there. Linux Kernel, OpenEmbedded, dbus based IPC, OMAP
SoC, root on SD and more. I would design it mostly the same way. Wait, I'm missing 300
develoeprs and 300 Millions vanture capital here. To bad.</p>
<p>Really waiting for the kernel sources. It is using a MSM6xxx based modem for
CDMA and I would bet just the brother, perhaps MSM6281 like the Samsung Omnia,
for the GSM variant. As I'm hacking on the Omnia right know I would of cours be
interested in a kernel driver to drive the modem. On the Omnia it is connected
via a dual port ram chip that interfaces to the PXA312 on the other side.</p>
<p>This also is kinda similar to the MSM7k SoC's that are used in the available
Android phones. Just that AP, ram and BP are in the same chip here.</p>
<p>And the driver for the CDMA modem should also be pretty similar to the GSM
variant. That gives me a little hope that maybe a driver for such a dual port
ram setup will be in the Palm Pre kernel sources. Let me know if you have
details here.</p>]]>
</description>
</item>
<item>
<link>http://www.datenfreihafen.org/~stefan/weblog/archives/2008/12/index.html#e2008-12-13T03_46_41.txt</link>
<guid isPermaLink="true">http://www.datenfreihafen.org/~stefan/weblog/archives/2008/12/index.html#e2008-12-13T03_46_41.txt</guid>
<title>Using HSPA and GPS on my X200s</title>
<dc:date>2008-12-13T03:46:41+02:00</dc:date>
<dc:creator>Stefan Schmidt</dc:creator>
<dc:subject>Thinkpad X200s, linux</dc:subject>
<description>
<![CDATA[<p>Since some days I replaced my old Thinkpad T40p mobile workstation with a new
Thinkpad X200s. Higher performance, smaller form-factor, lighter, I'm happy with
it. :)</p>
<p>One feature that I wanted to have in my new notebook was a built-in 3G data
card. What I got was the Ericsson F3507g. It does not only have HSPA, with 7,2
MBit down and 2,0MBit up, but also a GPS reciever on the same MiniPCIe card.</p>
<p>The control of the GPS is done via AT commands. For this the card offer three serial
channels. Once you enabled GPS on one it will only act as NMEA channel after
this. Given you have three channels the logical way was to have one for the HSPA
data transfers, one for the GPS and the last one as control channel.</p>
<p>The basic commands for configuration and enabling the GPS can be found
<a href="http://www.thinkwiki.org/wiki/Ericsson_F3507g_Mobile_Broadband_Module">here</a>.
Sadly there seem to be no public documentation from Ericson on the proprietary AT
commands for the GPS. Ericson, can you please offer a description or even better
a datasheet for the chip it?</p>
<p>Anyone else can help out with more informations on this card? I'm interested in
all kind of details about configuration options for the GPS.</p>
<p>For now I'm using the following script to handle the gps and hspa enable and
disable. Not nice but working. FSO support is on the way and will get finished
when I find a spare cycle for it.</p>
<pre>
#!/bin/sh

# We have /dev/ttyACM{0,1,2}
# 0 is used from wvdial for the HSPA connection
NMEADEVICE=/dev/ttyACM1
CONTROLDEVICE=/dev/ttyACM2

## Check we have appropriate permissions
if [ `whoami` != "root" ]; then
    echo Run this script as root
    exit 0
fi

init_modem() {
    echo -n "Powering up WWAN device .."
    echo 1 > /sys/devices/platform/thinkpad_acpi/wwan_enable
    while [ ! -c $CONTROLDEVICE ]; do sleep 0.5; echo -n "."; done
    echo " OK"

echo -n "Initialising WWAN modem ..."
    /usr/sbin/chat -v "" "AT+CFUN=1" "+PACSP0" "AT" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"
}

exit_modem() {
    echo -n "Shutting down WWAN modem ..."
    /usr/sbin/chat -v "" "AT+CFUN=4" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"

## Disable the WWAN hardware, save power
    echo -n "Powering down WWAN device .."
    echo 0 > /sys/devices/platform/thinkpad_acpi/wwan_enable
    while [ -c $CONTROLDEVICE ]; do sleep 0.5; echo -n "."; done
    echo " OK"
}

start_hspa() {
    echo "Starting PPP -- hit Ctrl+C when finished"
    /usr/bin/wvdial 3G
    #/usr/bin/wvdial Vodafone
}

start_gps() {
    # Enable NMEA, every 3 seconds, enable DGPS
    echo -n "Configure GPS ..."
    /usr/sbin/chat -v "" "AT*E2GPSCTL=1,3,1" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"

echo "Starting GPS -- hit Ctrl+C when finished"

# Fire up NMEA stream
    #/usr/sbin/chat -v "" "AT*E2GPSNPD" "FOOBAR" > $CONTROLDEVICE < $CONTROLDEVICE
    echo -en 'AT*E2GPSNPD\r\n' > $NMEADEVICE

/etc/init.d/gpsd stop
    /etc/init.d/gpsd start
}

stop_gps() {
    echo -n "Shutting down GPS..."
    /usr/sbin/chat -v "" "AT*E2GPSCTL=0,3,1" "OK" > $CONTROLDEVICE < $CONTROLDEVICE
    echo " OK"
}

case "$1" in
    hspa)
        init_modem
        start_hspa
        exit_modem
        ;;
    gps)
        init_modem
        start_gps
        # A bit hacky to wait for a ^C
        sleep 7d
        stop_gps
        exit_modem
        ;;
    both)
        init_modem
        start_gps
        start_hspa
        stop_gps
        exit_modem
        ;;
    *)
        echo "Use hspa, gps or both as param" >&2
        exit 1
        ;;
esac

exit 0
</pre>]]>
</description>
</item>
</channel>
</rss>
