Code


BLOG
About Matthias Nott
SAP
Picture Galleries
Code
Technical





Locations of visitors to this page

This is a short description on how to use UMTS on a Linux Laptop.

 

I am using the Swisscom Mobile UMTS card. Internaly, it is an OPTION Wireless Technology GT Fusion card that is able to do UMTS/GPRS/WLAN 802.11b/g. On the back of the card, it is printed that the card is a Qualcomm 3G CDMA model.

 

The Laptop is an IBM Thinkpad 41p with SuSE Linux 9.1 on 2.6.5-7.75.

 

The first try was to enter the card as-is. Immediately. the hardware detection tool of SuSE started up Yast2 and allowed me to configure the WLAN card. When later I added the card to the other PCMCIA slot, I was asked again to configure the WLAN module. As I do not want to use WLAN from the card but rather use the built-in centrino module, I just added the card but did not configure it.

 

The Modem part of the UMTS module apparently did not come up. I then browsed the web and got some help, particularly from www.kuix.de/umts/vodafone/.

 

The first thing I did was to compare /proc/bus/usb/devices before and after I entered the card:

  1. mnott@linux:/proc/bus/usb> cat devices >/tmp/1.txt
  2. mnott@linux:/proc/bus/usb> cat devices >/tmp/2.txt
  3. mnott@linux:/proc/bus/usb> diff /tmp/1.txt /tmp/2.txt
  4. ...
  5. > T:  Bus=05 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12  MxCh= 0
  6. > D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
  7. > P:  Vendor=0af0 ProdID=6000 Rev= 0.00
  8. > S:  Manufacturer=Option N.V.
  9. > S:  Product=Fusion UMTS GPRS WLAN
  10. ...

What is important, is the Vendor=0af0 and the ProdID=6000 part. I then did

  1. mnott@linux:/proc/bus/usb> rmmod usbserial
  2. mnott@linux:/proc/bus/usb> modprobe usbserial vendor=0xaf0 product=0x6000

I later added the option to /etc/modprobe.conf:

  1. # was there:
  2. alias char-major-188      usbserial
  3. # added:
  4. options usbserial vendor=0xaf0 product=0x6000

When I now plug in the card, I see the following output in /var/log/messages:

  1. Dec  6 09:27:17 linux kernel: PCI: Enabling device 0000:07:00.1 (0000 -> 0002)
  2. Dec  6 09:27:17 linux kernel: ohci_hcd 0000:07:00.1: OHCI Host Controller
  3. Dec  6 09:27:17 linux kernel: PCI: Setting latency timer of device 0000:07:00.1 to 64
  4. Dec  6 09:27:17 linux kernel: ohci_hcd 0000:07:00.1: irq 11, pci mem fa968000
  5. Dec  6 09:27:17 linux kernel: ohci_hcd 0000:07:00.1: new USB bus registered, assigned bus number 5
  6. Dec  6 09:27:17 linux kernel: usb usb5: Product: OHCI Host Controller
  7. Dec  6 09:27:17 linux kernel: usb usb5: Manufacturer: Linux 2.6.5-7.75-default ohci_hcd
  8. Dec  6 09:27:17 linux kernel: usb usb5: SerialNumber: 0000:07:00.1
  9. Dec  6 09:27:18 linux /etc/hotplug/usb.agent[20248]: need a device for this command
  10. Dec  6 09:27:18 linux kernel: hub 5-0:1.0: USB hub found
  11. Dec  6 09:27:18 linux kernel: hub 5-0:1.0: 1 port detected
  12. Dec  6 09:27:21 linux kernel: usb 5-1: new full speed USB device using address 2
  13. Dec  6 09:27:21 linux kernel: usb 5-1: Product: Fusion UMTS GPRS WLAN
  14. Dec  6 09:27:21 linux kernel: usb 5-1: Manufacturer: Option N.V.
  15. Dec  6 09:27:21 linux kernel: usbserial 5-1:1.0: Generic converter detected
  16. Dec  6 09:27:21 linux kernel: usb 5-1: Generic converter now attached to ttyUSB0 (or usb/tts/0 for devfs)
  17. Dec  6 09:27:21 linux kernel: usbserial 5-1:1.1: Generic converter detected
  18. Dec  6 09:27:21 linux kernel: usb 5-1: Generic converter now attached to ttyUSB1 (or usb/tts/1 for devfs)
  19. Dec  6 09:27:21 linux kernel: usbserial 5-1:1.2: Generic converter detected
  20. Dec  6 09:27:21 linux kernel: usb 5-1: Generic converter now attached to ttyUSB2 (or usb/tts/2 for devfs)
  21. Dec  6 09:27:21 linux kernel: usbserial 5-1:1.3: Generic converter detected
  22. Dec  6 09:27:21 linux kernel: usb 5-1: Generic converter now attached to ttyUSB3 (or usb/tts/3 for devfs)
  23. Dec  6 09:27:21 linux /etc/hotplug/usb.agent[20339]: need a device for this command
  24. Dec  6 09:27:22 linux /etc/hotplug/usb.agent[20396]: need a device for this command
  25. Dec  6 09:27:22 linux /etc/hotplug/usb.agent[20393]: need a device for this command
  26. Dec  6 09:27:21 linux /etc/hotplug/usb.agent[20336]: need a device for this command
  27. Dec  6 09:27:22 linux /etc/hotplug/tty.agent[20338]: add tty device /class/tty/ttyUSB0
  28. Dec  6 09:27:22 linux /etc/hotplug/tty.agent[20395]: add tty device /class/tty/ttyUSB2
  29. Dec  6 09:27:22 linux /etc/hotplug/tty.agent[20341]: add tty device /class/tty/ttyUSB1
  30. Dec  6 09:27:22 linux /etc/hotplug/tty.agent[20398]: add tty device /class/tty/ttyUSB3

I am now able to use the modem. I create a script /pgm/scripts/umts as follows:

  1. #!/usr/bin/perl -w
  2. #
  3. # This is a script that connects to the gprs network.
  4. #
  5. # (c) 2004, Matthias Nott, MN Soft Branchensoftware
  6.  
  7. use strict;
  8. use warnings;
  9.  
  10. # We enter the PIN
  11.  
  12. # umts card pin info:
  13. #
  14. # PIN 4711
  15. # PUK 00634711
  16. # PIN2 4712
  17. # PUK2 43584712
  18.  
  19. print "Entering PIN.\n";
  20. system("chat -e -f /pgm/scripts/umts-pin-chat >/dev/ttyUSB0 </dev/ttyUSB0");
  21. # We have to wait for the PIN to become active...
  22. print "Enter the next time in seconds to wait for the card: [60]: ";
  23. chop (my $time = <STDIN>);
  24. if("" eq $time) {
  25.   $time = 60;
  26. }
  27. sleep $time;
  28.  
  29. # Finally, we open the connection.
  30. print "Opening the connection. Press Ctrl+C to hangup.\n";
  31. system("pppd call umts");

The chat command is used to set the PIN of the card and to configure that we have a priority of "try UMTS first, then fall back to GPRS". It refers to the file /pgm/scripts/umts-pin-chat:

  1. ABORT BUSY ABORT 'NO CARRIER' ABORT ERROR
  2. "" ATZ OK AT+CPIN="4711" OK AT_OPSYS=3,2

The Perl script calls pppd call umts to open the connection. This refers to the files umts, umts-connect-chat, umts-disconnect-chat and umts-wvdial.conf in /etc/ppp/peers.

 

/etc/ppp/peers/umts:

  1. # Most GPRS phones don't reply to LCP echo's
  2. lcp-echo-failure 0
  3. lcp-echo-interval 0
  4.  
  5. # Keep pppd attached to the terminal:
  6. # Comment this to get daemon mode pppd
  7. nodetach
  8.  
  9. # Debug info from pppd:
  10. # Comment this off, if you don't need more info
  11. debug
  12.  
  13. # Show password in debug messages
  14. show-password
  15.  
  16. # Connect script:
  17. # scripts to initialize the GPRS modem and start the connection,
  18. # wvdial command is for Orange SPV while other phones should work with chat
  19. #connect /etc/ppp/peers/gprs-connect-chat
  20. connect "/usr/bin/wvdial --chat --config /etc/ppp/peers/umts-wvdial.conf radiolinja_usb_orange_spv"
  21.  
  22. # Disconnect script:
  23. # AT commands used to 'hangup' the GPRS connection.
  24. disconnect /etc/ppp/peers/gprs-disconnect-chat
  25.  
  26. # Serial device to which the GPRS phone is connected:
  27. /dev/ttyUSB0  # USB serial device, for example Orange SPV
  28.  
  29. # Serial port line speed
  30. 115200  # fast enough
  31.  
  32. # Hardware flow control:
  33. # Use hardware flow control with cable, Bluetooth and USB but not with IrDA.
  34. crtscts  # serial cable, Bluetooth and USB, on some occations with IrDA too
  35. #nocrtscts # IrDA
  36.  
  37. # Ignore carrier detect signal from the modem:
  38. local
  39.  
  40. # IP addresses:
  41. # - accept peers idea of our local address and set address peer as 10.0.0.1
  42. # (any address would do, since IPCP gives 0.0.0.0 to it)
  43. # - if you use the 10. network at home or something and pppd rejects it,
  44. # change the address to something else
  45. :10.0.0.1
  46.  
  47. # pppd must not propose any IP address to the peer!
  48. noipdefault
  49.  
  50. # Accept peers idea of our local address
  51. ipcp-accept-local
  52.  
  53. # Add the ppp interface as default route to the IP routing table
  54. defaultroute
  55.  
  56. # Newer pppd's also support replacing the default route, if one is
  57. # already present, when the GPRS connetion should be set as the default route
  58. # to the network
  59. replacedefaultroute
  60.  
  61. # DNS servers from the phone:
  62. # some phones support this, some don't.
  63. # usepeerdns
  64.  
  65. # ppp compression:
  66. # ppp compression may be used between the phone and the pppd, but the
  67. # serial connection is usually not the bottleneck in GPRS, so the
  68. # compression is useless (and with some phones need to disabled before
  69. # the LCP negotiations succeed).
  70. novj
  71. nobsdcomp
  72. novjccomp
  73. nopcomp
  74. noaccomp
  75.  
  76. # The phone is not required to authenticate:
  77. noauth
  78.  
  79. # Username and password:
  80. # If username and password are required by the APN, put here the username
  81. # and put the username-password combination to the secrets file:
  82. # /etc/ppp/pap-secrets for PAP and /etc/ppp/chap-secrets for CHAP
  83. # authentication. See pppd man pages for details.
  84. # Example, Radiolinja operator pap-secrets:
  85. # "rlnet"         *       "internet"  *
  86. user "rlnet"
  87.  
  88. # The persist tries to reopen the connection if it is dropped. This
  89. # is usefull for example with a Nokia 7650 which only manages to
  90. # 'dial' with every second attempt or when the network likes to drop the
  91. # connection every now and then. It's not fun when the over-night
  92. # 'apt-get dist-upgrade -d -y' fails constantly...
  93. #persist
  94. #maxfail 99
  95.  
  96.  
  97. # Asyncmap:
  98. # some phones may require this option.
  99. #asyncmap 0xa0000
  100.  
  101. # No magic:
  102. # some phones may require this option.
  103. #nomagic
  104.  
  105. # Require PAP authentication:
  106. # some phones may require this option.
  107. #require-pap
  108.  

/etc/ppp/peers/umts-connect-chat:

  1. exec chat                                               \
  2.         TIMEOUT         5                               \
  3.         ECHO            ON                              \
  4.         ABORT           '\nBUSY\r'                      \
  5.         ABORT           '\nERROR\r'                     \
  6.         ABORT           '\nNO ANSWER\r'                 \
  7.         ABORT           '\nNO CARRIER\r'                \
  8.         ABORT           '\nNO DIALTONE\r'               \
  9.         ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
  10.         ''              \rAT                            \
  11.         TIMEOUT         12                              \
  12.         SAY             "Press CTRL-C to close the connection at any stage!"    \
  13.         SAY             "\ndefining PDP context...\n"   \
  14.         OK              ATH                             \
  15.         OK              ATE1                            \
  16.         OK              ATD*99#                         \
  17.         TIMEOUT         22                              \
  18.         SAY             "\nwaiting for connect...\n"    \
  19.         CONNECT         ""                              \
  20.         SAY             "\nConnected." \
  21.         SAY             "\nIf the following ppp negotiations fail,\n"   \
  22.         SAY

/etc/ppp/peers/umts-disconnect-chat:

  1. exec /usr/sbin/chat -V -s -S  \
  2. ABORT  "BUSY"  \
  3. ABORT  "ERROR"    \
  4. ABORT  "NO DIALTONE"  \
  5. SAY  "\nSending break to the modem\n" \
  6. ""    "\K"    \
  7. ""    "+++ATH"  \
  8. SAY  "\nPDP context detached\n"

/etc/ppp/umts-wvdial.conf:

  1. [Dialer radiolinja_usb_orange_spv]
  2. Modem = /dev/ttyUSB0
  3. Baud = 460800
  4. Init1 = ATH
  5. Init2 = ATE1
  6. #Init3 = AT+CGDCONT=1,"IP","internet.t-d1.de","0.0.0.0",0,0
  7. Init3 = AT+CGDCONT=1,"IP","gprs.swisscom.ch","0.0.0.0",0,0
  8. Dial Command =
  9. Phone = ATD*99***1#
  10. Username = gprs
  11. Password = gprs

When I execute /pgm/scripts/umts, I see:

  1. Entering PIN.
  2. ATZ
  3. OK
  4. AT+CPIN="4711"
  5. OK
  6. Enter the next time in seconds to wait for the card: [60]:
  7. Opening the connection. Press Ctrl+C to hangup.
  8. --> WvDial: Internet dialer version 1.54.0
  9. --> Initializing modem.
  10. --> Sending: ATH
  11. ATH
  12. OK
  13. --> Sending: ATE1
  14. ATE1
  15. OK
  16. --> Sending: AT+CGDCONT=1,"IP","gprs.swisscom.ch","0.0.0.0",0,0
  17. AT+CGDCONT=1,"IP","gprs.swisscom.ch","0.0.0.0",0,0
  18. OK
  19. --> Modem initialized.
  20. --> Sending: ATD*99***1#
  21. --> Waiting for carrier.
  22. ATD*99***1#
  23. CONNECT 57600
  24. --> Carrier detected.  Waiting for prompt.
  25. --> Dont know what to do!  Starting pppd and hoping for the best.
  26. Serial connection established.
  27. using channel 26
  28. Using interface ppp0
  29. Connect: ppp0 <--> /dev/ttyUSB0
  30. sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x3d12d1fc>]
  31. rcvd [LCP ConfReq id=0x0 <asyncmap 0x0> <auth chap MD5> <magic 0x8116f5d> <pcomp> <accomp>]
  32. No auth is possible
  33. sent [LCP ConfRej id=0x0 <auth chap MD5> <pcomp> <accomp>]
  34. rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x3d12d1fc>]
  35. rcvd [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x8116f5d>]
  36. sent [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x8116f5d>]
  37. sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
  38. sent [IPCP ConfReq id=0x1 <addr 0.0.0.0>]
  39. rcvd [LCP DiscReq id=0x2 magic=0x8116f5d]
  40. rcvd [LCP ProtRej id=0x3 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
  41. rcvd [IPCP ConfReq id=0x0]
  42. sent [IPCP ConfNak id=0x0 <addr 10.0.0.1>]
  43. rcvd [IPCP ConfNak id=0x1 <addr 10.122.16.89>]
  44. sent [IPCP ConfReq id=0x2 <addr 10.122.16.89>]
  45. rcvd [IPCP ConfAck id=0x2 <addr 10.122.16.89>]
  46. rcvd [IPCP ConfReq id=0x1]
  47. sent [IPCP ConfAck id=0x1]
  48. replacing old default route to wlan0 [192.168.1.1]
  49. local  IP address 10.122.16.89
  50. remote IP address 10.0.0.1
  51. Script /etc/ppp/ip-up started (pid 21170)
  52. Script /etc/ppp/ip-up finished (pid 21170), status = 0x0

The wait is there because if I have just plugged in the card, it takes a while after entering the PIN and the card logging on to the network. Later, if you just reconnect, you can use 0 seconds; actually, entering the PIN will then return ERROR, which is just fine, as the PIN had been entered previously.

 

When I press Ctrl+C in the window, I get:

  1. Terminating on signal 2.
  2. restoring old default route to wlan0 [192.168.1.1]
  3. Script /etc/ppp/ip-down started (pid 21229)
  4. sent [LCP TermReq id=0x2 "User request"]
  5. rcvd [LCP TermAck id=0x2]
  6. Connection terminated.
  7. Connect time 1.0 minutes.
  8. Sent 18925 bytes, received 38068 bytes.
  9.  
  10. Sending break to the modem
  11.  
  12. PDP context detached
  13. Serial link disconnected.
  14. Waiting for 1 child processes...
  15.   script /etc/ppp/ip-down, pid 21229
  16. Script /etc/ppp/ip-down finished (pid 21229), status = 0x0
  17. Connect time 1.0 minutes.
  18. Sent 18925 bytes, received 38068 bytes.

That's all! If you've additional insight or experiences, please let me know.

 


11.01.2006, 15:28 Copyright © 2005 MN Soft Industry Software, 8a, Chemin de la Tarpa, CH-1872 Troistorrents-Chenarlier
Tel.: +41 797 844554; Fax: +41 860 797 844554, Responsible: Matthias Nott., mn(at)mnsoft.org
Top of Page