Archive for Oktoober, 2012

ASUS WL-500gP v1 + HUAWEI E303 + OpenWRT = 3g hotspot

J.L. "26." Oktoober 2012 1:21


So yes, It works. Kind of. Although it is of no use, if you need wifi and decent access speeds. OpenWRT uses drivers that are unable to whitstand any meaningful traffic.

I even tried switching to a ipw2200 driver since i had some Intel’s old MiniPCI cards lying around (WM3B2200BG). Too bad OpenWRT, including the currently quite up/to/date  Attitude Adjustment simply crashes with these, as soon as drivers get loaded. So it is a nice project but of no use with this hardware. But… there is a solution!

Enter modified Oleg firmware with USB 3G dongle support. All i had to do was:

1. Download firmware from the site above

2. telnet to the router & edit /usr/local/etc/usb_modeswitch.conf

it is almost the same setup as below, except i added  MessageEndpoint parameter, probably with a value of 0×00 or something similar.

Everything  can be setup through web. Vendor & Product ID you can find down below — the values that you modeswitch your dongle to. usb dev location id is 1.0 for the lower port and the rest is pretty much self explanatory. Oh, and remove pin check from dongle. After I did that, i got it to work.

As for past generations — how I almost got it to work with OpenWRT:

OpenWRT setup
Ok. So I had both the need and the means to make it happen. What I did:

1. Flashed OpenWRT Backfire 10.03 to an old ASUS router.  This link covers the issue completely.

Basically, what you need to do is to download a compatible image, put router to the diagnostic mode and upload OpenWRT image to the device with tftp.

2. Installed additional required packets and did initial setup. Extremely helpful page here.

You can do all the simple setup stuff through the web interface; quite frankly, although it has some hiccups when you are not too keen on saving all the changes at the right time, it seems doing ip and wifi setup through web has advantages. Mainly, less confusion and you can avoid the off change that wifi will not start at reboot.

I did however install the packages and set up ssh through command line as it seemed much faster that way.

Now for the packets. As stated on linked page above, you need to do the following:

# opkg update

# opkg install  usbutils kmod-usb-serial kmod-usb2 kmod-usb-uhci kmod-usb-ohci usb-modeswitch comgt

NB! Note the last two packages! E303 is a multi-device, meaning it has some sort of flash drive and a sd-card adapter in it in addion to the 3g modem. To get to use the latter, I used usb_modeswitch. You can try to install usb-modeswitch-data also, but for some reason it failed for me. The latter has all the configs for different modems. As it failed, I downloaded the config pack from here.

To be able to find the right file, you need to know modems vendor and product ids. To get them, type lsusb. For this praticular modem it is 12d1:14fe
After consulting the unpacked download I created /etc/usb-modeswitch.conf:

DefaultVendor= 12d1
DefaultProduct= 14fe

TargetVendor= 12d1
TargetProduct= 1506

MessageContent= “55534243123456780000000000000011062000000100000000000000000000″


Now, running usb_modeswitch will disconnect 12d1:14fe and replace with a 12d1:1506

To use it as a modem, you need to configure your system to attach usbserial module to it. For that you can create /etc/modules.d/60-usb-serial:

usbserial vendor=0×12d1 product=0×1506 maxSize=4096
NB! mind the product code! Remember, it changes during modeswitch!

Next, you should add  definition for ppp0 in the /etc/config/network:

#### 3G configuration
config interface        ppp0
option ifname   ppp0
option proto    3g
option device   /dev/ttyUSB0
option apn      internet
option pincode  1234

and also add it to the wan zone in /etc/config/firewall:

config zone
option name             wan
option input    REJECT
option output   ACCEPT
option forward  REJECT
option masq             1
option mtu_fix  1
option network ‘wan ppp0′

To enable 3g after reboot, i also added a quick check to /etc/rc.local:

lsusb | grep 12d1:14fe && /usr/bin/usb_modeswitch && ifup ppp0

I also configued hotplug to enable the modem and bring the connection up when modem is inserted, and to stop ppp when the modem is removed. For that I used a hotplug2 script /etc/hotplug.d/usb/20-usb-huawei-e303:


# the product string for the Huawei E303 when inserted and not modeswitched yet.
# lsusb -v:
#  idVendor           0×12d1 Huawei Technologies Co., Ltd.
#  idProduct          0×14fe
#  bcdDevice            1.02


# the product string for the Huawei E303 after modeswitch.
# lsusb -v:
# idVendor           0×12d1 Huawei Technologies Co., Ltd.
# idProduct          0×1506 E398 LTE/UMTS/GSM Modem/Networkcard
# bcdDevice            1.02


xname=$(echo “$DEVICENAME” | cut -f2 -d:)

if   [ “$PRODUCT” = “$HUAWEI_E303_ORIG” ] ; then

[ “$ACTION” = “add” ] && {

[ “$xname” = “1.1″ ] &&  {
logger “Found event of adding $PRODUCT, devicename $DEVICENAME, xname $xname - running usb_modeswitch”
/usr/bin/usb_modeswitch 2>&1 | logger


elif [ “$PRODUCT” = “$HUAWEI_E303_SWITCHED” ] ; then

if [ “$ACTION” = “add” ] ; then

[ “$xname” = “1.5″ ] &&  {
logger “Found event of adding $PRODUCT, devicename $DEVICENAME, xname $xname - running ifup ppp0″
ifup ppp0

elif [ “$ACTION” = “remove” ] ; then

[ “$xname” = “1.0″ ] &&  {
logger “Found event of removing $PRODUCT, devicename $DEVICENAME, xname $xname - running ifdown ppp0″
ifdown ppp0
sleep 5
kill $(grep ^ifname=ppp0 /proc/*/environ | cut -f3 -d/)


That should pretty much be it. Reboot and test it out. If I did not make any mistakes in this post, you should have a working set.

PS: Full text of all the modified files can be downloaded from here.