Your Linux Data Center Experts

Last night I couldn't sleep and so I finally attacked the problem of getting it so that my Sierra Wireless USB 598 dongle will automatically come up when it's connected. This includes poking at NetworkManager to tell it to disable wireless, and make the connection via the “Auto Mobile Broadband (CDMA) connection”. Read on for more details of how I got this working.

I've put a tar file of these files up at, and if I make any changes I'll push them up there as a new version.

The first steps were to get udev to fire off a script when the modem was plugged in. I like to name these files prefixed with “tummy” so I can easily find them when I do a re-install or upgrade. So I created the file “/etc/udev/rules.d/tummy-sprint.rules” which contains:

#  Sprint USB modem

SUBSYSTEM=="tty", ENV{ID_PORT}=="1", SYSFS{product}=="Sierra Wireless USB 598", RUN+="/usr/local/sbin/tummy-sprintnet"

ACTION=="remove", SYSFS{product}=="Sierra Wireless USB 598", RUN+="/usr/local/sbin/tummy-sprintnet"

For some reason, the “remove” action doesn't always fire, but I haven't figured that out yet.

to communicate with NetworkManager, I used cnetworkmanager, but I needed a new version to do what I wanted to do. Version 0.21 is available in Rawhide, so I just grabbed it and build and installed it. So, under Fedora 11 you will need to do this, under Ubuntu it's not available at all, so you'll have to download and install it manually.

Next I wrote the “/usr/local/sbin/tummy-sprintnet” script, which I ended up with the following:

#  Start up the Sprint connection when it's plugged

#exec >>/tmp/sprintnet.out 2>&1
#echo Starting `date`
#set -x

logger -t "${0##*/}" Starting with action=$ACTION
case "$ACTION" in
      logger -t "${0##*/}" Waiting for NetworkManager to see device
      for (( i=0; i < 30; i++ )); do
         cnetworkmanager --device-list | egrep -q 'CDMA.*DISCONNECTED' && break
         sleep 1

      logger -t "${0##*/}" Starting connection.
      cnetworkmanager --online=1
      cnetworkmanager --wifi=0
      cnetworkmanager --activate-connection=user,'Auto Mobile Broadband (CDMA) connection',ttyUSB0, &
      sleep 5
      kill %1
      ) &

      logger -t "${0##*/}" Shutting down Sprint connection.
      cnetworkmanager --online=1
      cnetworkmanager --wifi=1
      ) &

This waits for the device to show up in NetworkManager as being managed (CDMA and DISCONNECTED), and then enables networking, disables WiFi, and starts the “Mobile Broadband” connection. The “–activate” action seems to just keep on running, so I background it and then kill it after 5 seconds.

comments powered by Disqus

Join our other satisfied clients. Contact us today.