Difference between revisions of "Ericsson F3507g Mobile Broadband Module"

From ThinkWiki
Jump to: navigation, search
m (added the x200t; I just got one with the ericsson device)
Line 17: Line 17:
 
*Support for the CDC Ethernet interface appears only in kernel 2.6.28.8. But if your kernel is older, you can still connect to the net using one of the "Modem" interfaces.
 
*Support for the CDC Ethernet interface appears only in kernel 2.6.28.8. But if your kernel is older, you can still connect to the net using one of the "Modem" interfaces.
  
As Ericsson's naming scheme suggests, idealy we would use <tt>/dev/cdc-wdm0</tt> for controlling the card, <tt>usb0</tt> as a network device, <tt>/dev/ttyACM0</tt> or <tt>/dev/ttyACM1</tt> as a modem, and <tt>/dev/ttyACM2</tt> for GPS. This works for manual testing, but unfortunately, due to [http://markmail.org/message/2sd7culbgekugow2 limitations] of <tt>chat</tt>, does not play very well in scripts. So, instead of <tt>/dev/cdc-wdm0</tt>, for controlling the card we will use <tt>/dev/ttyACM1</tt>.
+
As Ericsson's naming scheme suggests, we would use <tt>/dev/cdc-wdm0</tt> for controlling the card, <tt>usb0</tt> as a network device, <tt>/dev/ttyACM0</tt> as a modem, and <tt>/dev/ttyACM2</tt> for GPS.
  
 
==Turning the card on==
 
==Turning the card on==
Line 24: Line 24:
 
  AT+CPIN?
 
  AT+CPIN?
  
to <tt>/dev/ttyACM1</tt>. You can do it with any terminal terminal program like <tt>cu</tt> or <tt>minicom</tt>. If the answer is
+
to <tt>/dev/cdc-wdm0</tt>. You can do it with any terminal terminal program like <tt>cu</tt> or <tt>minicom</tt>. If the answer is
  
 
  +CPIN: READY
 
  +CPIN: READY
Line 36: Line 36:
 
  AT+CPIN="YOUR-PIN"
 
  AT+CPIN="YOUR-PIN"
  
to <tt>/dev/ttyACM1</tt>. Now the card can be turned on by sending  
+
to <tt>/dev/cdc-wdm0</tt>. Now the card can be turned on by sending  
  
 
  AT+CFUN=1
 
  AT+CFUN=1
  
to <tt>/dev/ttyACM1</tt>. The answer should be
+
to <tt>/dev/cdc-wdm0</tt>. The answer should be
  
 
  +PACSP0
 
  +PACSP0
Line 48: Line 48:
 
  AT+CFUN=5
 
  AT+CFUN=5
  
to <tt>/dev/ttyACM1</tt>. To force WCDMA-only connection, send
+
to <tt>/dev/cdc-wdm0</tt>. To force WCDMA-only connection, send
  
 
  AT+CFUN=6
 
  AT+CFUN=6
  
to <tt>/dev/ttyACM1</tt>.
+
to <tt>/dev/cdc-wdm0</tt>.
  
 
==Turning the card off==
 
==Turning the card off==
Line 59: Line 59:
 
  AT+CFUN=4
 
  AT+CFUN=4
  
to <tt>/dev/ttyACM1</tt>. To remove all power from the card, send
+
to <tt>/dev/cdc-wdm0</tt>. To remove all power from the card, send
  
 
  AT+CFUN=0
 
  AT+CFUN=0
  
to <tt>/dev/ttyACM1</tt>. Be carefull with the last command. It turns the card completely off, and it will no longer accept any AT-commands before the hard reset. To physically reset the card flip the wireless switch off, and then on. You can do the same by sending <tt>echo 0 > /sys/devices/platform/thinkpad_acpi/wwan_enable</tt> (to turn off) and then <tt>echo 1 > /sys/devices/platform/thinkpad_acpi/wwan_enable</tt> (to turn on).
+
to <tt>/dev/cdc-wdm0</tt>. Be carefull with the last command. It turns the card completely off, and it will no longer accept any AT-commands before the hard reset. To physically reset the card flip the wireless switch off, and then on. You can do the same by sending <tt>echo 0 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state</tt> (to turn off) and then <tt>echo 1 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state</tt> (to turn on).
  
 
==Using the card as a wireless modem==
 
==Using the card as a wireless modem==
Line 84: Line 84:
 
  AT+CGDCONT=1,"IP","'''proxy'''"
 
  AT+CGDCONT=1,"IP","'''proxy'''"
  
to <tt>/dev/ttyACM1</tt>. Instead of "'''proxy'''" you may need to use to something else. Find the appropriate APN [http://www.pinstack.com/carrier_settings_apn_gateway.html here]. To initiate the connection, send
+
to <tt>/dev/cdc-wdm0</tt>. Instead of "'''proxy'''" you may need to use to something else. Find the appropriate APN [http://www.pinstack.com/carrier_settings_apn_gateway.html here]. To initiate the connection, send
  
 
  AT*ENAP=1,1
 
  AT*ENAP=1,1
  
to <tt>/dev/ttyACM1</tt>. Now, if your wireless provider lets you in, you are connected. Launch <tt>dhclient</tt>
+
to <tt>/dev/cdc-wdm0</tt>. Now, if your wireless provider lets you in, you are connected. Launch <tt>dhclient</tt>
  
 
  dhclient usb0
 
  dhclient usb0
Line 96: Line 96:
 
  AT*ENAP=0
 
  AT*ENAP=0
  
to <tt>/dev/ttyACM1</tt>.
+
to <tt>/dev/cdc-wdm0</tt>.
  
 
==Using the card as a GPS receiver==
 
==Using the card as a GPS receiver==
Line 103: Line 103:
 
  AT*E2GPSCTL=X,Y,Z
 
  AT*E2GPSCTL=X,Y,Z
  
to <tt>/dev/ttyACM1</tt>. Here
+
to <tt>/dev/cdc-wdm0</tt>. Here
  
 
*X can be 0 (NMEA stream turned off) or 1 (NMEA stream turned on)
 
*X can be 0 (NMEA stream turned off) or 1 (NMEA stream turned on)
Line 113: Line 113:
 
  AT*E2GPSCTL=1,5,1
 
  AT*E2GPSCTL=1,5,1
  
to <tt>/dev/ttyACM1</tt>. Once the GPSr is configured, we can get the NMEA stream on /dev/ttyACM2 by sending
+
to <tt>/dev/cdc-wdm0</tt>. Once the GPSr is configured, we can get the NMEA stream on /dev/ttyACM2 by sending
  
 
  AT*E2GPSNPD
 
  AT*E2GPSNPD
Line 121: Line 121:
 
  AT*E2GPSCTL=X,Y,Z
 
  AT*E2GPSCTL=X,Y,Z
  
to <tt>/dev/ttyACM1</tt>. Now you can read the NMEA stream by saying
+
to <tt>/dev/cdc-wdm0</tt>. Now you can read the NMEA stream by saying
  
 
  cat /dev/ttyACM2
 
  cat /dev/ttyACM2
Line 136: Line 136:
 
In order to save the power, lets use '''sysfsutils''' to completely power off the WWAN card on boot. Append the following line to <tt>/etc/sysfs.conf</tt>
 
In order to save the power, lets use '''sysfsutils''' to completely power off the WWAN card on boot. Append the following line to <tt>/etc/sysfs.conf</tt>
  
  devices/platform/thinkpad_acpi/wwan_enable = 0
+
  devices/platform/thinkpad_acpi/rfkill/rfkill0/state = 0
  
 
It will power down the card on boot, but when the laptop wakes from sleep, in some cases the card is powered up agian. To re-apply these settings on wake-up, create a script named <tt>/etc/pm/sleep.d/10sysfsutils</tt>:
 
It will power down the card on boot, but when the laptop wakes from sleep, in some cases the card is powered up agian. To re-apply these settings on wake-up, create a script named <tt>/etc/pm/sleep.d/10sysfsutils</tt>:
Line 154: Line 154:
  
 
  GPSDPID="/var/run/gpsd.pid"
 
  GPSDPID="/var/run/gpsd.pid"
  CONTROL_DEVICE="/dev/ttyACM1"
+
  CONTROL_DEVICE="/dev/cdc-wdm0"
 
  GPS_DEVICE="/dev/ttyACM2"
 
  GPS_DEVICE="/dev/ttyACM2"
 
  '''PIN=""'''
 
  '''PIN=""'''
Line 161: Line 161:
 
  powerup_F3507g () {
 
  powerup_F3507g () {
 
  echo -n "Powering up F3507g card.."
 
  echo -n "Powering up F3507g card.."
  echo 1 > /sys/devices/platform/thinkpad_acpi/wwan_enable
+
  echo 1 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state
 
  while [ ! -c $CONTROL_DEVICE ]; do sleep 0.5; echo -n "."; done
 
  while [ ! -c $CONTROL_DEVICE ]; do sleep 0.5; echo -n "."; done
 
  echo "done"
 
  echo "done"
  echo -n "Turning on F3507g card..."
+
  echo "Turning on F3507g card..."
 
  sleep 3
 
  sleep 3
 
  if [ -n "$PIN" ]; then
 
  if [ -n "$PIN" ]; then
      /usr/sbin/chat -v "" "AT+CPIN?" "SIM PIN" "AT" "OK" "AT+CPIN=\"$PIN\"" "OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
+
      expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
 +
send "AT+CPIN?\r";
 +
expect "SIM PIN";
 +
send "AT\r";
 +
expect "OK";
 +
send "AT+CPIN=\"'$PIN'\"\r";
 +
expect "OK";'
 +
sleep 1
 
  fi
 
  fi
  /usr/sbin/chat -v "" "AT+CPIN?" "READY" "AT+CFUN=1" "+PACSP0" "AT" "OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
+
  expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
 +
    send "AT+CPIN?\r";
 +
    expect "READY";
 +
    send "AT+CFUN=1\r";
 +
    expect "PACSP0";'
 +
sleep 1
 
  echo "done"
 
  echo "done"
 
  }
 
  }
 
   
 
   
 
  powerdown_F3507g () {
 
  powerdown_F3507g () {
  echo -n "Turning off F3507g card..."
+
  echo "Turning off F3507g card..."
  /usr/sbin/chat -v "" "AT+CFUN=4" "OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
+
  expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
 +
    send "AT+CFUN=4\r";
 +
    expect "OK";'
 
  echo "done"
 
  echo "done"
 
  echo -n "Powering down F3507g card.."
 
  echo -n "Powering down F3507g card.."
  echo 0 > /sys/devices/platform/thinkpad_acpi/wwan_enable
+
  echo 0 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state
 
  while [ -c $CONTROL_DEVICE ]; do sleep 0.5; echo -n "."; done
 
  while [ -c $CONTROL_DEVICE ]; do sleep 0.5; echo -n "."; done
 
  echo "done"
 
  echo "done"
Line 184: Line 198:
 
   
 
   
 
  configure_GPS () {
 
  configure_GPS () {
  /usr/sbin/chat -v "" "AT*E2GPSCTL=$1,$2,$3" "OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
+
  expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
 +
    send "AT*E2GPSCTL='$1,$2,$3'\r";
 +
    expect "OK";'
 +
sleep 1
 
  }
 
  }
 
   
 
   
 
  turnon_GPS () {
 
  turnon_GPS () {
  echo -n "Starting NMEA stream on $GPS_DEVICE..."
+
  echo "Starting NMEA stream on $GPS_DEVICE ..."
 
  configure_GPS 1 1 1
 
  configure_GPS 1 1 1
 +
su -c 'expect -c "spawn cu -l \"'$GPS_DEVICE'\"; expect \"Connected.\"; \
 +
    send \"AT*E2GPSNPD\r\"; \
 +
    expect \"GPGGA\"";' uucp
 
  sleep 1
 
  sleep 1
/usr/sbin/chat -v "" "AT*E2GPSNPD" "GPGGA" > $GPS_DEVICE < $GPS_DEVICE
 
 
  start-stop-daemon --start --exec /usr/sbin/gpsd -- -P $GPSDPID $GPS_DEVICE
 
  start-stop-daemon --start --exec /usr/sbin/gpsd -- -P $GPSDPID $GPS_DEVICE
 
  echo "done"
 
  echo "done"
Line 197: Line 216:
 
   
 
   
 
  turnoff_GPS () {
 
  turnoff_GPS () {
  echo -n "Stopping NMEA stream on $GPS_DEVICE..."
+
  echo "Stopping NMEA stream on $GPS_DEVICE ..."
 
  start-stop-daemon --stop --pidfile $GPSDPID
 
  start-stop-daemon --stop --pidfile $GPSDPID
 
  configure_GPS 0 1 0
 
  configure_GPS 0 1 0
Line 205: Line 224:
 
   
 
   
 
  turnon_usbnet () {
 
  turnon_usbnet () {
  echo -n "Starting usbnet connection..."
+
  echo "Starting usbnet connection..."
  /usr/sbin/chat -v "" "AT+CGDCONT=1,\"IP\",\"$APN\"" "OK" "AT*ENAP=1,1" "OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
+
  expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
 +
    send "AT+CGDCONT=1,\"IP\",\"'$APN'\"\r";
 +
    expect "OK";
 +
    send "AT*ENAP=1,1\r";
 +
    expect "OK";'
 +
sleep 1
 
  echo "done"
 
  echo "done"
 
  }
 
  }
 
   
 
   
 
  turnoff_usbnet () {
 
  turnoff_usbnet () {
  echo -n "Stopping usbnet connection..."
+
  echo "Stopping usbnet connection..."
  /usr/sbin/chat -v "" "AT*ENAP=0" "OK" > $CONTROL_DEVICE < $CONTROL_DEVICE
+
  expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
 +
    send "AT*ENAP=0\r";
 +
    expect "OK";'
 +
sleep 1
 
  echo "done"
 
  echo "done"
 
  turnoff_F3507g
 
  turnoff_F3507g
Line 218: Line 245:
 
   
 
   
 
  turnoff_F3507g () {
 
  turnoff_F3507g () {
  [ -z $(grep gps /var/run/network/ifstate) ] && \
+
  [ -z $(grep gps /etc/network/run/ifstate) ] && \
  [ -z $(grep usb0 /var/run/network/ifstate) ] && \
+
  [ -z $(grep usb0 /etc/network/run/ifstate) ] && \
  [ -z $(grep 3G /var/run/network/ifstate) ] && \
+
  [ -z $(grep 3G /etc/network/run/ifstate) ] && \
 
  ifdown F3507g
 
  ifdown F3507g
 
  }
 
  }
Line 234: Line 261:
 
  post-down . /usr/local/etc/F3507g; turnoff_F3507g
 
  post-down . /usr/local/etc/F3507g; turnoff_F3507g
 
  provider 3G
 
  provider 3G
 
+
 
  iface gps inet manual
 
  iface gps inet manual
 
  up . /usr/local/etc/F3507g; ifup F3507g; turnon_GPS
 
  up . /usr/local/etc/F3507g; ifup F3507g; turnon_GPS
Line 265: Line 292:
  
 
==Other thoughts==
 
==Other thoughts==
While <tt>AT+CFUN=*</tt> and <tt>AT+CPIN=*</tt> are pretty standard commands for wireless modems and are well-documented (e.g. [http://developer.sonyericsson.com/getDocument.do?docId=65054 here] and [http://www.sierrawireless.com/resources/documents/support/2130617_Supported_AT_Command_Reference_Rev_2.1.pdf here]), it appears that the commands <tt>AT*E2GPSCTL</tt> and <tt>AT*E2GPSNPD</tt> are unique to the Ericsson F3507g card. All credit for discovering them goes to "Nickolai Zeldovich" who left a comment in this [http://redmonk.com/sogrady/2008/09/24/apone/ thread]. I imagine one could find them via a USB sniffer on a working Windows machine (or a Linux machine with Windows running in a virtual machine). Another way to get them is to try to look for "gps" string in Windows drivers. What is interesting, F3507g supports a few other AT-commands with "GPS" substring (you can get all supported AT-commands by sending <tt>AT*</tt> to <tt>/dev/ttyACM1</tt> after activating it with <tt>AT+CFUN=1</tt>). Anyway, there is a [http://www.natisbad.org/E4300/Dell_Wireless_5530_AT_cmd_ref.html project] aiming to document all AT-commands for the Ericsson F3507g card.
+
While <tt>AT+CFUN=*</tt> and <tt>AT+CPIN=*</tt> are pretty standard commands for wireless modems and are well-documented (e.g. [http://developer.sonyericsson.com/getDocument.do?docId=65054 here] and [http://www.sierrawireless.com/resources/documents/support/2130617_Supported_AT_Command_Reference_Rev_2.1.pdf here]), it appears that the commands <tt>AT*E2GPSCTL</tt> and <tt>AT*E2GPSNPD</tt> are unique to the Ericsson F3507g card. All credit for discovering them goes to "Nickolai Zeldovich" who left a comment in this [http://redmonk.com/sogrady/2008/09/24/apone/ thread]. I imagine one could find them via a USB sniffer on a working Windows machine (or a Linux machine with Windows running in a virtual machine). Another way to get them is to try to look for "gps" string in Windows drivers. What is interesting, F3507g supports a few other AT-commands with "GPS" substring (you can get all supported AT-commands by sending <tt>AT*</tt> to <tt>/dev/cdc-wdm0</tt> after activating it with <tt>AT+CFUN=1</tt>). Anyway, there is a [http://www.natisbad.org/E4300/Dell_Wireless_5530_AT_cmd_ref.html project] aiming to document all AT-commands for the Ericsson F3507g card.
  
 
==Related Links==
 
==Related Links==

Revision as of 02:35, 25 September 2009

Here are some basics about Ericsson F3507g MiniPCIe WWAN/GPS card (USB ID 0bdb:1900 and 0bdb:1902):

  • the card will not work without an inserted SIM, even the GPS function. If you want to use just GPS, any SIM would work, even if it is not attached to any active account with any GSM provider.
  • the card provides three CDC ACM interfaces (CONFIG_USB_ACM=m), two CDC WDM interfaces (CONFIG_USB_WDM=m) and one CDC Ethernet interface (CONFIG_USB_NET_CDCETHER=m), and identifies them as
for n in `ls /sys/class/*/*{ACM,wdm,usb0}*/device/interface`;do echo $(echo $n|awk -F '/' '{print $5}') : $(cat $n);done

usb0 : Ericsson F3507g Mobile Broadband Minicard Network Adapter
ttyACM0 : Ericsson F3507g Mobile Broadband Minicard Modem
ttyACM1 : Ericsson F3507g Mobile Broadband Minicard Data Modem
ttyACM2 : Ericsson F3507g Mobile Broadband Minicard GPS Port
cdc-wdm0 : Ericsson F3507g Mobile Broadband Minicard Device Management
cdc-wdm1 : Ericsson F3507g Mobile Broadband Minicard PC SC Port

Note:

  • apparently, for a while option USB-serial driver had claimed USB ID 0bdb:1900, but this was wrong, and as of kernel 2.6.28.9 that commit was reversed. If instead of /dev/ttyACM* you see /dev/ttyUSB*, it means that option module is loaded. You may need to blacklist it to make sure it doesn't happen.
  • Support for the CDC Ethernet interface appears only in kernel 2.6.28.8. But if your kernel is older, you can still connect to the net using one of the "Modem" interfaces.

As Ericsson's naming scheme suggests, we would use /dev/cdc-wdm0 for controlling the card, usb0 as a network device, /dev/ttyACM0 as a modem, and /dev/ttyACM2 for GPS.

Turning the card on

First, check whenever the SIM is protected by PIN by sending

AT+CPIN?

to /dev/cdc-wdm0. You can do it with any terminal terminal program like cu or minicom. If the answer is

+CPIN: READY

then the SIM is unlocked. If the answer is

+CPIN: SIM PIN

you need first to unlock it by sending

AT+CPIN="YOUR-PIN"

to /dev/cdc-wdm0. Now the card can be turned on by sending

AT+CFUN=1

to /dev/cdc-wdm0. The answer should be

+PACSP0

Don't try to do anything until you see it. To force GSM-only connection, send

AT+CFUN=5

to /dev/cdc-wdm0. To force WCDMA-only connection, send

AT+CFUN=6

to /dev/cdc-wdm0.

Turning the card off

To put the card into energy-saving mode (this is the default), you can send

AT+CFUN=4

to /dev/cdc-wdm0. To remove all power from the card, send

AT+CFUN=0

to /dev/cdc-wdm0. Be carefull with the last command. It turns the card completely off, and it will no longer accept any AT-commands before the hard reset. To physically reset the card flip the wireless switch off, and then on. You can do the same by sending echo 0 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state (to turn off) and then echo 1 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state (to turn on).

Using the card as a wireless modem

Once the card is turned on, there are two ways to connect to the net. The first one is just to use the card as any "normal" GPRS modem and start pppd daemon on one of /dev/ttyACM*. The other way is to use CDC Ethernet interface. It is supposed to be more efficient, but it requires a pretty recent (>=2.6.28.8) kernel.

Connecting to the net via pppd

For the first approach, the easiest way to do it is to use wvdial. For example, to connect to AT&T Wireless network, your /etc/wvdial.conf would have to be something like this

[Dialer 3G]
Modem = /dev/ttyACM0
Init1 = AT+CGDCONT=1,"IP","proxy"
Stupid mode = 1
phone= *99#
Username = *
Password = *

Note: if you are using a SIM from a different mobile provider, you may need to change the access point name (APN) "proxy" in Init1 string and Username/Password to something else. You can find the appropriate APN here.

Connecting to the net via CDC Ethernet interface

The second approach works for kernels >=2.6.28.8. Configure the APN by sending

AT+CGDCONT=1,"IP","proxy"

to /dev/cdc-wdm0. Instead of "proxy" you may need to use to something else. Find the appropriate APN here. To initiate the connection, send

AT*ENAP=1,1

to /dev/cdc-wdm0. Now, if your wireless provider lets you in, you are connected. Launch dhclient

dhclient usb0

and start surfing the net. To disconnect, send

AT*ENAP=0

to /dev/cdc-wdm0.

Using the card as a GPS receiver

Once the card is turned on, we can use it to get GPS info via NMEA protocol. First, you have to configure the a few NMEA options. It is done by sending

AT*E2GPSCTL=X,Y,Z

to /dev/cdc-wdm0. Here

  • X can be 0 (NMEA stream turned off) or 1 (NMEA stream turned on)
  • Y can be an integer form 1 to 60, and sets the frequency of how often the card emits the NMEA sentences
  • Z can be 0 (DGPS is turned off) or 1 (DGPS is turned on)

so, to configure the GPSr to update every 5 seconds, and turn DGPS on, you would send

AT*E2GPSCTL=1,5,1

to /dev/cdc-wdm0. Once the GPSr is configured, we can get the NMEA stream on /dev/ttyACM2 by sending

AT*E2GPSNPD

to /dev/ttyACM2. Once you do that, /dev/ttyACM2 will no longer accept any new AT-commands. But you still can change the the behavior of the NMEA stream by sending the appropriate

AT*E2GPSCTL=X,Y,Z

to /dev/cdc-wdm0. Now you can read the NMEA stream by saying

cat /dev/ttyACM2

or better yet, start gpsd interface on /dev/ttyACM2.

Note: There is a now a sourceforge project dedicated to the Ericsson Mobile Broadband modules. Gps control sw that does the above automatically is available and also a graphical user interface. Details are available on the MBM Wiki.

Scripting everything

Install the packages

apt-get install sysfsutils gpsd wvdial

In order to save the power, lets use sysfsutils to completely power off the WWAN card on boot. Append the following line to /etc/sysfs.conf

devices/platform/thinkpad_acpi/rfkill/rfkill0/state = 0

It will power down the card on boot, but when the laptop wakes from sleep, in some cases the card is powered up agian. To re-apply these settings on wake-up, create a script named /etc/pm/sleep.d/10sysfsutils:

#!/bin/sh
case $1 in
    (hibernate|suspend)
        ;;
    (thaw|resume)
        /etc/init.d/sysfsutils start
        ;;
    *)  echo "somebody is calling me totally wrong."
        ;;
esac

Don't forget to chmod a+x /etc/pm/sleep.d/10sysfsutils. Create a file called /usr/local/etc/F3507g containing the following:

GPSDPID="/var/run/gpsd.pid"
CONTROL_DEVICE="/dev/cdc-wdm0"
GPS_DEVICE="/dev/ttyACM2"
PIN=""
APN="proxy"

powerup_F3507g () {
	echo -n "Powering up F3507g card.."
	echo 1 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state
	while [ ! -c $CONTROL_DEVICE ]; do sleep 0.5; echo -n "."; done
	echo "done"
	echo "Turning on F3507g card..."
	sleep 3
	if [ -n "$PIN" ]; then
	    expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
		send "AT+CPIN?\r";
		expect "SIM PIN";
		send "AT\r";
		expect "OK";
		send "AT+CPIN=\"'$PIN'\"\r";
		expect "OK";'
		sleep 1
	fi
	expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
	    send "AT+CPIN?\r";
	    expect "READY";
	    send "AT+CFUN=1\r";
	    expect "PACSP0";'
	sleep 1
	echo "done"
}

powerdown_F3507g () {
	echo "Turning off F3507g card..."
	expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
	    send "AT+CFUN=4\r";
	    expect "OK";'
	echo "done"
	echo -n "Powering down F3507g card.."
	echo 0 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state
	while [ -c $CONTROL_DEVICE ]; do sleep 0.5; echo -n "."; done
	echo "done"
}

configure_GPS () {
	expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
	    send "AT*E2GPSCTL='$1,$2,$3'\r";
	    expect "OK";'
	sleep 1
}

turnon_GPS () {
	echo "Starting NMEA stream on $GPS_DEVICE ..."
	configure_GPS 1 1 1
	su -c 'expect -c "spawn cu -l \"'$GPS_DEVICE'\"; expect \"Connected.\"; \
	    send \"AT*E2GPSNPD\r\"; \
	    expect \"GPGGA\"";' uucp
	sleep 1
	start-stop-daemon --start --exec /usr/sbin/gpsd -- -P $GPSDPID $GPS_DEVICE
	echo "done"
}

turnoff_GPS () {
	echo "Stopping NMEA stream on $GPS_DEVICE ..."
	start-stop-daemon --stop --pidfile $GPSDPID
	configure_GPS 0 1 0
	echo "done"
	turnoff_F3507g
}

turnon_usbnet () {
	echo "Starting usbnet connection..."
	expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
	    send "AT+CGDCONT=1,\"IP\",\"'$APN'\"\r";
	    expect "OK";
	    send "AT*ENAP=1,1\r";
	    expect "OK";'
	sleep 1
	echo "done"
}

turnoff_usbnet () {
	echo "Stopping usbnet connection..."
	expect -c 'spawn cu -l '$CONTROL_DEVICE'; expect "Connected.";
	    send "AT*ENAP=0\r";
	    expect "OK";'
	sleep 1
	echo "done"
	turnoff_F3507g
}

turnoff_F3507g () {
	[ -z $(grep gps /etc/network/run/ifstate) ] && \
	[ -z $(grep usb0 /etc/network/run/ifstate) ] && \
	[ -z $(grep 3G /etc/network/run/ifstate) ] && \
	ifdown F3507g
}

Give the correct PIN and find the APN for your wireless provider here. Append the following lines to your /etc/network/interfaces file

iface F3507g inet manual
up . /usr/local/etc/F3507g; powerup_F3507g
down . /usr/local/etc/F3507g; powerdown_F3507g

iface 3G inet wvdial
pre-up ifup F3507g
post-down . /usr/local/etc/F3507g; turnoff_F3507g
provider 3G

iface gps inet manual
up . /usr/local/etc/F3507g; ifup F3507g; turnon_GPS
down . /usr/local/etc/F3507g; turnoff_GPS

iface usb0 inet dhcp
pre-up . /usr/local/etc/F3507g; ifup F3507g; turnon_usbnet
post-down . /usr/local/etc/F3507g; turnoff_usbnet

Configure /etc/wvdial.conf to look like this:

[Dialer 3G]
Modem = /dev/ttyACM0
Init1 = AT+CGDCONT=1,"IP","proxy"
Stupid mode = 1
phone= *99#
Username = *
Password = *

Note: you may need to change the access point name (APN) "proxy" in Init1 string and Username/Password to something else. Find the appropriate APN here.

Now broadband connection could be started in the same way as you start any other network interface, just by saying ifup usb0 (or ifup 3G, if connecting via pppd). To shut it down, say ifdown usb0 (or ifdown 3G). Similarly, GPS interface is started by ifup gps and turned off by ifdown gps. Once you get a fix, you can use your favourite GPS mapping application like tangogps. The "cold start" seems to take quite a bit however, and sometimes it cannot get a fix if indoors.

Using F3507g with NetworkManager

Work is ongoing to add support for Ericsson Mobile Broadband Modules to GNOME NetworkManager / modem-manager. More information is available on the MBM project website and the MBM wiki.

The F3507g card (in a ThinkPad T400s) works out of the box on Fedora 11. No configuration is needed beyond setting the data plan provider in the nm-applet GUI.

Using mbm-gpsd gps works flawlessly with the F3507g on Karmic Koala with modemmanager packages from Ubuntu PPA, the mbm-gpsd installed by source using the description from here and knowing the PIN of your SIM card.

Other thoughts

While AT+CFUN=* and AT+CPIN=* are pretty standard commands for wireless modems and are well-documented (e.g. here and here), it appears that the commands AT*E2GPSCTL and AT*E2GPSNPD are unique to the Ericsson F3507g card. All credit for discovering them goes to "Nickolai Zeldovich" who left a comment in this thread. I imagine one could find them via a USB sniffer on a working Windows machine (or a Linux machine with Windows running in a virtual machine). Another way to get them is to try to look for "gps" string in Windows drivers. What is interesting, F3507g supports a few other AT-commands with "GPS" substring (you can get all supported AT-commands by sending AT* to /dev/cdc-wdm0 after activating it with AT+CFUN=1). Anyway, there is a project aiming to document all AT-commands for the Ericsson F3507g card.

Related Links

Bugs

  • Ubuntu 8.10 kernel suffers from the "option" regression mentioned above. However both CDC ACM and CDC Ethernet interfaces are treated correctly by Ubuntu 9.04 kernel.
  • Playing around with the device under Linux can cause it to disappear under Windows Vista. Issue + Fix described here

Models