Probing
|
Size: 13374
Comment:
|
Size: 13608
Comment: Link back to 3G hardware table, 3G
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| This page is part of the [[3GNetworkingIntrepid]] effort. |
|
| Line 89: | Line 91: |
| If you just can't find your device, make sure you still add it to the 3G hardware table. Submit a bug report that includes: | If you just can't find your device, make sure you still add it to the [[NetworkManager/Hardware/3G|3G hardware table]]. Submit a bug report that includes: |
| Line 187: | Line 189: |
| If you file a bug with an issue about phone support, consider attaching the output of {{{gsmctl -d /dev/MODEMDEVICE ALL}}} to the bug report (in ''addition'' to the output of {{{lshal}}} and the other information requested by the NM team). It might prove handy. | If you file a bug with an issue about phone support, consider attaching the output of {{{gsmctl -d /dev/MODEMDEVICE ALL}}} to the bug report (in ''addition'' to the output of {{{lshal}}} and the other information requested by the NM team). It might prove handy. Remember to add the device to the [[NetworkManager/Hardware/3G|3G hardware table]] and link to the bug from there if it's not already listed. |
This page is part of the 3GNetworkingIntrepid effort.
Probing your modem
Many modems are internally installed in a laptop, or are rebranded/rebadged devices from other providers. They also vary in terms of their capabilities, many of which can't be discovered from the USB device IDs alone.
This page details some steps you can take to find out more about your modem so the NetworkManager team have more information to work with during testing and development.
Finding the bus type and device identifiers for your modem
If you already know your device's USB product and vendor IDs, you might as well skip this section. If you file a hardware support bug, consider including the output of lsusb -vvv (or an excerpt of it showing the output for the device of interest).
Most cellular modems seem to present a USB interface, even the internal mini-PCI-E and mini-PCI cards. Unless you know your modem isn't a USB device you should start by using `lsusb' to check for your device and, if you find it, get its vendor and device IDs.
Make sure you run update-usbids before you try to find your modem, as more details are always being added to the USB device IDs database.
craig$ sudo /usr/sbin/update-usbids
Now, to find the modem:
craig$ lsusb Bus 007 Device 003: ID 05a9:7670 OmniVision Technologies, Inc. OV7670 Webcam Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 004: ID 0421:04f0 Nokia Mobile Phones Bus 004 Device 002: ID 04f2:0618 Chicony Electronics Co., Ltd Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 413c:8138 Dell Computer Corp. Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard EAP-SIM Port Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 007: ID 0a5c:4503 Broadcom Corp. Bus 001 Device 006: ID 0a5c:4502 Broadcom Corp. Bus 001 Device 005: ID 413c:8126 Dell Computer Corp. Wireless 355 Bluetooth Bus 001 Device 004: ID 0a5c:4500 Broadcom Corp. Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
In this case it's pretty clear that the modem is the Dell Computer Corp. Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard EAP-SIM Port with USB ID 413c:8138, ie vendor=0x413c product=0x8138 . However, there's also a Nokia mobile phone that's capable of being used as a modem shown in the list.
In some cases your device will have a less useful name - like, say, Dell. You may be able to find it using lsusb -vvv (run as root).
sudo lsusb -vvv > /tmp/usb_info
There's a lot of information there. What you're looking for is a CDC ACM device category, which most phones and some, but far from all, internal modems provide. The following awk script will search lsusb for you and print some details for anything with CDC ACM interface descriptors:
/^Bus/ {
curdev = $0;
}
/iManufacturer/ {
curman = $2
}
/iProduct/ {
curprod = $2
}
/bInterfaceNumber/ {
curiface = $2
}
/CDC ACM/ {
printf "%s iM=%s iP=%s if=%s\n",curdev,curman,curprod,curiface;
}Save it as searchusb.txt to your Desktop then run:
sudo lsusb -vvv | awk -f ~/Desktop/searchusb.txt
Hopefully you'll see something like:
Bus 004 Device 004: ID 0421:04f0 Nokia Mobile Phones iM=1 iP=2 if=10 Bus 004 Device 004: ID 0421:04f0 Nokia Mobile Phones iM=1 iP=2 if=12
which gives you the vendor and product IDs (0421 and 04f0 respectively) as well as a few other handy details.
Note that the Dell built-in modem was not detected, because it doesn't use the standard CDC ACM descriptors. You just have to know what it is, identify it by elimination (ie you know what every other device is), etc. When you're pretty sure you know the vendor and product IDs, try talking to it with the usbserial driver (see the instructions for devices that aren't detected below) and see if it responds sensibly to a probe.
Some devices won't be found by the lsusb command above, but will be known to one of the kernel drivers. In that case you may well be able to see details about the device in the output of dmesg or lshal. Drivers to look out for include airprime and option.
There are also non-USB cellular modems. Some external modems connect to the host using RS232 serial lines, and may not be detected by Linux at all, though you can still probe them using the procedures below if you know which serial port they're connected to. Others appear on the PCI or cardbus interfaces.
If you just can't find your device, make sure you still add it to the 3G hardware table. Submit a bug report that includes:
the full output of lshal
the full output of sudo lsusb -vvv
/var/log/syslog
/var/log/kern.log
the full output of sudo lspci -vvv
the full output of sudo pccardctl ident (if you have a PCMCIA, ie "PC Card" bus)
Finding your modem's serial device
To probe your modem, you need to find out your modem's device node. That'll normally be printed in /var/log/kern.log when you plug the modem in, or will appear in dmesg during boot. Common device nodes are /dev/ttyUSB0 and /dev/ttyACM0.
If it doesn't seem to be detected at all and it's a USB device (almost all, even internal modems, are) then try using lsusb to find its vendor and product codes (see above) and load the usbserial module manually. (You can probe a bluetooth modem too with a bit more work - see the end of the document for setup). For example, if lsusb shows:
Bus 002 Device 002: ID 413c:8138 Dell Computer Corp. Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard EAP-SIM Port
the vendor ID is 413c and the device ID is 8138, so I can load the driver with:
sudo modprobe usbserial vendor=0x413c product=0x8138
after which I can access the modem as /dev/ttyUSB0 since I have no other USB serial devices on the system.
Probe script for modem capabilities
Save the following text to a file named 'probe.txt' on your GNOME desktop. This script will be used to probe your modem for its capabilities and a few other details.
REPORT +GCAP: REPORT +COPS: REPORT +CREG: TIMEOUT 2 '' # Change the PIN below to your SIM unlock PIN if you have one. # If you don't, just leave it at 0000. ATZ+CPIN="0000" OK-ATZ-OK AT+GCAP +GCAP: AT+COPS? +COPS: AT+CREG? +CREG:
Probing the modem
Once you know the device node for your modem, execute the following shell command, replacing MODEMDEVICE with the path to the device node:
chat -s -f ~/Desktop/probe.txt </dev/MODEMDEVICE >/dev/MODEMDEVICE
For example, the following shows me probing my my built-in HSDPA modem on /dev/ttyUSB0 then my USB mobile phone on /dev/ttyACM0:
craig$ chat -s -f ~/Desktop/probe.txt >/dev/ttyACM0 </dev/ttyACM0 chat: Sep 03 10:40:47 +GCAP: +CGSM,+DS,+W chat: Sep 03 10:40:47 +COPS: 0,2,"50501",2 chat: Sep 03 10:40:47 +CREG: 0,1 craig$ chat -s -f ~/Desktop/probe.txt >/dev/ttyUSB0 </dev/ttyUSB0 chat: Sep 03 10:40:51 +GCAP: +CGSM,+DS,+ES chat: Sep 03 10:40:52 +COPS: 0,0,"Telstra Mobile",2 chat: Sep 03 10:40:52 +CREG: 0,1
The part of the output you want to include on this wiki page is the bit after +GCAP:, eg +CGSM,+DS,+ES. It'd be helpful if you could post the COPS output, too, eg 0,0,"Telstra Mobile",2.
Getting more hardware details
Lots of GSM/CDMA modems are rebranded. Everything in a Dell machine, for example. You can get hardware details from these modems using gsmctl from the gsm-utils package in universe:
craig$ # My Dell 5520 internal HSDPA modem craig$ gsmctl -d /dev/ttyUSB0 ME <ME0> Manufacturer: Novatel Wireless Incorporated <ME1> Model: Expedite EU870D MiniCard <ME2> Revision: 10.9.0102.0-00 [2007-07-03 13:50:21] <ME3> Serial Number: 351380115216121 craig$ craig$ # My N95-3 craig$ gsmctl -d /dev/ttyACM0 ME <ME0> Manufacturer: Nokia <ME1> Model: Nokia N95 <ME2> Revision: V 06wk41v57.1 24-04-08 RM-160 (c) Nokia <ME3> Serial Number: 318911111771193
Note: The serial numbers in the above have been replaced with dummies.
If you file a bug with an issue about phone support, consider attaching the output of gsmctl -d /dev/MODEMDEVICE ALL to the bug report (in addition to the output of lshal and the other information requested by the NM team). It might prove handy. Remember to add the device to the 3G hardware table and link to the bug from there if it's not already listed.
Probing bluetooth modems
A bluetooth modem generally works as a virtual serial device over an rfcomm channel. You can probe these much the same way as shown above, but first you need to set up the channel.
To start with, make sure the tools you'll need are installed:
sudo aptitude install bluez-utils ppp
Turn bluetooth on in your phone and set it to be visible to all (discoverable). If it's a dedicated modem not a phone, you might need to press the "connect" or "discover" button instead. It'll also help if you pair your phone/modem and laptop then set the pairing to trusted on the phone/modem so that you're not prompted to approve connections all the time.
Now find its bluetooth MAC address using hcitool scan:
craig$ hcitool scan
Scanning ...
00:1D:E9:F5:55:AF Craig's N95You can now set your phone/modem back to invisible (not discoverable) mode if you prefer to. We'll be talking to it directly from now on, so bluetooth must be on but does not need to be discoverable.
Use sdptool to discover the rfcomm port for DUN (dial-up networking) communication:
craig$ sdptool search --bdaddr 00:1D:E9:F5:55:AF DUN
Searching for DUN on 00:1D:E9:F5:55:AF ...
Service Name: Dial-Up Networking
Service RecHandle: 0x1001f
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
Language Base Attr List:
code_ISO639: 0x454e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100The RFCOMM channel we need is 4, as shown on the line below RFCOMM in the output above. Note that this often varies; some phones change RFCOMM DUN channels when rebooted, for example.
We now know enough to set up an RFCOMM binding we can use to talk to the modem. Specify your device's bluetooth MAC address and its RFCOMM channel (the last argument to rfcomm) in place of mine when you run the command below:
craig$ sudo rfcomm bind /dev/rfcomm0 00:1D:E9:F5:55:AF 4 craig$
It will generate no output, but running rfcomm again without arguments should show a binding.
craig$ rfcomm rfcomm0: 00:1D:E9:F5:55:AF channel 4 clean
You can now use /dev/rfcomm0 as the serial device node to talk to the modem when probing it using the instructions above. The phone and/or gnome-bluetooth on your laptop might prompt you for a passkey to set up a pairing if you haven't used the two devices together before. Additionally, the phone/modem may prompt you to accept the bluetooth connection from the laptop, so make sure you're ready to accept if prompted. Setting up a trusted pairing will eliminate that prompt.
This setup procedure will also let you use ppp over the rfcomm channel to connect to the Internet through your phone. Use a ppp and chat setup, or use a tool like wvdial just as you would a USB or serial GSM modem once you've created the binding. Here's a little shell script I use to re-bind the phone before connecting:
# replace the following with the MAC address of your phone. Note that
# your phone does NOT need to be discoverable for this to work.
BT=00:1D:E9:F5:55:AF
if test "$(id -u)" -ne 0 ; then
exec sudo $0
fi
CHAN=$(sdptool search --bdaddr $BT DUN | awk '/Channel/ { print $2}')
rfcomm release 2
rfcomm bind 2 "$BT" "$CHAN"
rfcommThis full procedure has been tested on a Nokia N95 and an LG U990.
Notes
The gsmctl program from the gsm-utils should be able to probe most modems, but appears to have issues parsing provider information returned by many devices. As I wasn't able to get it to reliably probe my modems I've provided a chat script to do the job instead. However, it and libgsm appear to be an ideal way to talk to modems, and should probably be considered for use by NetworkManager when doing things like:
- Determining battery level and charging state for a bluetooth or USB phone/modem
(I'm thinking in terms of a NetworkManager popup: "WARNING: The modem you are using for your network connection is almost out of battery power")
- Determining network connection quality - Getting operator details - Getting make/model information - Discovering operators within range for roaming etc - Testing PIN locking status
Also, some handy commands for GSM hardware control and probing can be found here and here.
NetworkManager/Hardware/3G/Probing (last edited 2009-06-29 23:46:36 by host-94-243-84-195)