User:Nukama

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m
m
Line 11: Line 11:
 
* 3d compass, altimeter, thermometer (with information of distance to map tunnels, dense forest, ...)
 
* 3d compass, altimeter, thermometer (with information of distance to map tunnels, dense forest, ...)
 
* buttons for turning lights (on lowpower/on highpower/off), setting waypoints/audionotes, easy navigation of openmoko (scrolling/enter)
 
* buttons for turning lights (on lowpower/on highpower/off), setting waypoints/audionotes, easy navigation of openmoko (scrolling/enter)
 +
 +
==== A-GPS ====
 +
agps.sh
 +
<pre>
 +
agps-alm.py > /dev/ttySAC1
 +
</pre>
 +
 +
agps-alm.py
 +
<pre>
 +
#!/usr/bin/python
 +
#
 +
# ublox AssistNow Online almanac downloader for Neo FreeRunner
 +
#
 +
# v0.1
 +
#
 +
# Wilfried Klaebe <wk-openmoko@chaos.in-kiel.de>
 +
#
 +
# Usage:
 +
#
 +
# agps-alm.py > /dev/ttySAC1
 +
#
 +
 +
import sys
 +
import socket
 +
import re
 +
 +
user='your@mail.address'
 +
pwd='pwdfromublox'
 +
 +
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 +
s.connect(('agps.u-blox.com',46434))
 +
 +
s.send('user='+user+';pwd='+pwd+';cmd=alm;lat=0;lon=0;pacc=40000000;\n')
 +
 +
buf = s.recv(4096)
 +
while 1:
 +
        b = s.recv(4096)
 +
        if not b:
 +
                break
 +
        buf += b
 +
 +
h = {}
 +
 +
while 1:
 +
        (l,s,buf) = buf.partition('\n')
 +
        l = l.rstrip('\r\n')
 +
        #
 +
        sys.stderr.write(l+'\n')
 +
        #
 +
        if (l == ""):
 +
                if h.has_key('content-length') and h['content-length'].isdigit() and h.has_key('content-type') and h['content-type'] == 'application/ubx':
 +
                        sys.stdout.write(buf[0:int(h['content-length'])])
 +
                sys.exit(0)
 +
        #
 +
        m = re.search('\\A(.+): (.+)\\Z',l)
 +
        if m:
 +
                h[m.group(1).lower()] = m.group(2).lower();
 +
</pre>
  
  
Line 112: Line 170:
 
) &
 
) &
 
exit 0
 
exit 0
</pre>
 
 
 
==== A-GPS ====
 
agps.sh
 
<pre>
 
agps-alm.py > /dev/ttySAC1
 
</pre>
 
 
agps-alm.py
 
<pre>
 
#!/usr/bin/python
 
#
 
# ublox AssistNow Online almanac downloader for Neo FreeRunner
 
#
 
# v0.1
 
#
 
# Wilfried Klaebe <wk-openmoko@chaos.in-kiel.de>
 
#
 
# Usage:
 
#
 
# agps-alm.py > /dev/ttySAC1
 
#
 
 
import sys
 
import socket
 
import re
 
 
user='your@mail.address'
 
pwd='pwdfromublox'
 
 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 
s.connect(('agps.u-blox.com',46434))
 
 
s.send('user='+user+';pwd='+pwd+';cmd=alm;lat=0;lon=0;pacc=40000000;\n')
 
 
buf = s.recv(4096)
 
while 1:
 
        b = s.recv(4096)
 
        if not b:
 
                break
 
        buf += b
 
 
h = {}
 
 
while 1:
 
        (l,s,buf) = buf.partition('\n')
 
        l = l.rstrip('\r\n')
 
        #
 
        sys.stderr.write(l+'\n')
 
        #
 
        if (l == ""):
 
                if h.has_key('content-length') and h['content-length'].isdigit() and h.has_key('content-type') and h['content-type'] == 'application/ubx':
 
                        sys.stdout.write(buf[0:int(h['content-length'])])
 
                sys.exit(0)
 
        #
 
        m = re.search('\\A(.+): (.+)\\Z',l)
 
        if m:
 
                h[m.group(1).lower()] = m.group(2).lower();
 
 
</pre>
 
</pre>

Revision as of 18:13, 20 August 2009

Contents

Bicycle

Dynamo powered openmoko (and other USB-Devices/Host) using the frequency/voltage of the dynamo to gather information about speed and distance.

Wishlist for this USB-Charger:

  • 5V, 500-1500mA output (through diodes or MOSFET)
  • Voltage, Frequency (should be dynamohub independable)
  • USB-Device (maybe with USBprog)

nice to

  • 3d compass, altimeter, thermometer (with information of distance to map tunnels, dense forest, ...)
  • buttons for turning lights (on lowpower/on highpower/off), setting waypoints/audionotes, easy navigation of openmoko (scrolling/enter)

A-GPS

agps.sh

agps-alm.py > /dev/ttySAC1

agps-alm.py

#!/usr/bin/python
#
# ublox AssistNow Online almanac downloader for Neo FreeRunner
#
# v0.1
#
# Wilfried Klaebe <wk-openmoko@chaos.in-kiel.de>
#
# Usage:
#
# agps-alm.py > /dev/ttySAC1
#

import sys
import socket
import re

user='your@mail.address'
pwd='pwdfromublox'

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('agps.u-blox.com',46434))

s.send('user='+user+';pwd='+pwd+';cmd=alm;lat=0;lon=0;pacc=40000000;\n')

buf = s.recv(4096)
while 1:
        b = s.recv(4096)
        if not b:
                break
        buf += b

h = {}

while 1:
        (l,s,buf) = buf.partition('\n')
        l = l.rstrip('\r\n')
        #
        sys.stderr.write(l+'\n')
        #
        if (l == ""):
                if h.has_key('content-length') and h['content-length'].isdigit() and h.has_key('content-type') and h['content-type'] == 'application/ubx':
                        sys.stdout.write(buf[0:int(h['content-length'])])
                sys.exit(0)
        #
        m = re.search('\\A(.+): (.+)\\Z',l)
        if m:
                h[m.group(1).lower()] = m.group(2).lower();


Enscribi on OM2009

Step 1:

opkg install http://www.opkg.org/packages/zinnia_0.04_armv4t.ipk
opkg install http://www.opkg.org/packages/0_zinnia-tomoe-ja_0.6.0-20080911_armv4t.ipk (for Japanese support)
opkg install http://www.opkg.org/packages/0_zinnia-tomoe-zh_0.6.0-20080911_armv4t.ipk (for Chinese support)
opkg install http://www.opkg.org/packages/enscribi_0.2.0_armv4t.ipk


Step 2:

Create symbolic links for the old libs (tested with om2009-unstable 17-Aug-2009 17:19) If enscribi is linked against the new libs then these symbolic links are obsolete.

ln -s /usr/lib/libecore_evas-ver-svn-02.so.0 libecore_evas-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_fb-ver-svn-02.so.0 libecore_fb-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_x-ver-svn-02.so.0 libecore_x-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_input-ver-svn-02.so.0 libecore_input-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_x-ver-svn-02.so.0 libecore_txt-ver-pre-svn-01.so.0
ln -s /usr/lib/libedje-ver-svn-02.so.0 libedje-ver-pre-svn-01.so.0 
ln -s /usr/lib/libembryo-ver-svn-02.so.0 libembryo-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_job-ver-svn-02.so.0 libecore_job-ver-pre-svn-01.so.0
ln -s /usr/lib/libevas-ver-svn-02.so.0 libevas-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore-ver-svn-02.so.0 libecore-ver-pre-svn-01.so.0
ln -s /usr/lib/libeina-ver-svn-02.so.0 libeina-ver-pre-svn-01.so.0

Step 3:

goto "setup" --> "keyboard" --> "enscribi"

To get a Chinese/Japanese input method. Ensure, that you have Chinese/Japanes fonts installed.

USB-Networking

Ubuntu 8.10

sudo iptables -I INPUT 1 -s 192.168.0.202 -j ACCEPT sudo iptables -I OUTPUT 1 -s 192.168.0.200 -j ACCEPT sudo iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'

Ubuntu 9.04

/etc/network/freerunner (chmod -x)

#!/bin/sh
#
# configures the freerunner for internet
#
#

DEVICE=usb0
IPADDR=192.168.0.200
REMOTE_IPADDR=192.168.0.202
NETMASK=255.255.255.0

# get first ip for dns
DNSIP=$(awk '$1 == "nameserver"{print $2; exit(0);}' /etc/resolv.conf)

case "$1" in
start)
iptables -A POSTROUTING -t nat -j MASQUERADE -s $REMOTE_IPADDR
iptables -A PREROUTING -t nat -p tcp -s $REMOTE_IPADDR -d $IPADDR --dport domain -j DNAT --to-destination $DNSIP
iptables -A PREROUTING -t nat -p udp -s $REMOTE_IPADDR -d $IPADDR --dport domain -j DNAT --to-destination $DNSIP

if [ "$(cat /proc/sys/net/ipv4/ip_forward)" = "0" ]; then
echo "temoprarely allow ip_forward for openmoko" > /var/run/openmoko.ip_forward
echo 1 > /proc/sys/net/ipv4/ip_forward
fi
;;
stop)
iptables -D POSTROUTING -t nat -j MASQUERADE -s $REMOTE_IPADDR
iptables -D PREROUTING -t nat -p tcp -s $REMOTE_IPADDR -d $IPADDR --dport domain -j DNAT --to-destination $DNSIP
iptables -D PREROUTING -t nat -p udp -s $REMOTE_IPADDR -d  $IPADDR --dport domain -j DNAT --to-destination $DNSIP

if [ -f /var/run/openmoko.ip_forward ]; then
rm /var/run/openmoko.ip_forward
echo 0 > /proc/sys/net/ipv4/ip_forward
fi
;;
esac

/etc/udev/rules.d/80-freerunner.rules

# This file causes programs to be run on device insertion.
# See udev(7) for syntax.
# rule to assign a fixed mac address specified in /
KERNEL=="usb[0-9]*", DRIVERS=="cdc_ether", ACTION=="add", RUN+="/usr/local/sbin/freerunner-usb-add.sh %k"

/usr/local/sbin/freerunner-usb-add.sh (chmod -x)

#!/bin/sh
(
ip address add 192.168.0.200/26 netmask dev usb0 > /dev/null
ip link set usb0 up > /dev/null
/etc/network/freerunner start
) &
exit 0
Personal tools

Bicycle

Dynamo powered openmoko (and other USB-Devices/Host) using the frequency/voltage of the dynamo to gather information about speed and distance.

Wishlist for this USB-Charger:

  • 5V, 500-1500mA output (through diodes or MOSFET)
  • Voltage, Frequency (should be dynamohub independable)
  • USB-Device (maybe with USBprog)

nice to

  • 3d compass, altimeter, thermometer (with information of distance to map tunnels, dense forest, ...)
  • buttons for turning lights (on lowpower/on highpower/off), setting waypoints/audionotes, easy navigation of openmoko (scrolling/enter)

A-GPS

agps.sh

agps-alm.py > /dev/ttySAC1

agps-alm.py

#!/usr/bin/python
#
# ublox AssistNow Online almanac downloader for Neo FreeRunner
#
# v0.1
#
# Wilfried Klaebe <wk-openmoko@chaos.in-kiel.de>
#
# Usage:
#
# agps-alm.py > /dev/ttySAC1
#

import sys
import socket
import re

user='your@mail.address'
pwd='pwdfromublox'

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('agps.u-blox.com',46434))

s.send('user='+user+';pwd='+pwd+';cmd=alm;lat=0;lon=0;pacc=40000000;\n')

buf = s.recv(4096)
while 1:
        b = s.recv(4096)
        if not b:
                break
        buf += b

h = {}

while 1:
        (l,s,buf) = buf.partition('\n')
        l = l.rstrip('\r\n')
        #
        sys.stderr.write(l+'\n')
        #
        if (l == ""):
                if h.has_key('content-length') and h['content-length'].isdigit() and h.has_key('content-type') and h['content-type'] == 'application/ubx':
                        sys.stdout.write(buf[0:int(h['content-length'])])
                sys.exit(0)
        #
        m = re.search('\\A(.+): (.+)\\Z',l)
        if m:
                h[m.group(1).lower()] = m.group(2).lower();


Enscribi on OM2009

Step 1:

opkg install http://www.opkg.org/packages/zinnia_0.04_armv4t.ipk
opkg install http://www.opkg.org/packages/0_zinnia-tomoe-ja_0.6.0-20080911_armv4t.ipk (for Japanese support)
opkg install http://www.opkg.org/packages/0_zinnia-tomoe-zh_0.6.0-20080911_armv4t.ipk (for Chinese support)
opkg install http://www.opkg.org/packages/enscribi_0.2.0_armv4t.ipk


Step 2:

Create symbolic links for the old libs (tested with om2009-unstable 17-Aug-2009 17:19) If enscribi is linked against the new libs then these symbolic links are obsolete.

ln -s /usr/lib/libecore_evas-ver-svn-02.so.0 libecore_evas-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_fb-ver-svn-02.so.0 libecore_fb-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_x-ver-svn-02.so.0 libecore_x-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_input-ver-svn-02.so.0 libecore_input-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_x-ver-svn-02.so.0 libecore_txt-ver-pre-svn-01.so.0
ln -s /usr/lib/libedje-ver-svn-02.so.0 libedje-ver-pre-svn-01.so.0 
ln -s /usr/lib/libembryo-ver-svn-02.so.0 libembryo-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore_job-ver-svn-02.so.0 libecore_job-ver-pre-svn-01.so.0
ln -s /usr/lib/libevas-ver-svn-02.so.0 libevas-ver-pre-svn-01.so.0
ln -s /usr/lib/libecore-ver-svn-02.so.0 libecore-ver-pre-svn-01.so.0
ln -s /usr/lib/libeina-ver-svn-02.so.0 libeina-ver-pre-svn-01.so.0

Step 3:

goto "setup" --> "keyboard" --> "enscribi"

To get a Chinese/Japanese input method. Ensure, that you have Chinese/Japanes fonts installed.

USB-Networking

Ubuntu 8.10

sudo iptables -I INPUT 1 -s 192.168.0.202 -j ACCEPT sudo iptables -I OUTPUT 1 -s 192.168.0.200 -j ACCEPT sudo iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24 sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'

Ubuntu 9.04

/etc/network/freerunner (chmod -x)

#!/bin/sh
#
# configures the freerunner for internet
#
#

DEVICE=usb0
IPADDR=192.168.0.200
REMOTE_IPADDR=192.168.0.202
NETMASK=255.255.255.0

# get first ip for dns
DNSIP=$(awk '$1 == "nameserver"{print $2; exit(0);}' /etc/resolv.conf)

case "$1" in
start)
iptables -A POSTROUTING -t nat -j MASQUERADE -s $REMOTE_IPADDR
iptables -A PREROUTING -t nat -p tcp -s $REMOTE_IPADDR -d $IPADDR --dport domain -j DNAT --to-destination $DNSIP
iptables -A PREROUTING -t nat -p udp -s $REMOTE_IPADDR -d $IPADDR --dport domain -j DNAT --to-destination $DNSIP

if [ "$(cat /proc/sys/net/ipv4/ip_forward)" = "0" ]; then
echo "temoprarely allow ip_forward for openmoko" > /var/run/openmoko.ip_forward
echo 1 > /proc/sys/net/ipv4/ip_forward
fi
;;
stop)
iptables -D POSTROUTING -t nat -j MASQUERADE -s $REMOTE_IPADDR
iptables -D PREROUTING -t nat -p tcp -s $REMOTE_IPADDR -d $IPADDR --dport domain -j DNAT --to-destination $DNSIP
iptables -D PREROUTING -t nat -p udp -s $REMOTE_IPADDR -d  $IPADDR --dport domain -j DNAT --to-destination $DNSIP

if [ -f /var/run/openmoko.ip_forward ]; then
rm /var/run/openmoko.ip_forward
echo 0 > /proc/sys/net/ipv4/ip_forward
fi
;;
esac

/etc/udev/rules.d/80-freerunner.rules

# This file causes programs to be run on device insertion.
# See udev(7) for syntax.
# rule to assign a fixed mac address specified in /
KERNEL=="usb[0-9]*", DRIVERS=="cdc_ether", ACTION=="add", RUN+="/usr/local/sbin/freerunner-usb-add.sh %k"

/usr/local/sbin/freerunner-usb-add.sh (chmod -x)

#!/bin/sh
(
ip address add 192.168.0.200/26 netmask dev usb0 > /dev/null
ip link set usb0 up > /dev/null
/etc/network/freerunner start
) &
exit 0