RecentChanges TextFormattingRules AllWikiTopics OrphanedWikiTopics ToDoWikiTopics WikiLockList RSS Export2HTML WikiSearch SetUsername StartingPoints Home |
MF627
3G USB donglePackages we will require:
sudo apt-get update Configure postfix as an Internet mail server. Convert from CD-ROM to modemThe '3' 3G USB dongle I'm connecting to my Raspberry Pi is a ZTE MF627. It has two modes, when it's originally plugged in it appears as a USB CD-ROM, for automatically installing software drivers, and has to be ejected before it turns into a network device. When the device is a CD-ROM it's ID is 19d2:2000, when it's a network device the ID is 19d2:0031. USB Modeswitch or UDEVIf you have a modern Rasprian then USB Modeswitch will be installed and it will automatically eject the CD-ROM device for you. Otherwise you can run the eject command from udev, like this. Create: /etc/udev/rules.d/10-ZTE_MF627.rules with this contents: SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SUBSYSTEMS=="usb", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", RUN+="/bin/sh -c '/bin/sleep 12; /usr/bin/eject %k; /vib/sleep 1; /usr/bin/eject %k;'&", OPTIONS+="last_rule" Now when the dongle is inserted the udev daemon spots the device and sends the eject command. You can check the device ID with lsusb. The device will appear as three tty ports when its in modem mode.
We can test the device now with chat: chat -s -v '' ATZ OK AT+CSQ OK >/dev/ttyUSB1 </dev/ttyUSB1 in the output you'll see the current signal strength. Once you have the device switched to be a modem you can disable the CD-ROM. chat -s -v '' ATZ OK AT+ZCDRUN=8 OK >/dev/ttyUSB1 </dev/ttyUSB1 The device will now only appear as the serial modem. Run pppdFirst we'll create a pppd config file and it's associated modem chat file. Create: /etc/ppp/peers/giffgaff with this contents: /dev/ttyUSB2 Create: /etc/ppp/peers/giffgaff.chat with this contents: ABORT BUSY ABORT 'NO CARRIER' Create: /etc/ppp/ip-up.d/default_route with this contents: #!/bin/sh -e Make it runnable chmod a+x /etc/ppp/ip-up.d/default_route and test with pon giffgaff Run gammuThis will run gammu from udev when the device is added, and stop it when the device is removed. Create: /usr/local/bin/ZTE_MF627 with this contents: #!/bin/sh -e KERNEL=="ttyUSB0", SUBSYSTEM=="tty", ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="0031", RUN+="/usr/local/bin/ZTE_MF627", OPTIONS+="last_rule" MF627 is mentioned on: RaspberryPi MF627 3G USB modem |