How to setup GPRSΒΆ

Warning

This solution will work from v0.9+

Warning

This is an example specific to USB GPRS modem “Huawei HILink E3256 Adapter”. There are many types of 3G modems/ dongles and each of their installations/ configurations is completely different. This example will serve to give you an idea what needs to be done. You will have to Google your way to success.

Step 0: ssh into your Raspberry Shake

Step 1: Determine what USB devices are connected and confirm you see GPRS modem

$ lsusb

Example output:

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 007: ID 12d1:1f01 Huawei Technologies Co., Ltd.
Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 005: ID 1c4f:0026 SiGma Micro
Bus 001 Device 006: ID 046d:c05b Logitech, Inc. M-U0004 810-001317 [B110 Optical USB Mouse]

In this example, Bus 001 Device 007 is what is of interest to us.

Step 2: install sg3-utils

$ sudo apt-get install sg3-utils

Step 3: restart

$ sudo reboot; exit

Step 4: ssh back into your Raspberry Shake and re-determine GPRS modem still appears

$ lsusb

Example output:

Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 12d1:14db Huawei Technologies Co., Ltd.
Bus 001 Device 005: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 006: ID 046d:c05b Logitech, Inc. M-U0004 810-001317 [B110 Optical USB Mouse]

Step 5: Use this command to adjust the configuration and tell the system to bring up the HUAWEI GPRS as eth1

$ sudo /usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00

Example valid response:

SCSI Status: Good

Sense Information:
sense buffer empty

Step 6: Confirm device appears as eth1

$ sudo ifconfig -a

Example valid response:

docker0   Link encap:Ethernet  HWaddr 02:42:9e:c6:cf:14
  inet addr:172.17.0.2  Bcast:0.0.0.0  Mask:255.255.0.0
  inet6 addr: fe80::f125:5a45:7f57:ff18/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:1542 errors:0 dropped:0 overruns:0 frame:0
  TX packets:1548 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:332612 (324.8 KiB)  TX bytes:234274 (228.7 KiB)

eth0      Link encap:Ethernet  HWaddr b8:27:eb:44:65:26
  inet addr:10.18.101.108  Bcast:10.18.101.255  Mask:255.255.255.0
  inet6 addr: fe80::baa1:df69:36b5:ecb3/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:126048 errors:0 dropped:1485 overruns:0 frame:0
  TX packets:46 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:6134619 (5.8 MiB)  TX bytes:6330 (6.1 KiB)

eth1      Link encap:Ethernet  HWaddr 58:2c:80:13:92:63
  inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
  inet6 addr: fe80::3d2:b0ae:25df:f0c5/64 Scope:Link
  UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  RX packets:1608 errors:0 dropped:0 overruns:0 frame:0
  TX packets:2091 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:1000
  RX bytes:230145 (224.7 KiB)  TX bytes:398195 (388.8 KiB)

...
...
...

eth1 now exists and IP 192.168.1.x is HUAWEI’s default subnet so we are good.

Step 7: Make this change permanent so that the GPRS modem comes up automatically at boot

$ sudo nano /etc/udev/rules.d/10-Huawei.rules

Add:

SUBSYSTEMS=="usb", ATTRS{modalias}=="usb:v12D1p1F01*", SYMLINK+="hwcdrom", RUN+="/usr/bin/sg_raw /dev/hwcdrom 11 06 20 00 00 00 00 00 01 00"

Step 8: Adjust interfaces

$ sudo nano /etc/network/interfaces

At end, add::

allow-hotplug eth1
iface eth1 inet dhcp

Step 9: Reboot

$ sudo reboot