1

I have a Huawei E303F USB Modem. I have installed Ubuntu Studio 16.04.1 LTS "Xenial Xerus". The modem gets detected by the network manager.

I can setup a Mobile Broadband connection in Network Manager. But it is not connecting to the Internet. The connecting symbol is shown for a long time and then stops.

But it can connect, only after connecting it to the Internet in Windows and then booting into Ubuntu by restarting. If i shut down the system and then boot into Ubuntu (or) Unplug the device and replug it, it doesn't work. Eventhough I can get it detected using usb_modeswitch anytime, the connection is not established.

Then again I have to boot into windows and restart into Ubuntu.

After connecting to Internet in windows and restarted into Ubuntu :

usb-devices: Modem info when connecting

Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  4 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1506 Rev=01.02
S:  Manufacturer=HUAWEI
S:  Product=HUAWEI Mobile
C:  #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=03 Prot=01 Driver=option
I:  If#= 1 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
I:  If#= 2 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=03 Prot=03 Driver=option
I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=03 Prot=02 Driver=option
I:  If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
I:  If#= 6 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

usb-devices: Modem info when not connecting

T:  Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 11 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=12d1 ProdID=1506 Rev=01.02
S:  Manufacturer=HUAWEI
S:  Product=HUAWEI Mobile
C:  #Ifs= 6 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=03 Prot=01 Driver=option
I:  If#= 1 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=03 Prot=16 Driver=option
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=03 Prot=03 Driver=option
I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=03 Prot=02 Driver=option
I:  If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
I:  If#= 5 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
1

I got my modem working in Ubuntu Studio 16.04

In Ubuntu Studio 12.10, I installed huawei driver and it worked without any additional tweak. In Ubuntu Studio 15.10, it just worked right after I plugged it. I didnt do anything to get it work. In Ubuntu Studio 16.04, I did the simple steps of usb_modeswitch and modprobe to get it work. There are a number of articles and questions in forums about this. But still I want to mention how I did it and in a really detail manner. It involves three simple steps as follows,

Before trying out the following steps, find out whether you have a driver for your device given by the manufacturer. for Huawei, the driver is so old and so you may follow the steps below.

Step 1: Finding whether your device is detected

Find whether your USB is detected using lsusb and usb-devices commands,

If the result shows your modem in the list, see how many interfaces(If#) it has in the usb-devices command, listed with one line for each interface, beginning with an I:.

If it has only one interface(If#) line, that has a class specification of 'Cls=08(stor.)', then its in USB-flash drive mode. You have to switch it to modem mode using the next step.

If its not listed, then your modem is faulty or has some issues.

Step 2: usb_modeswitch for switching into 'modem mode'

1)substep:

First update usb-modeswitch and usb_modeswitch-data:

If you can manage to get internet somehow, for updating you can use these commands in the terminal: sudo apt-get install usb-modeswitch usb-modeswitch-data

or

Download using 'Synaptic Package Manager' and install offline :

You can use any other computer with Ubuntu and internet connection. Open synaptic packet manager and type usb-modeswitch in search field and in the result mark both the packages. And while you do that, it will ask whether to mark related dependency packages. click 'Mark'. Then go to file and click 'Generate Package Download Script' and select the directory you want to save the script and give the script a name like 'deblist' and save. Then go to the script's directory. open a terminal there and type,

bash ./deblist

This will download the packages to the same directory as the script. Copy the directory to your computer and install them by opening a terminal in the same directory and typing

sudo dpkg -i package1.deb package2.deb package3.deb 

Where the package1.deb, package2.deb, package3.deb and so on.., should be replaced with the names of the downloaded packages. This should install the packages. The steps above are generic for any software.

2)substep:

Then create a file named 12d1:1446 in the /etc/usb_modeswitch.d/ directory as the super user with the touch command.

sudo touch /etc/usb_modeswitch.d/12d1:1446

'12d1'is the Huawei 'vendor id' and '1446' is the 'unswitched product id' for my device and this can be obtained from the above lsusb or usb-devices commands for your device.

3)substep:

Then for switching into Modem mode, open a terminal and type

sudo usb_modeswitch -v 0x12d1 -p 0x1446 -J

usb_modeswitch command should include a switching method/message. Here the switching method is specified by -J and this is the standard Huawei switching method. It varies with different device manufacturers. Type man usb_modeswitch in the terminal for more information.

Now type usb-devices in the terminal and you should now see a new 'product id' and many interfaces(If#) for your device listed. Most of interfaces(If#) should be using the 'option' as driver. Some of these interfaces are used for internet connection and most of the time, the one used for connection has different driver like 'huawei_cdc_ncm'.

Now try connecting to the internet by setting up a 'Mobile Broadband Connection' using the 'Network Manager' of Ubuntu. If it is connected, then your job is done. but if it is not, then you may proceed to the next step.

Step 3: Getting the driver loaded

You can see what driver your mode switched modem is using from usb-devices command.

1)substep:

If it shows 'option' as driver for all the interfaces(If#), except for the ones used as usb-storage, proceed to the substep 2 given below (or) If is shows 'huawei_cdc_ncm', go to /lib/modules/(uname -r)/kernel/drivers/net/usb/ by typing,

sudo thunar /lib/modules/(uname -r)/kernel/drivers/net/usb/

or

sudo nautilis /lib/modules/(uname -r)/kernel/drivers/net/usb/

and move the 'huawei_cdc_ncm' by the 'cut and paste method' in a any other directory, as a backup.

Now remove the device, replug it and type the usb_modeswitch command. In the usb-devices command result, you should see 'none' as the driver for the interface(If#) that is used as modem.

2)substep:

Now remove the device again and type the command,

sudo rmmod option

to remove the option driver from the kernel

Now replug the device and type the usb_modeswitch command. And still you should see 'none' as driver for modem and 'option' as driver for other interfaces(If#) in the usb-devices command result.

Now open the file /sys/bus/usb-serial/drivers/option1/new_id using nano:

sudo nano /sys/bus/usb-serial/drivers/option1/new_id

type 12d1 1506 and save it using ctrl+o and exit using ctrl+x. Here 1506 is the 'modeswitched product id'. Now if you type usb-devices, you should see 'option' as the loaded driver for the modem.

3)substep:

Now use the modprobe usbserial command to get the device working with the loaded 'option' driver.

sudo modprobe usbserial vendor=12d1 product=1506

Now try connecting the modem to the Internet. Mostly it should be connected but if it doesnt, then unplug and try doing the step 3 again. Still if it doesnt connect, sometimes the process of automating these commands can connect the modem to Internet.

Step 4: Automating

To automate this process, after finishing the step 1's substep 2, copy the following lines

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="/usr/sbin/usb_modeswitch -v 12d1 -p 1446 -J"

ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="/bin/bash -c 'modprobe option && echo 12d1 1506 > /sys/bus/usb-serial/drivers/option1/new_id'"

to /lib/udev/rules.d/40-usb_modeswitch.rules using the command

sudo mousepad /lib/udev/rules.d/40-usb_modeswitch.rules

or

sudo gedit /lib/udev/rules.d/40-usb_modeswitch.rules

Dont forget to change the 'product id' in the above lines to your 'unswitched product id' after copying. Now if you unplug the device and plug it again, it should be connected to the internet.

Even if it does work. Sometimes its connecting only after I unplug and plug it again, after I boot the system. I think it is taking some time to load the 'option' driver.

0

I found out that even though Ubuntu has cdc_mbim driver, it couldn't generate two interfaces(If# in usb-devices command) out of the one that is used for connection in Ubuntu. But it seems Windows can. So when restarting the interface informations are still in the modem I guess but when switching off and turning on, it is not.

So when booted into Ubuntu it detects those interfaces and selects the right driver(cdc_mbim). But not necessarily two interfaces are needed for connection. Even one interface with right driver is enough. Which means no need to boot into windows first if the right module/driver is loaded properly(option module).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.