Neo FreeRunner是Openmoko公司設計生產的手機,它從硬件到軟件都是開放的,主要面向的是開發者而不是終端用戶。目前FreeRunner已經十幾種不同的發行版,其中包括Android,SHR,Debian,Qt Extended,Gentoo等等。大家可以從Openmoko的官網上找到更多信息。(見Resource)
Neophysis是FreeRunner上第一個採用oFono的發行版。即使不用Neophysis,也很容易在FreeRunner上用oFono來控制modem。FreeRunner採用的是TI的calypso modem,據說是一款功能很完善的modem。
連接FreeRunner
1. 用USB線連接FreeRunner。
2. 在host PC上能夠看到eth1或者usb1 interface.
3. sudo ifconfig eth1 192.168.0.200
4. ping 192.168.0.202。 這是FreeRunner默認的ip地址。應該能ping通。
5. 在本地的/etc/network/interfaces中加入以下config,設置ip forwarding.
auto eth1
iface eth1 inet static
address 192.168.0.200
netmask 255.255.255.0
up iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
up echo 1 > /proc/sys/net/ipv4/ip_forward
down iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
down echo 0 > /proc/sys/net/ipv4/ip_forward
設置FreeRunner
1. ssh [email protected]。應該能直接登陸到FreeRunner上。
2. 修改/etc/network/interfaces。需要把替換成你所在的DNS server地址。
auto usb0
iface usb0 inet static
address 192.168.0.202
netmask 255.255.255.0
network 192.168.0.0
up route add default gw 192.168.0.200 metric 8
up echo domain sh.intel.com > /etc/resolv.conf
up echo search sh.intel.com >> /etc/resolv.conf
up echo nameserver >> /etc/resolv.conf
down route del default gw 192.168.0.200 metric 8
3. 如果需要設http代理的話:
export http_proxy=http://proxy_server:proxy_port/
4. 創建4個腳本。
- alloc.sh
dbus-send --system --print-reply --type=method_call --dest=org.freesmartphone.omuxerd /org/freesmartphone/GSM/Muxer org.freesmartphone.GSM.MUX.AllocChannel string:"1" int32:0
- power_on.sh
stty -F /dev/ttySAC0 -echo
echo "1" > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on - reset_modem.sh
stty -F /dev/ttySAC0 -crtscts
echo "0" > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
stty -F /dev/ttySAC0 -echo
echo "1" > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on有兩種啓動oFono的辦法。1. 在Linux Host上啓動oFono,通過nc重定向Slave的輸入輸出到Host上面。nc是一個可以把tty串口輸入重定向到TCP/IP端口的程序。以下主要介紹的是這種方法。2. 在FreeRunner上直接運行oFono。你需要從Openmoko網站上下載交叉編譯環境。但大致思路還是一樣的。在Host上控制oFono1. 在FreeRunner上,需要先停止已有的Telephony服務。在SHR OS上,它默認是使用fso-ogsmd和TI calypso modem通信的。root@om-gta02 ~ $ /etc/init.d/frameworkd stop2. 運行alloc.sh從Mux server上創建一個新的channelroot@om-gta02 ~ $ ./alloc.sh
method return sender=:1.22 -> dest=:1.27 reply_serial=2
string "/dev/pts/1"
int32 13. 重定向輸入和輸出到2000端口上nc -l -p 2000 < /dev/pts/1 > /dev/pts/14. 在Linux host上就可以通過Telenet訪問,並看到“AT-Command Interpreter ready”。xxx@xxx:~/obexd$ telnet 192.168.0.202 2000
Trying 192.168.0.202...
Connected to 192.168.0.202.
Escape character is '^]'.
AT-Command Interpreter readyATOK5. 修改/usr/local/etc/ofono/modem.conf[freerunner]
Driver=phonesim
Address=192.168.0.202
Port=2000
Modem=calypso
6. sudo src/ofonod -nd '*'
7. ofono/test/enable-modem /freerunner
8. ofono/test/online-modem /freerunner
9. ofono/test/create-context cmnet
10. ofono/test/activiate-context
Resource