How to setup USB GPRS#
Contents
Example instructions for setting up USB-type GPRS modems with Raspberry Shake.
Warning
This solution will work from v0.9+
Warning
There are many types of 3G modems/ dongles and each of their installations/ configurations is completely different. These examples will serve to give you an idea what needs to be done. You will have to Google your way to success.
Example 1: Huawei HILink E3256 Adapter#
Step 0: Plug the GPRS modem into the USB port on the Raspberry Pi computer
Step 1: ssh into your Raspberry Shake
Step 2: 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 3: install sg3-utils
$ sudo apt-get install sg3-utils
Step 4: restart
$ sudo reboot; exit
Step 5: 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 6: 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 7: 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 8: 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 9: Adjust interfaces
$ sudo nano /etc/network/interfaces
At end, add::
allow-hotplug eth1
iface eth1 inet dhcp
Step 10: Reboot
$ sudo reboot
Example 2: Huawei Mobile Broadband Mobile Wifi Smart E82778#
Step 0: Plug the GPRS modem into the USB port on the Raspberry Pi computer
Step 1: ssh into your Raspberry Shake
Step 2: Determine what USB devices are connected and confirm you see GPRS modem
$ lsusb
Example output:
Bus 001 Device 005: ID 12d1:14fe Huawei Technologies Co., Ltd.
Bus 001 Device 004: ID 1951:1000 Hyperstone AG
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
In this example, Bus 001 Device 005 is what is of interest to us. Note the Huawei at 12d1:14fe.
Step 3: Now we try to set the Huawei as wwan0 device (there’s a lot of ways to do that) we should use:
$ sudo usb_modeswitch -v 0x12d1 -p 0x14fe -J
Step 4: Now the Huawei will turn into wwan0 device, to verify use again lsusb:
$ lsusb
Example output: ::
Bus 001 Device 006: ID 12d1:1506 Huawei Technologies Co., Ltd. E398 LTE/UMTS/GSM Modem/Networkcard
Bus 001 Device 004: ID 1951:1000 Hyperstone AG
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
and
$ ifconfig -a | grep wwan0
Example output (shortened): ::
wwan0 Link encap:Ethernet HWaddr 0c:5b:8f:27:9a:64
Step 5: Now that you have your device connected as wwan0, in the next step we will create a service to run the necessary command at boot
$ sudo nano /lib/systemd/system/usbmode.service
Edit the file with the lines:
[Unit]
Description=USB MODE SWITCH
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/sbin/./usb_modeswitch -v 0x12d1 -p 0x14fe -J
[Install]
WantedBy=multi-user.target
Step 6: Enable the service at boot using:
$ sudo systemctl enable usbmode.service
Step 7: Reboot
$ sudo reboot
NOTE: There’s a lot of ways to make the HUAWEI E8278 work.
GPRS modems used by other Shakers#
Let us know what tech you are using!: Send us a message on the Raspberry Shake Forum.
In Germany and elsewhere: Geneko, Gateway Model GWG, 9-36 VDC