Thanks to EMobile, for a rate as low as 6700円/month, it is possible to have full unlimited 3.5G access (7.8Mbps) almost anywhere in Japan (currently covering 90% of Japan according to their website).

This comes with a D02HW 3G modem. What’s so good with this modem? Pretty easy: connect it on windows. It is detected as a CD-ROM drive at first, and you get the drivers CD just by plugging the usb key. Once you install the driver, you get an application you can run, and you just have to click one button to get online.
So, plug the USB modem, installation program is launched thanks to autorun, install, reboot (heh it’s win32), and get online.

On Linux, it’s not that easy.

First, the fact that this modem identifies itself as a “mass storage device” by default doesn’t makes things easy for linux. You need to manually load the usbserial driver by providing it with vendor/device settings. This is pretty much anywhere.

modprobe usbserial vendor=0x12d1 product=0x1003

With this command (use rrmmod first if you already had usbserial loaded) you’ll get 3 new serial devices (or less, according to some sources on google). The most important one is the first one: ttyUSB0 (unless you already got other usb serial devices).

Now you’ll need a pppd chat script. This one is pretty much easy too in theory, however I felt into a problem that no other source on internet fixed. I first copied my script I use for Orange France, however I didn’t know the APN for EMobile, and it resulted into me being unable to connect at all.
So, here is a chat script that will work and set the APN too:

TIMEOUT 5
ABORT 'BUSY'
ABORT 'NO CARRIER'
ABORT 'ERROR'
ABORT '+COPS: 0^M'
'' ATZ
SAY "Checking if we have network...\n"
OK-AT-OK AT+COPS?
'+COPS: 0,' ''
OK "ATE1V1&D2&C1S0=0+IFC=2,2"
OK "ATS0=0"
OK AT+cgdcont=1,"IP","emb.ne.jp","",0,0
SAY "Connecting to GPRS/EDGE/UMTS/3G/3G+ ...\n"
OK ATD*99***1#
CONNECT ''

Save it for example as “emobile.chat”. Now comes the pppd command line. The one I use:

pppd connect 'chat -e -s -f /root/emobile.chat' /dev/ttyUSB0 460800 \
        modem user em password em \
        nodetach debug nolock defaultroute usepeerdns usepeerwins \
        noccp

usepeerwins is pretty much useless, but helps avoiding race condition on some modems according to pppd’s manpage (including Huawei E220, which is D02HW’s chipset according to lsusb).

Those options are verbose (you’ll get a lot of stuff you don’t care about when running pppd), and pppd won’t go in background once connected. This allows you to ^C the connection easily.