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.