Resources:
Es gibt eine Mailingliste münchner Openmoko-User:
Der HW-Fix des SD/GPS-Problems ist das Einlöten eines 10pF KerKos zwischen Pin5 und Pin6 des microSD-Sockels.
Openmoko empfiehlt dafür einen 0402 SMD KerKo. Den einzulöten fällt definitiv unter Herausforderung/Erfahrung/Abenteuer (vorher keinen Kaffee trinken und ausreichend Meditieren ist empfehlenswert , aber auch unter 'muss man mal gemacht haben'…
Berichten zufolge passt ein 0603 SMD KerKo ebenfalls, drückt wohl leicht gegen die eingelegte microSD-Karte, ist aber mit Sicherheit deutlich leichter einzulöten.
10pF 0402 SMD KerKos liegen im Club herum. Geeignete Lötspitze und Pinzetten ebenfalls. Lupe wäre auch vorhanden, besser ist's kurzsichtig zu sein und die Brille abzunehmen…
Ein paar wahrscheinlich naheliegende Case-Mods:
Wahrscheinlich naheliegende HW-Mods:
Das Ganze ist Freerunner und Openmoko 2007 spezifisch (nach erfolgreichem 'opkg update; opkg upgrade'), aber vielleicht auch sonst hilfreich.
Mit ipv4-Masquerading, und da die Freerunner-Clock das gut brauchen kann ausserdem mit ntpclient. Das impliziert natürlich einen laufenden ntpd auf dem Host, wenn's funktionieren soll.
/etc/network/interfaces:
auto usb0 iface usb0 inet dhcp
/etc/udhcpc.d/60ntp:
#!/bin/sh # udhcpc script to start a ntpclient in case we got a ntpsrv # disgorged by x@muc.ccc.de this=`basename "$0"` if [ -z "$1" ]; then echo "$this: got no action. this is fatal. exiting." exit 1 fi if [ -z "$interface" ]; then echo "$this: got no interface. this is fatal. exiting." exit 2 fi if [ -z "$ntpsrv" ]; then echo "$this: $interface: got no ntpsrv. exiting." exit 0 fi if [ -e /etc/default/ntp ]; then . /etc/default/ntp fi if [ -z "$NTPCLIENT" ]; then NTPCLIENT="/sbin/ntpclient" fi if [ -z "$NTPINTERVAL" ]; then NTPINTERVAL="600" fi case "$1" in deconfig) if [ -e "/var/run/ntpclient-$interface.pid" ] && [ "`ps -p \`cat \"/var/run/ntpclient-$interface.pid\"\` --no-heading -o comm`" == "$NTPCLIENT" ]; then echo "$this: $interface: stopping ntp client" start-stop-daemon --stop --quiet --pidfile "/var/run/ntpclient-$interface.pid" fi ;; renew|bound) if [ ! -e "/var/run/ntpclient-$interface.pid" ] || [ "`ps -p \`cat \"/var/run/ntpclient-$interface.pid\"\` --no-heading -o comm`" != "$NTPCLIENT" ]; then ntpsrvargs="" for i in $ntpsrv; do ntpsrvargs="$ntpsrvargs -h $i" done echo "$this: $interface: starting ntp client: $ntpsrv" start-stop-daemon --start --quiet --background --make-pidfile --pidfile "/var/run/ntpclient-$interface.pid" --exec "$NTPCLIENT" -- -l -i "$NTPINTERVAL" $ntpsrvargs if [ -n "$timezone" ] ; then : # use this timezone. fi fi ;; esac exit 0
/etc/network/interfaces:
allow-hotplug usb0 iface usb0 inet static address 192.168.0.1 netmask 255.255.255.252 post-up iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/30 post-up iptables -A INPUT -m udp -p udp -i usb0 --dport 123 -j ACCEPT post-up echo 1 > /proc/sys/net/ipv4/ip_forward post-up iptables -P FORWARD ACCEPT post-up dnslist="`sep=""; grep "^[ ]*nameserver[ ]" /etc/resolv.conf|sed 's/^[ ]*nameserver[ ]\+//' | while read; do echo -n "$sep$REPLY"; sep=", "; done;`"; dnssearch="`grep "^[ ]*search[ ]" /etc/resolv.conf|sed 's/^[ ]*search[ ]\+//'`"; cat /etc/dhcp3/dhcpd-usb0.conf.tpl | sed "{ s/@@dnslist@@/$dnslist/g; s/@@dnssearch@@/$dnssearch/g; }" > /etc/dhcp3/dhcpd-usb0.conf post-up dhcpd3 -cf /etc/dhcp3/dhcpd-usb0.conf -pf /var/run/dhcpd-usb0.pid usb0 pre-down kill `cat /var/run/dhcpd-usb0.pid` pre-down iptables -D INPUT -m udp -p udp -i usb0 --dport 123 -j ACCEPT pre-down iptables -D POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/30
/etc/dhcp3/dhcpd-usb0.conf.tpl:
subnet 192.168.0.0 netmask 255.255.255.252 { range dynamic-bootp 192.168.0.2 192.168.0.2; option broadcast-address 192.168.0.3; option routers 192.168.0.1; option domain-name "@@dnssearch@@"; option domain-name-servers @@dnslist@@; option ntp-servers 192.168.0.1; }
Issues:
Die folgende Variante sieht zwar wüst aus, funktioniert dafür ohne dhcpd.conf Template und vollautomagisch (muss also nicht an die Interface-IP-Config angepasst werden - dhcp range = range zwischen $host und broadcast). Braucht allerdings die Pakete `sipcalc` und `prips`.
/etc/network/interfaces:
allow-hotplug usb0 iface usb0 inet static address 192.168.0.1 netmask 255.255.255.252 pre-up network="`sipcalc $IF_ADDRESS $IF_NETMASK|grep "^Network address"|sed "s/^Network address[ \t]*-[ \t]*//"`"; iptables -I POSTROUTING -t nat -j MASQUERADE -s "$network/$IF_NETMASK" pre-up iptables -I INPUT -m udp -p udp -i "$LOGICAL" --dport 123 -j ACCEPT pre-up echo 1 >/proc/sys/net/ipv4/ip_forward pre-up iptables -I FORWARD -i "$LOGICAL" -j ACCEPT pre-up iptables -I FORWARD -o "$LOGICAL" -j ACCEPT pre-up network="`sipcalc $IF_ADDRESS $IF_NETMASK|grep "^Network address"|sed "s/^Network address[ \t]*-[ \t]*//"`"; broadcast="`sipcalc $IF_ADDRESS $IF_NETMASK|grep "^Broadcast address"|sed "s/^Broadcast address[ \t]*-[ \t]*//"`"; last="`sipcalc $IF_ADDRESS $IF_NETMASK|grep "^Usable range"|sed "s/^Usable range[ \t]*-[ \t]*//"|sed "s/.*-[ \t]*//"`"; first="`prips "$IF_ADDRESS" "$last"|tail -n +2|head -n 1`"; dnslist="`sep=""; grep "^[ \t]*nameserver[ \t]" /etc/resolv.conf|sed 's/^[ \t]*nameserver[ \t]\+//' | while read; do echo -n "$sep$REPLY"; sep=", "; done;`"; dnssearch="`grep "^[ \t]*search[ \t]" /etc/resolv.conf|sed 's/^[ \t]*search[ \t]\+//'`"; echo -e "subnet $network netmask $IF_NETMASK {\n\trange dynamic-bootp $first $last;\n\toption broadcast-address $broadcast;\n\toption routers $IF_ADDRESS;\n\toption domain-name "$dnssearch";\n\toption domain-name-servers $dnslist;\n\toption ntp-servers $IF_ADDRESS;\n}" >"/etc/dhcp3/dhcpd-$LOGICAL.conf" post-up dhcpd3 -cf "/etc/dhcp3/dhcpd-$LOGICAL.conf" -pf "/var/run/dhcpd-$LOGICAL.pid" "$LOGICAL" post-down kill "`cat "/var/run/dhcpd-$LOGICAL.pid"`" post-down iptables -D FORWARD -i "$LOGICAL" -j ACCEPT post-down iptables -D FORWARD -o "$LOGICAL" -j ACCEPT post-down iptables -D INPUT -m udp -p udp -i "$LOGICAL" --dport 123 -j ACCEPT post-down network="`sipcalc $IF_ADDRESS $IF_NETMASK|grep "^Network address"|sed "s/^Network address[ \t]*-[ \t]*//"`"; iptables -D POSTROUTING -t nat -j MASQUERADE -s "$network/$IF_NETMASK"
ntpclient ist nett, aber 'so richtig NTP machen' geht nur mit ntpd. Konkret:
Issues:
Noch work in progress, aber sicher brauchbar:
/usr/share/matchbox-keyboard/keyboard-de.xml:
(ln -s keyboard-de.xml /usr/share/matchbox-keyboard/keyboard.xml)
<?xml version="1.0" encoding="UTF-8"?> <keyboard> <!-- DE keyboard layout by x <x@muc.ccc.de> --> <options> <!-- not yet implemented --> </options> <layout id="de keyboard"> <row> <space width="500" extended="true"/> <key fill="true"> <default display="Esc" action="escape" /> </key> <key> <default display="^" /> <shifted display="°" /> </key> <key> <default display="1" /> <shifted display="!" /> </key> <key> <default display="2" /> <shifted display='"' /> <mod1 display="²" /> </key> <key> <default display="3" /> <shifted display="§" /> <mod1 display="³" /> </key> <key> <default display="4" /> <shifted display="$" /> </key> <key> <default display="5" /> <shifted display="%" /> </key> <key> <default display="6" /> <shifted display="&" /> </key> <key> <default display="7" /> <shifted display="/" /> <mod1 display="{" /> </key> <key> <default display="8" /> <shifted display="(" /> <mod1 display="[" /> </key> <key> <default display="9" /> <shifted display=")" /> <mod1 display="]" /> </key> <key> <default display="0" /> <shifted display="=" /> <mod1 display="}" /> </key> <key> <default display="ß" /> <shifted display="?" /> <mod1 display="\" /> </key> <key> <default display="´" /> <shifted display="`" /> </key> <key fill="true"> <default display="Bksp" action="backspace"/> </key> <space width="500" extended="true"/> <key width="4000" extended="true"> <default display="Home" action="home"/> </key> <key width="4000" extended="true"> <default display="PgUp" action="pageup"/> </key> <space width="500" extended="true"/> </row> <row> <space width="500" extended="true"/> <key fill="true"> <default display="Tab" action="tab"/> </key> <key obey-caps='true'> <default display="q" /> <shifted display="Q" /> <mod1 display="@" /> </key> <key obey-caps='true'> <default display="w" /> <shifted display="W" /> </key> <key obey-caps='true'> <default display="e" /> <shifted display="E" /> <mod1 display="€" /> </key> <key obey-caps='true'> <default display="r" /> <shifted display="R" /> </key> <key obey-caps='true'> <default display="t" /> <shifted display="T" /> </key> <key obey-caps='true'> <default display="z" /> <shifted display="Z" /> </key> <key obey-caps='true'> <default display="u" /> <shifted display="U" /> </key> <key obey-caps='true'> <default display="i" /> <shifted display="I" /> </key> <key obey-caps='true'> <default display="o" /> <shifted display="O" /> <mod1 display="Ω" /> </key> <key obey-caps='true'> <default display="p" /> <shifted display="P" /> </key> <key obey-caps='true'> <default display="ü" /> <shifted display="Ü" /> </key> <key> <default display="+" /> <shifted display="*" /> <mod1 display="~" /> </key> <key fill="true"> <default display="#" /> <shifted display="'" /> </key> <space width="500" extended="true"/> <key width="4000" extended="true"> <default display="End" action="end"/> </key> <key width="4000" extended="true"> <default display="PgDn" action="pagedown"/> </key> <space width="500" extended="true"/> </row> <row> <space width="500" extended="true"/> <key fill="true"> <default display="Caps" action="modifier:caps"/> </key> <key obey-caps='true'> <default display="a" /> <shifted display="A" /> </key> <key obey-caps='true'> <default display="s" /> <shifted display="S" /> </key> <key obey-caps='true'> <default display="d" /> <shifted display="D" /> </key> <key obey-caps='true'> <default display="f" /> <shifted display="F" /> </key> <key obey-caps='true'> <default display="g" /> <shifted display="G" /> </key> <key obey-caps='true'> <default display="h" /> <shifted display="H" /> </key> <key obey-caps='true'> <default display="j" /> <shifted display="J" /> </key> <key obey-caps='true'> <default display="k" /> <shifted display="K" /> </key> <key obey-caps='true'> <default display="l" /> <shifted display="L" /> </key> <key obey-caps='true'> <default display="ö" /> <shifted display="Ö" /> </key> <key obey-caps='true'> <default display="ä" /> <shifted display="Ä" /> </key> <key fill="true"> <default display="Ret" action="return"/> </key> <space width="500" extended="true"/> <space width="4000" extended="true" /> <space width="4000" extended="true" /> <space width="500" extended="true"/> </row> <row> <space width="500" extended="true"/> <key fill="true"> <default display="Shift" action="modifier:shift"/> </key> <key obey-caps='true'> <default display="y" /> <shifted display="Y" /> </key> <key obey-caps='true'> <default display="x" /> <shifted display="X" /> </key> <key obey-caps='true'> <default display="c" /> <shifted display="C" /> </key> <key obey-caps='true'> <default display="v" /> <shifted display="V" /> </key> <key obey-caps='true'> <default display="b" /> <shifted display="B" /> </key> <key obey-caps='true'> <default display="n" /> <shifted display="N" /> </key> <key obey-caps='true'> <default display="m" /> <shifted display="M" /> <mod1 display="µ" /> </key> <key> <default display="," /> <shifted display=";" /> </key> <key> <default display="." /> <shifted display=":" /> </key> <key> <default display="-" /> <shifted display="_" /> </key> <key fill="true"> <default display="Shift" action="modifier:shift"/> </key> <space width="500" extended="true"/> <space width="4000" extended="true" /> <space width="4000" extended="true" /> <space width="500" extended="true"/> </row> <row> <space width="500" extended="true"/> <key> <default display="[->]" action="modifier:layout"/> </key> <key> <default display="äëö" action="modifier:mod1"/> </key> <key fill="true"> <default display="Ctrl" action="modifier:ctrl"/> </key> <key> <default display="Alt" action="modifier:alt"/> </key> <key width="12000"> <default display=" " action="space" /> </key> <key> <default display="<" /> <shifted display=">" /> <mod1 display="|" /> </key> <key> <default display="↑" action="up" /> </key> <key> <default display="↓" action="down" /> </key> <key> <default display="←" action="left" /> </key> <key> <default display="→" action="right" /> </key> <space width="500" extended="true"/> <space width="4000" extended="true" /> <space width="4000" extended="true" /> <space width="500" extended="true"/> </row> </layout> </keyboard>
Issues:
(Tip: multitap-pad über Click auf's Terminal öffnen, matchbox-keyboard über Panel-Icon öffnen, multitap-pad über Panel-Icon schliessen ⇒ Terminal hat Focus)
GPRS und ein GSM-Telefonat sind nicht gleichzeitig möglich. Wird ein Telefonat aufgebaut, killt offenbar irgendetwas automatisch die GPRS-Connection (das gemuxte tty wird jedenfalls offenbar nicht einfach abgebaut). Bei folgendem Setup würde GPRS dann wieder aufgebaut werden sobald das Telefonat beendet ist.
Der gsmd belegt /dev/ttySAC0, das tty des GSM-Modems. Es gibt einen GSM-Modem-Demux Daemon - gsm0710muxd - der das tty des GSM demuxed und mehrere ttys bereitstellt, der allerdings noch nicht von der Openmoko-Suite benutzt wird.
Versuche mit 0.9.1 zeichnen ein einigermassen stabiles Bild. Grundsätzlich funktioniert das ganze ganz gut. Drehen am GSM-Powermanagement/-Reset während der gsm0710muxd läuft führt dazu dass auf die Pseudo-ttys nicht mehr geschrieben werden kann… (lt. syslog: “gsm0710muxd.c:569:pseudo_device_read(): Write to a channel which wasn't acked to be open.”)
/etc/init.d/gsmd:
#!/bin/sh # # gsmd This shell script starts and stops gsmd. # # chkconfig: 345 90 40 # description: Gsmd manages access to a serial-connected GSM # processname: gsmd PATH=/bin:/usr/bin:/sbin:/usr/sbin [ -f /etc/default/rcS ] && . /etc/default/rcS [ -f /etc/default/gsmd ] && . /etc/default/gsmd case "$1" in start) echo -n "Starting GSM daemon: " pid="`fuser "$GSM_DEV"`" if [ -n "$pid" ] && [ "`ps -o comm --no-heading -p $pid`" == "gsm0710muxd" ]; then tty="`dbus-send --system --print-reply --type=method_call --dest=org.pyneo.muxer /org/pyneo/Muxer org.freesmartphone.GSM.MUX.AllocChannel string:gsmd | grep '^[ ]*string' | sed 's/^[ ]*string "\(.*\)"$/\1/'`" else [ -n "$GSM_POW" ] && ( echo "0" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_POW" ] && ( echo "1" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "1" >"$GSM_RES"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "0" >"$GSM_RES"; sleep 2 ) tty="$GSM_DEV" fi start-stop-daemon -S -x /usr/sbin/gsmd -- gsmd -p "$tty" $GSMD_OPTS -d -l syslog if [ "$?" == "0" ]; then echo "gsmd." else echo "(failed.)" fi ;; stop) echo -n "Stopping GSM daemon: " start-stop-daemon -K -x /usr/sbin/gsmd pid="`fuser "$GSM_DEV"`" if [ -z "$pid" ] || [ "`ps -o comm --no-heading -p $pid`" != "gsm0710muxd" ]; then [ -n "$GSM_POW" ] && echo "0" >"$GSM_POW" fi echo "gsmd." ;; restart|force-reload) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/gsmd {start|stop|restart|force-reload}" exit 1 ;; esac exit 0
/etc/init.d/gsm0710muxd:
#!/bin/sh # # gsm0710muxd This shell script starts and stops gsm0710muxd. # # chkconfig: 345 90 40 # description: Gsm0710muxd manages multiplexing of a serial-connected GSM # processname: gsm0710muxd PATH=/bin:/usr/bin:/sbin:/usr/sbin [ -f /etc/default/rcS ] && . /etc/default/rcS [ -f /etc/default/gsmd ] && . /etc/default/gsmd case "$1" in start) echo -n "Starting GSM 07.10 Mux daemon: " [ -n "$GSM_POW" ] && ( echo "0" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_POW" ] && ( echo "1" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "1" >"$GSM_RES"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "0" >"$GSM_RES"; sleep 2 ) start-stop-daemon -S -x /usr/sbin/gsm0710muxd -- -x /sys/bus/platform/devices/neo1973-pm-gsm.0 -s $GSM_DEV -d rc=$? while [ "`ps -o comm --no-heading -p \`fuser \"$GSM_DEV\"\``" != "gsm0710muxd" ]; do sleep 1; done if [ "$rc" == "0" ]; then echo "gsm0710muxd." else echo "(failed.)" fi ;; stop) echo -n "Stopping GSM 07.10 Mux daemon: " start-stop-daemon -K -x /usr/sbin/gsm0710muxd [ -n "$GSM_POW" ] && echo "0" >"$GSM_POW" echo "gsm0710muxd." ;; restart|force-reload) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/gsm0710muxd {start|stop|restart|force-reload}" exit 1 ;; esac exit 0
/etc/dbus-1/system.d/gsm0710mux.conf:
(Sehr freizügig. Das möchte man sicher sinnvoller/granularer, aber zum ausprobieren/damit's erstmal geht erfüllt's seinen Zweck)
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig> <!-- This configuration file specifies the required security policies for the gsm0710mux to work. --> <!-- Only root or user haldaemon can own the gsm mux service --> <policy user="haldaemon"> <allow own="org.pyneo.muxer"/> </policy> <policy user="root"> <allow own="org.pyneo.muxer"/> </policy> <!-- Allow anyone to invoke methods on anything --> <policy context="default"> <allow send_interface="org.pyneo.muxer"/> <allow receive_interface="org.pyneo.muxer" /> </policy> </busconfig>
Da es für den gsm0710muxd noch kein init Setup gibt:
ln -s ../init.d/gsm0710muxd /etc/rc0.d/K36gsm0710muxd ln -s ../init.d/gsm0710muxd /etc/rc1.d/K36gsm0710muxd ln -s ../init.d/gsm0710muxd /etc/rc2.d/S34gsm0710muxd ln -s ../init.d/gsm0710muxd /etc/rc3.d/S34gsm0710muxd ln -s ../init.d/gsm0710muxd /etc/rc4.d/S34gsm0710muxd ln -s ../init.d/gsm0710muxd /etc/rc5.d/S34gsm0710muxd ln -s ../init.d/gsm0710muxd /etc/rc6.d/K36gsm0710muxd
Um den Aufruf eines GSM-Terminals zu vereinfachen:
gsmterminal.sh
#!/bin/sh # # gsmterminal.sh This shell script starts a gsm terminal PATH=/bin:/usr/bin:/sbin:/usr/sbin [ -f /etc/default/rcS ] && . /etc/default/rcS [ -f /etc/default/gsmd ] && . /etc/default/gsmd pid="`fuser "$GSM_DEV"`" if [ -n "$pid" ] && [ "`ps -o comm --no-heading -p $pid`" == "gsm0710muxd" ]; then tty="`dbus-send --system --print-reply --type=method_call --dest=org.pyneo.muxer /org/pyneo/Muxer org.freesmartphone.GSM.MUX.AllocChannel string:terminal | grep '^[ ]*string' | sed 's/^[ ]*string "\(.*\)"$/\1/'`" else [ -n "$GSM_POW" ] && ( echo "0" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_POW" ] && ( echo "1" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "1" >"$GSM_RES"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "0" >"$GSM_RES"; sleep 2 ) tty="$GSM_DEV" fi screen "$tty" pid="`fuser "$GSM_DEV"`" if [ -z "$pid" ] || [ "`ps -o comm --no-heading -p $pid`" != "gsm0710muxd" ]; then [ -n "$GSM_POW" ] && echo "0" >"$GSM_POW" fi
Eine Art pppd-wrapper-daemon der dafür sorgt dem pppd immer ein tty zur Verfügung zu stellen.
/etc/ppp/gsmpppd.sh:
#!/bin/sh # # gsmpppd.sh This shell script starts a gsm pppd PATH=/bin:/usr/bin:/sbin:/usr/sbin [ -f /etc/default/rcS ] && . /etc/default/rcS [ -f /etc/default/gsmd ] && . /etc/default/gsmd [ -f /etc/default/pppd ] && . /etc/default/pppd if [ "$gsmpppd_phase" != "2" ]; then gsmpppd_phase="2" export gsmpppd_phase $0 & exit 0 fi; # making the shell send signals it receives to its children, too, would be # great... we could forget about signal handlers, would not have to care about # children pids, and would not have to detach pppd and then wait for it... sig_handler() { trap "" $1 # i don't know why, but at least TERM is signalled twice? logger gsmpppd.sh: signal $1 received #for i in `jobs -p`; do # does not work with ash - would work with bash for i in $gsmpppd_children; do logger gsmpppd.sh: sending child process $i signal $1 kill -$1 $i done exit 0 } trap "sig_handler HUP" SIGHUP trap "sig_handler INT" SIGINT trap "sig_handler QUIT" SIGQUIT trap "sig_handler KILL" SIGKILL trap "sig_handler TERM" SIGTERM while true; do pid="`fuser "$GSM_DEV"`" if [ -n "$pid" ] && [ "`ps -o comm --no-heading -p $pid`" == "gsm0710muxd" ]; then tty="`dbus-send --system --print-reply --type=method_call --dest=org.pyneo.muxer /org/pyneo/Muxer org.freesmartphone.GSM.MUX.AllocChannel string:pppd | grep '^[ ]*string' | sed 's/^[ ]*string "\(.*\)"$/\1/'`" else [ -n "$GSM_POW" ] && ( echo "0" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_POW" ] && ( echo "1" >"$GSM_POW"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "1" >"$GSM_RES"; sleep 1 ) [ -n "$GSM_RES" ] && ( echo "0" >"$GSM_RES"; sleep 2 ) tty="$GSM_DEV" fi # as the following two lines are non-atomic, this qualifies as 'ugly' /usr/sbin/pppd file "/etc/ppp/$PPP_FILE.options" connect "chat -v -f /etc/ppp/default.chat -T '$PPP_PHONE' -U '$PPP_APN'" <"$tty" 1>&0 & gsmpppd_children="$gsmpppd_children $!" wait done
/etc/init.d/pppd:
#!/bin/sh # # pppd This shell script starts and stops pppd. # # chkconfig: 345 90 40 # description: Pppd manages an ip link via a serial device, in this case a gsm data connection # processname: pppd PATH=/bin:/usr/bin:/sbin:/usr/sbin [ -f /etc/default/rcS ] && . /etc/default/rcS [ -f /etc/default/gsmd ] && . /etc/default/gsmd case "$1" in start) echo -n "Starting PPP daemon: " start-stop-daemon -S -x /etc/ppp/gsmpppd.sh if [ "$?" == "0" ]; then echo "pppd." else echo "(failed.)" fi ;; stop) echo -n "Stopping PPP daemon: " #start-stop-daemon -K -x /etc/ppp/gsmpppd.sh # start-stop-daemon won't find it because it's just an argument to its interpreter pkill gsmpppd.sh pid="`fuser "$GSM_DEV"`" if [ -z "$pid" ] || [ "`ps -o comm --no-heading -p $pid`" != "gsm0710muxd" ]; then [ -n "$GSM_POW" ] && echo "0" >"$GSM_POW" fi echo "pppd." ;; restart|force-reload) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/pppd {start|stop|restart|force-reload}" exit 1 ;; esac exit 0
/etc/ppp/flat.options:
lock noauth crtscts lcp-echo-failure 3 lcp-echo-interval 20 noipdefault usepeerdns defaultroute replacedefaultroute
/etc/ppp/demand.options:
(ungetestet, insbes. der active-filter dürfte wohl unter 'symbolische notation' fallen…)
lock noauth demand idle 20 active-filter ( outbound dst port 53 ) or ( outbound tcp dst ( port 443 or port 80 or port 25 or port 22 ) or ( inbound tcp src ( port 443 or port 80 or port 25 or port 22 ) ) crtscts lcp-echo-failure 3 lcp-echo-interval 20 noipdefault usepeerdns defaultroute replacedefaultroute
/etc/ppp/default.chat:
TIMEOUT 15 "" "\K\K\K\d+++ATH" OK-AT-OK ATZ OK ATE1 OK AT+CFUN? +CFUN:\s1-AT+CFUN=1-OK AT+COPS? +COPS:\s0-AT+COPS=0-OK AT+CGDCONT=1,\"IP\",\"\U\" OK ATD\T ABORT BUSY ABORT DELAYED ABORT "NO CARRIER" ABORT "NO ANSWER" ABORT "NO DIALTONE" ABORT VOICE ABORT ERROR ABORT RINGING TIMEOUT 60 CONNECT ""
/etc/default/pppd:
(Die jeweiligen Werte durch die für den jeweiligen GSM Provider passenden Werte ersetzen - dieses Beispiel ist für EPlus und -Reseller)
PPP_PHONE="*99#" PPP_APN="internet.eplus.de" PPP_FILE="flat"
Falls für den GPRS-Zugang PAP oder CHAP Authentifizierung notwendig ist, noch die jeweiligen Daten in /etc/ppp/pap-secrets oder /etc/ppp/chap-secrets eintragen. Z.B. so (wieder EPlus und -Reseller, in dem Fall chap-secrets):
* "eplus" "gprs" *
Die PPP-Connection kann dann also mit /etc/init.d/pppd gestartet und gestoppt werden. PPP_FILE=“flat” ist gedacht als 'always on' Variante. Ohne Daten-Flatrate sicher nicht zu empfehlen. PPP_FILE=“demand” ist gedacht als 'on demand' Variante - ist aber ungetestet und funktioniert mit an Sicherheit grenzender Wahrscheinlichkeit nicht oder nicht so wie man das will, d.h. man kann davon ausgehen dass bei Benutzung die Welt untergeht.
Symlinks zum Starten via init: s.o. analog zum gsm0710muxd - sinnigerweise sollten dann die S-links nach dem Starten des gsmd oder jedenfalls des gsm0710muxd eingetragen werden, bzw. die K-links vor dem Stoppen des gsmd oder gsm0710muxd. Ohne Flatrate will man das vielleicht lieber manuell machen…
mplayer funktioniert (solange das sounddevice funktioniert).
-vo | performance | scaling |
---|---|---|
xv (default) | * | fullscreen (unter matchbox-panel), ignoriert aspect |
x11 | *** | fullscreen (unter matchbox-panel), skaliert nicht (letterbox) |
fbdev | ** | nein. da der xserver ebenfalls fb benutzt, wird X einfach oben links überschrieben |
fbdev2 | *** | nein. da der xserver ebenfalls fb benutzt, wird X einfach oben links überschrieben |
Audio überlebt Suspend/Resume nicht. Dafür gibt es offenbar schon seit längerem einen Fix von mwester.
opkg install pulseaudio-misc wget http://moko.mwester.net/download/gtkuser.mw10.tgz tar xzf gtkuser.mw10.tgz cd gtkuser; ./install.sh
Supernervig: Neo am USB, per ssh auf dem Neo - *click* Suspend-Timeout schlägt zu.
Was man meistens wahrscheinlich will wäre Suspend auszuschalten falls External Power verfügbar ist.
Der wohl direkte Weg dorthin führt über ein Script das vom apmd beim entsprechenden Event ausgeführt wird:
/etc/apm/event.d/change_power:
#!/bin/sh BAT_PM="0" # FULL EXT_PM="1" # DIM_ONLY # NONE == 2 if [ -r /etc/default/power_management ]; then . /etc/default/power_management fi self="`basename $0`" logger "apm $self[$$] called with $1 $2" if [ "$1" == "change" ] && [ "$2" == "power" ]; then neodpid=`echo \`ps -C neod --no-heading -o pid\`` eval "`grep "^DBUS_SESSION_BUS_ADDRESS=" /proc/$neodpid/environ`" export DBUS_SESSION_BUS_ADDRESS bat_online=`cat /sys/class/power_supply/bat/online` logger "apm $self[$$] bat/online=$bat_online" if [ "$bat_online" == "1" ]; then gconftool-2 -s /desktop/openmoko/neod/power_management -t int $EXT_PM elif [ "$bat_online" == "0" ]; then gconftool-2 -s /desktop/openmoko/neod/power_management -t int $BAT_PM fi logger "apm $self[$$] gconf:/desktop/openmoko/neod/power_management now `gconftool-2 -g /desktop/openmoko/neod/power_management`" fi
Issues:
Das Ganze ist Freerunner und Openmoko 2008 spezifisch (nach erfolgreichem 'opkg update; opkg upgrade'), aber vielleicht auch sonst hilfreich.
Funktioniert wie bei Openmoko 2007.
Der bei 2007 erwähnte Fix von mwester ist zwar eingebaut, Audio überlebt Suspend/Resume aber trotzdem nicht mehr. Abhilfe schafft ein zusätzlicher Pulseaudio Suspend/Resume Cycle nach dem Resume.
In /etc/apm/resume.d/gsm_resume hinzufügen:
... sleep 5 pactl suspend-sink 1 pactl suspend-sink 0 echo "enabling GSM..." ...
Das Suspend-Verhalten wie oben bei 2007 erwähnt ist bei 2008 im Prinzip das selbe. Der neod ist allerdings entfernt worden, das Suspenden übernimmt dafür ompower, was nicht mehr mit gconf sondern mit DBUS-Messages arbeitet.
/etc/apm/event.d/change_power:
#!/bin/sh self="`basename $0`" logger "apm $self[$$] called with $1 $2" if [ "$1" == "change" ] && [ "$2" == "power" ]; then ompowerpid=`echo \`ps -C ompower --no-heading -o pid\`` eval "`grep "^DBUS_SESSION_BUS_ADDRESS=" /proc/$ompowerpid/environ`" export DBUS_SESSION_BUS_ADDRESS bat_online=`cat /sys/class/power_supply/bat/online` logger "apm $self[$$] bat/online=$bat_online" if [ "$bat_online" == "1" ]; then dbus-send --system --dest=org.openmoko.Power / org.openmoko.Power.Core.RequestResourceState string:cpu string:external-power string:on elif [ "$bat_online" == "0" ]; then dbus-send --system --dest=org.openmoko.Power / org.openmoko.Power.Core.RemoveRequestedResourceState string:cpu string:external-power fi logger "apm $self[$$] dbus:org.openmoko.Power/ cpu now `dbus-send --system --print-reply --dest=org.openmoko.Power / org.openmoko.Power.Core.GetResourceState string:cpu`" fi
Dafür gibt's eine eigene Seite.
$killerapplikation
Zutaten:
damit sshpass auch mit encrypted keyfiles umgehen kann, braucht's einen patch:
(das kapsel.sh benutzt btw dieses gepatchte sshpass, und geht davon aus, dass das sshpass.patched heisst)
--- main.c.orig 2008-08-29 13:15:31.000000000 +0200 +++ main.c 2008-08-29 13:28:49.000000000 +0200 @@ -41,6 +41,7 @@ int runprogram( int argc, char *argv[] ); struct { + const char *compare; enum { PWT_STDIN, PWT_FILE, PWT_FD, PWT_PASS } pwtype; union { const char *filename; @@ -52,6 +53,7 @@ struct { static void show_help() { printf("Usage: " PACKAGE_NAME " -fdph command parameters\n" + " -c string string used to detect password prompt\n" " -f filename Take password to use from file\n" " -d number Use number as file descriptor for getting password\n" " -p password Provide password as argument (security unwise)\n" @@ -77,8 +79,12 @@ static int parse_options( int argc, char fprintf(stderr, "Conflicting password source\n"); \ error=-3; } - while( (opt=getopt(argc, argv, "+f:d:p:heV"))!=-1 && error==0 ) { + while( (opt=getopt(argc, argv, "+f:c:d:p:heV"))!=-1 && error==0 ) { switch( opt ) { + case 'c': + // string to detect password prompt + args.compare=optarg; + break; case 'f': // Password should come from a file VIRGIN_PWTYPE; @@ -261,15 +267,15 @@ int handleoutput( int fd ) // We are looking for the string static int prevmatch=0; // If the "password" prompt is repeated, we have the wrong password. static int state; - static const char compare[]="assword:"; +// static const char compare[]="assword:"; char buffer[40]; int ret=0; int numread=read(fd, buffer, sizeof(buffer) ); - state=match( compare, buffer, numread, state ); + state=match( args.compare, buffer, numread, state ); - if( compare[state]=='\0' ) { + if( args.compare[state]=='\0' ) { if( !prevmatch ) { write_pass( fd ); state=0; @@ -296,6 +302,9 @@ int match( const char *reference, const if( reference[state]==buffer[i] ) state++; } + if ( state == strlen(reference) ) { // to match like /string/ and not /string$/ + break; + } } return state;
nach dem zusammenrühren einfach nach /home/root kippen bzw. pfade im script an die location anpassen.
auch noch wichtig: openssh client installieren, der dropbear client wird damit nicht klarkommen.
opkg install openssh-ssh
das ganze ist für Openmoko 2007 zubereitet. das script funkt aber auch als textmode script, oder mit gtk (gnome).
~/.kapsel:
IFACE="eth0" ESSID="luftschleuse.muc.ccc.de" HOST="192.168.2.1" KEYFILE=~/kapselpwd
/usr/share/applications/kapsel.desktop:
[Desktop Entry] Encoding=UTF-8 Name=Kapsel Comment=Open/Close Kapsel Exec=/home/root/kapsel.sh Icon=muc3greyknotonwhite128 Terminal=false Type=Application Categories=GTK;Application;Utilities; MimeType=text/x-vcard; SingleInstance=true StartupNotify=true
/home/root/kapsel.sh:
#!/bin/sh if [ "$phase" != "2" ]; then if [ -e ~/.kapsel ]; then . ~/.kapsel export IFACE export ESSID export HOST export KEYFILE else echo "Resource-file ~/.kapsel not found. Exiting." exit 1 fi if [ -e /tmp/kapsel_result.tmp ]; then rm -f /tmp/kapsel_result.tmp fi export phase="2" if [ -n "$DISPLAY" ]; then /home/root/gtkdialog -e "$0" exit fi fi _ssh() { if [ -n "$password" ]; then if [ -n "$KEYFILE" ]; then result=`/home/root/sshpass.patched -c "Enter passphrase for key " ssh "$1"@"$HOST" -T -o "ForwardX11 no" -o "NumberOfPasswordPrompts 1" -o "PasswordAuthentication no" -i "$KEYFILE" 2>&1 <<eof $password eof ` else result=`/home/root/sshpass.patched -c "Password:" ssh "$1"@"$HOST" -T -o "ForwardX11 no" -o "NumberOfPasswordPrompts 1" -o "PubkeyAuthentication no" 2>&1 <<eof $password eof ` fi else if [ -n "$KEYFILE" ]; then result=`ssh "$1"@"$HOST" -T -o "ForwardX11 no" -o "NumberOfPasswordPrompts 1" -o "PasswordAuthentication no" -i "$KEYFILE" 2>&1` else result=`ssh "$1"@"$HOST" -T -o "ForwardX11 no" -o "NumberOfPasswordPrompts 1" -o "PubkeyAuthentication no" 2>&1` fi fi echo "$result" >/tmp/kapsel_result.tmp } if [ "`iwconfig "$IFACE" |grep ESSID|sed \"s/.*ESSID:\\\"\(.*\)\\\".*/\1/\"`" ! = "$ESSID" ]; then ifdown "$IFACE" iwconfig "$IFACE" essid "$ESSID" ifup "$IFACE" fi if [ -n "$DISPLAY" ]; then export MAIN_DIALOG=' <window title="Kapsel" icon-name="/usr/share/pixmaps/muc3greyknotonwhite128.png"> <vbox> <text> <variable>RESULT</variable> <input>[ -e /tmp/kapsel_result.tmp ] && cat /tmp/kapsel_result.tmp</input> </text> <button> <label>Exit</label> </button> <hbox> <button> <label>close</label> <action>_ssh close</action> <action type="refresh">RESULT</action> </button> <button> <label>open</label> <action>_ssh open</action> <action type="refresh">RESULT</action> </button> <button> <label>entrance</label> <action>_ssh backdoor</action> <action type="refresh">RESULT</action> </button> </hbox> <hbox> <entry> <variable>password</variable> </entry> <text> <label>Password:</label> </text> </hbox> <pixmap> <input file>/usr/share/pixmaps/muc3greyknotonwhite128.png</input> </pixmap> </vbox> </window> ' else action="$1" if [ "$action" != "open" ]; then action="close" fi _ssh "$action" echo "$result" fi
das logo gehört nach /usr/share/pixmaps/