飛ぶように売れているRaspberry Piがすっかり積みボードになっていたところ、ドコモのL-03Dって使えるの?というお題をもらったのでやってみる。
     
    
本記事は以下を参考にさせて頂きました
    ちゃちゃっと♪ @ぼこぼこな気分@ - docomo LG L-03D + iijmio[128Kbps]
    
SIMはIIJmioの高速モバイル/Dサービスのものを使います。
理由は、「借りたものがそうだったから」というだけ。
以下、CIDが11であることを前提として書かれています。もしお手元のCIDが別の値の場合は読み替えて下さい。
Raspberry PiはUSBの給電能力が低いため、セルフパワーのUSBハブが必要です。
OSイメージは最新(2013.5.4現在)の2013-02-09-wheezy-raspbianを使用しました。
追加パッケージとして、以下をインストールします。
Linux界隈では語り尽くされている様ですが、多くのUSB接続型データ通信モジュールは、Windows環境で簡単に使えるようにするために接続直後はCD-ROMとして見えます。
    ドライバ類のファイルをここに置いておくことでインストールを簡単にするためですね。
    これが仇となり、Linuxではそのままでは通信モジュールとして認識できません。一旦アンマウントして、USBSerialとして再認識させるという面倒な手続きが必要です。
    この手間から解放されるために、usb-modeswitchを使います。
説明するまでも無いですが、インストール手順は以下の通り。
途中、
Do you want to continue [Y/n]?と聞かれたら、そのまま[Enter]してください。
現在のバージョンでは、L-03Dが定義済みのため特に設定しなくても認識します。
$ grep 6327 /lib/udev/rules.d/40-usb_modeswitch.rules
ATTRS{idVendor}=="1004", ATTRS{idProduct}=="6327", RUN+="usb_modeswitch '%b/%k'"
    
まずは、pppconfigで基本的な設定を行います。
$ sudo pppconfig

"Create a connection"を選択して、Ok(Tabで移動します)

"Provider Name"に"iij"と入力し、Ok

"Configure Nameservers (DNS)"は"Dynamic"を選択し、Ok

"Authentication Method for iij"は"PAP"を選択し、Ok

"User Name"に"mio@iij"と入力し、Ok

"Password"に"iij"と入力し、Ok

"Speed"は"115200"のままで、Ok

"Pluse or Tone"は"Tone"を選択し、Ok

"Phone Number"に"ATDT*99***11#"と入力し、Ok

"Choose Modem Config Method"は"No"を選択

"Manually Select Modem Port"に"/dev/ttyUSB2"と入力し、Ok

最終的にこうなっていることを確認し、"Finished Write files and return to main menu."を選択して、Ok

これで設定は終了。Okでメニューに戻る

"Quit"を選択し、Okでpppconfigを終了。
お好みのエディタを使用し、"/etc/chatscripts/iij"を以下の様に編集する。
※'' ATZの下に'' ATHを追加するだけです。
ABORT BUSY ABORT 'NO CARRIER' ABORT VOICE ABORT 'NO DIALTONE' ABORT 'NO DIAL TONE' ABORT 'NO ANSWER' ABORT DELAYED '' ATZ '' ATH OK-AT-OK "ATDTATDT*99***11#" CONNECT \d\c
設定はこれでおしまい。
ponコマンドで接続します。
$ sudo pon iij
ちょっと疎通
$ ping www.raspberrypi.org PING lb.raspberrypi.org (93.93.128.211) 56(84) bytes of data. 64 bytes from 93.93.128.211: icmp_req=1 ttl=45 time=728 ms 64 bytes from 93.93.128.211: icmp_req=2 ttl=45 time=989 ms 64 bytes from 93.93.128.211: icmp_req=3 ttl=45 time=719 ms 64 bytes from 93.93.128.211: icmp_req=4 ttl=45 time=759 ms 64 bytes from 93.93.128.211: icmp_req=5 ttl=45 time=729 ms ^C --- lb.raspberrypi.org ping statistics --- 6 packets transmitted, 5 received, 16% packet loss, time 7239ms rtt min/avg/max/mdev = 719.577/785.417/989.519/102.940 ms
/var/log/messagesを見てるとこんな感じ。
$ tail -f /var/log/messages
May  4 21:59:27 raspberrypi pppd[6890]: pppd 2.4.5 started by root, uid 0
May  4 21:59:28 raspberrypi chat[6892]: abort on (BUSY)
May  4 21:59:28 raspberrypi chat[6892]: abort on (NO CARRIER)
May  4 21:59:28 raspberrypi chat[6892]: abort on (VOICE)
May  4 21:59:28 raspberrypi chat[6892]: abort on (NO DIALTONE)
May  4 21:59:28 raspberrypi chat[6892]: abort on (NO DIAL TONE)
May  4 21:59:28 raspberrypi chat[6892]: abort on (NO ANSWER)
May  4 21:59:28 raspberrypi chat[6892]: abort on (DELAYED)
May  4 21:59:28 raspberrypi chat[6892]: send (ATZ^M)
May  4 21:59:28 raspberrypi chat[6892]: send (ATH^M)
May  4 21:59:28 raspberrypi chat[6892]: expect (OK)
May  4 21:59:28 raspberrypi chat[6892]: ATZ^M^M
May  4 21:59:28 raspberrypi chat[6892]: OK
May  4 21:59:28 raspberrypi chat[6892]:  -- got it
May  4 21:59:28 raspberrypi chat[6892]: send (ATDT*99***11#^M)
May  4 21:59:28 raspberrypi chat[6892]: expect (CONNECT)
May  4 21:59:28 raspberrypi chat[6892]: ^M
May  4 21:59:28 raspberrypi chat[6892]: ATH^M^M
May  4 21:59:28 raspberrypi chat[6892]: OK^M
May  4 21:59:28 raspberrypi chat[6892]: ATDT*99***11#^M^M
May  4 21:59:28 raspberrypi chat[6892]: CONNECT
May  4 21:59:28 raspberrypi chat[6892]:  -- got it
May  4 21:59:28 raspberrypi chat[6892]: send (\d)
May  4 21:59:29 raspberrypi pppd[6890]: Serial connection established.
May  4 21:59:29 raspberrypi pppd[6890]: Using interface ppp0
May  4 21:59:29 raspberrypi pppd[6890]: Connect: ppp0 <--> /dev/ttyUSB2
May  4 21:59:30 raspberrypi pppd[6890]: PAP authentication succeeded
May  4 21:59:30 raspberrypi kernel: [11270.590696] PPP BSD Compression module registered
May  4 21:59:30 raspberrypi kernel: [11270.622217] PPP Deflate Compression module registered
May  4 21:59:34 raspberrypi pppd[6890]: Could not determine remote IP address: defaulting to 10.64.64.64
May  4 21:59:36 raspberrypi pppd[6890]: local  IP address 10.197.223.48
May  4 21:59:36 raspberrypi pppd[6890]: remote IP address 10.64.64.64
May  4 21:59:36 raspberrypi pppd[6890]: primary   DNS address 202.232.2.2
May  4 21:59:36 raspberrypi pppd[6890]: secondary DNS address 202.232.2.3
$ ifconfig ppp
ppp0      Link encap:Point-to-Point Protocol
          inet addr:10.197.223.48  P-t-P:10.64.64.64  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:19 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:910 (910.0 B)  TX bytes:1021 (1021.0 B)

通信中...(左上のはシリアルコンソール用のUSB-Serialアダプタ)
poffコマンドで切断します。
$ sudo poff
/var/log/messagesを見てるとこんな感じ。
$ tail -f /var/log/messages May 4 22:02:11 raspberrypi pppd[6890]: Terminating on signal 15 May 4 22:02:11 raspberrypi pppd[6890]: Connect time 2.6 minutes. May 4 22:02:11 raspberrypi pppd[6890]: Sent 3988 bytes, received 4677 bytes. May 4 22:02:11 raspberrypi pppd[6890]: Connection terminated. May 4 22:02:11 raspberrypi pppd[6890]: Exit.