Using Tata Photon on SUSE Linux Enterprise 11 SP3


A few days back, SUSE (not Novell anymore, I guess) announced GA (general availability) status for SUSE Linux Enterprise 11 SP3. We are official training partners of SUSE and our training modules 3101, 3102 and 3103 make use of SLE 11 (both desktop and server editions). This being an enterprise distribution, it is possible that someone may try to use a USB 2G/3G modem with the operating system. Here are the steps we followed to make it work.

1. Observe

Log messages on inserting TATA Photon in SLE 11 (Server)

Log messages on inserting TATA Photon in SLE 11 (Server)

From the last few lines of the /var/log/messages, it is evident that the system (udev) detected this device as a usb-storage device, but not with modem characteristics. In order to use this, we need to get our system to switch the device mode with usb_modeswitch. Let us try with YaST (Yet Another Setup Tool). This handy utility manages to administer many (almost everything) system administrative tasks through an easy-to-use interface that is available in both GUI and text-only workstations/servers. First, we start YaST.

Opening YaST in SLE 11 SP3

Opening YaST in SLE 11 SP3

YaST being a system administration utility, requires elevated privileges (root).

YaST requires root authentication

YaST requires root authentication

In YaST, we open the Software Management applet.

YaST Software Management applet in SLE 11 SP3

YaST Software Management applet in SLE 11 SP3

2. Install Software

When we search for the term usb, we see some packages listed. Select usb_modeswitch (and it auto-selects usb_modeswitch-data as well) and then click on Accept button.

Installing usb_modeswitch and usb_modeswitch-data

Installing usb_modeswitch and usb_modeswitch-data

After this, on removing the TATA Photon USB dongle and re-inserting it, we see that there is almost no change in the system (udev) behaviour.

No change in system after installing usb_modeswitch

No change in system after installing usb_modeswitch

On inspecting a recent Fedora 19 installation, a file matching the idVendor (12d1) and idProduct (1505) is present in /etc/usb_modeswitch.d/12d1:1505. However, there is no such file in our SLE 11 SP3 machine.

Missing file for handling our device

Missing file for handling our device

3. Customize configuration

The file /etc/usb_modeswitch.d/12d1:1505 has the following content:
# Huawei EC156, Huawei E372u-8

TargetVendor= 0x12d1
TargetProductList="140b,1506,150f,150a"

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

So, maybe if we create this file manually, this will work for us. However, the behavior does not change much. Maybe this single edit is not enough for usb_modeswitch to do the work for us. Luckily there is also a command we can try out. Open the manual and study the options:

Manual for usb_modeswitch 1

Manual for usb_modeswitch 1

Manual for usb_modeswitch 2

Manual for usb_modeswitch 2

We try out the command, by building the options understood from the manual.


# usb_modeswitch --default-vendor 0x12d1 --default-product 0x1505 --target-vendor 0x12d1 --target-product 0x140b,0x1506,0x150f,0x150a --message-content "55534243123456780000000000000011062000000100000000000000000000"

Running usb_modeswitch command manually

Running usb_modeswitch command manually

While the command output does look promising, here is the output in the log:

Log after running usb_modeswitch command manually

Log after running usb_modeswitch command manually

We are looking for these devices: /dev/ttyUSB0, /dev/ttyUSB1, and /dev/ttyUSB2.

If the package wvdial is not already present, install it using YaST (as shown above). Create a wvdial configuration file in /etc/wvdial.conf as follows:


[Dialer Defaults]
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = internet
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CRM=1
Password = internet
Modem = /dev/ttyUSB0
Baud = 230400
Stupid Mode = 1

Run the command:
# wvdial /etc/wvdial.conf &

Here is the output:

Running wvdial

Running wvdial

The remote IP address mentioned in the output is the default gateway and the device is named ppp0 (just like old dial-up modem times). The output also mentions the primary and secondary DNS servers that can be updated using (what else?) YaST!

4. Other modems

The trick is to understand the name of the device as in the short code (example EC156). Then, go over to a recently updated distribution like openSUSE, or Fedora, and get the usb_modeswitch-data package (rpm) from one of them. Open the rpm with file-roller (or any other GUI archive handler), and look for a file (like in our case /etc/usb_modeswitch.d/12d1:1505). Customize the command according to what you see in the file.

You may have noticed that we have not shown installing an rpm package from another distribution. This is because we do not want unknown/untested packages to “taint” our system.

Update (31 July 2013)

It is possible to avoid manually changing the USB mode of the device by making one minor addition to a UDEV rule. After the packages usb_modeswitch, and usb_modeswitch-data have been installed, open the file /lib/udev/rules.d/40-usb_modeswitch.rules. At the very end, but before the last line, add an entry to force UDEV to trigger usb_modeswitch whenever our device is detected.


### file: /lib/udev/rules.d/40-usb_modeswitch.rules
# Part of usb-modeswitch-data, version 20101222
#
# This file is intended for USB_ModeSwitch version >= 1.1.2
# but will not break anything if used with versions >= 1.0.3
#
ACTION!="add", GOTO="modeswitch_rules_end"

# This adds a symlink "gsmmodem[n]" to ttyUSB ports with interrupt transfer;
# will work only with wrapper from 1.1.4 and above (otherwise ignored)
KERNEL=="ttyUSB*", ATTRS{bNumConfigurations}=="*", PROGRAM="usb_modeswitch --symlink-name %p %s{idVendor} %s{idProduct} %E{PRODUCT}",
SYMLINK="%c"

SUBSYSTEM!="usb", GOTO="modeswitch_rules_end"

# This adds the device ID to the "option" driver after a warm boot
# in cases when the device is yet unknown to the driver
ATTR{bInterfaceClass}=="ff", ATTR{bInterfaceNumber}=="00", ATTRS{bNumConfigurations}=="*", RUN+="usb_modeswitch --driver-bind %p %s{id
Vendor} %s{idProduct} %E{PRODUCT}"

# Most known install partitions are on interface 0, one on 5, one on 9
ATTRS{bInterfaceNumber}!="0[059]", GOTO="modeswitch_rules_end"

# only storage class devices are handled; negative
# filtering here would exclude some quirky devices
ATTRS{bDeviceClass}=="08", GOTO="modeswitch_rules_begin"
ATTRS{bInterfaceClass}=="08", GOTO="modeswitch_rules_begin"
GOTO="modeswitch_rules_end"

LABEL="modeswitch_rules_begin"
...
... some lines omitted
...
# Huawei EC156 (TATA Photon)
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1505", RUN+="usb_modeswitch '%b/%k'"

LABEL="modeswitch_rules_end"

After this modification, we can expect automatic USB mode change-over after inserting our device.The file /etc/usb_modeswitch.d/12d1:1505 will be required for this automatic action.