ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2014年11月4日 星期二

link - 手動啟動 ppp

from http://mafipulation.org/blagoblig/

belows are the copies:

Wed, 03 Jul 2013

Japanese data SIM adventures
I've just arrived in Osaka, and so has my b-mobile Visitor SIM, which promises a prepaid data connection. Unfortunately, my phone doesn't even attempt a data connection, because the SIM won't let the phone register on the network at large - and it just gives up.

I was pretty grumpy at having a non-returnable $30 SIM I can't use. So I booted my phone into baseband mode (where the baseband IC presents itself directly on the phone's USB port, allowing me to send it AT commands). Checking the network registration with AT+CREG yields 3 - registration denied. But the GPRS registration, AT+CGREG, is valid! Evidently not a situation the phone's designers considered. But how do we use it?

The answer is to use the +CGDATA command, which opens a connection we can use for PPP. Now you just need to set up PPP... update: there is a super neat solution by Josua Dietze, check the bottom of this post for the link! Setting up PPP on Android
To make this work, you need a rooted phone with direct access to your baseband's AT-style port. On my Droid 4 this is /dev/ttyUSB4. If you don't know what this means, stop reading here.

I had to build chat and ended up building my own pppd because the Android one logs to the Android logs (duh), so here they are as binaries for you: chat, and pppd. I put them in /system/xbin.

You then need to write the following files: /etc/ppp/options.mobile, changing ttyUSB4 for your tty:
ttyUSB4
modem
passive
novj
defaultroute
noipdefault
usepeerdns
persist
holdoff 10
maxfail 0
noauth
nodetach
debug
You will probably want to remove nodetach and/or debug once you have it working, depending on how you run it.

/etc/ppp/peers/mobile, changing (or removing) the user/password lines:
file /etc/ppp/options.mobile
user "bmobile@fr"
password "bmobile"
connect "/system/xbin/chat -v -t15 -f /etc/ppp/chat.mobile"
Now for /etc/ppp/chat.mobile, where you must replace bmobile.ne.jp with your APN:
TIMEOUT 10
ABORT 'ERROR'
ABORT 'BUSY'
ABORT 'NO CARRIER'
'' ATZ OK
'AT+CGDCONT=1,"IP","bmobile.ne.jp"' OK
AT+CGDATA="PPP",1 CONNECT
Finally, /etc/ppp/ip-up, which you must then chmod 755:
#!/system/bin/sh

ip route add default via $4
setprop net.dns1 $DNS1
setprop net.dns2 $DNS2
You should now be able to run the whole shebang with:
/system/xbin/pppd call mobile
If it runs all the way to printing you some IP addresses and running the ip-up script, you are a winner. Note that it may not replace the default route if you already have one (if you're on wifi, for example).

Of course, apps which use the Android network manager to decide if they're connected will still refuse to work - Google Maps won't let you search, for example. Any suggestions for tricking the manager?
The right and obvious answer
The amazing Josua Dietze has already done all this, wrapped it into an app, and sorted out all the network manager issues. Amazing! Get it from the Play Store.

沒有留言:

標籤

網誌存檔