How to add D-link dwm-156 to usb switch mode for automatic eject of driver CD / switch to modem mode?
I am running Ubuntu 13.10, 32-bit.
I had every time need to go terminal to "eject" the windows driver CD,nor gone to disk & eject windows driver CD to make the d-link dwm-156 gsm modem functioning through network manager.
It seems that usb mode switch is not working.
But on my friend's computer with ubuntu 14.04 ,usb mode switch is working and i can connect d-link dwm-156 to mobile broadband through network manager as soon as i get in.
Is there any way to make usb mode switch to eject the windows driver CD of d-link dwm-156 in my ubuntu 13.10,32-bit at start up?
The lsusb output is Bus 002 Device 013: ID 2001:a706 D-Link Corp
before ejecting the CD (modem as storage device of windows driver).
The lsusb output is Bus 002 Device 005: ID 2001:7d01 D-Link Corp
after ejecting the CD (as modem).
I don't want to use the driver in the CD,as i need to send sms & find the data usage.
Solution 1:
GSM Modems with default ID 2001:a706 & target ID 2001:7d01
You must have usb switch mode installed (installed defaultly in every ubuntu)
-
Type in terminal:
sudo gedit /etc/usb_modeswitch.d/2001:a706
-
Copy following lines to the newly opened file & save it:
D-Link DWM-156 HSUPA 3.75G USB Modem TargetVendor=0x2001 TargetProduct=0x7d01 MessageContent="555342431234567800000000000003f0010100000000000000000000000000"
-
Type in terminal:
sudo usb_modeswitch -v 0x2001 -p 0xa706 -c /etc/usb_modeswitch.d/2001:a706
Now your modem must be switched to modem mode by using usb switch mode of your Ubuntu (usually takes 10s to appear in NetworkManager)
Now you can make it Automatic Switching
-
Type in terminal:
sudo gedit /lib/udev/rules.d/40-usb_modeswitch.rules
-
Change the default ID(vendor & product) of one of the D-link with the ones in the text editor & save it as below:
D-Link DWM-156 HSUPA 3.75G USB Modem ATTRS{idVendor}=="0791", ATTRS{idProduct}=="a800", RUN+="usb_modeswitch '%b/%k'"
Change the above code to the one below:
D-Link DWM-156 HSUPA 3.75G USB Modem ATTRS{idVendor}=="2001", ATTRS{idProduct}=="a706", RUN+="usb_modeswitch '%b/%k'"
NOTE: Do not create any new file for your device if your device's name is not present in the gedit list, it will not work ,only just add your ID's in any of the device name in the list, any name would actually work, name does not matter, only default ID's needed. Now save it & reconnect your modem and it will be detected automatically as modem. If you want to see it from the terminal use
lsusb
which will show differently before and after reconnection. Before ejecting it would look like 2001:a706. After reconnecting it looked like 2001:7d01, which is Modem mode.You can find message content at /usr/share/usb_modeswitch/configPack.tar.gz and find suitable by appropriate name. without correct message content it is not possible to use usb mode switch, some may not be appropiate. So in general what you did was:
You are providing your device id's to usb modeswitch when you ran the
sudo gedit /etc/usb_modeswitch.d/2001:a706
line.You are making it work automatically by adding your default id's in
sudo gedit /lib/udev rules.d/40-usb_modeswitch.rules
Other Modems not mentioned above
You must have usb switch mode installed (comes installed by default in Ubuntu).
-
Open a terminal and type in the following, replacing the words default vendor id's, default product id's, target vendor id's, target product id's with the id's of your device
sudo gedit /etc/usb_modeswitch.d/default vendor id : default product id
-
Copy the following lines & save them:
name of modem TargetVendor=0x???? TargetProduct=0x???? MessageContent="???????????????????????????????????????????????????????????" Type your id's & message content in the **????** above
-
Type in the terminal:
sudo usb_modeswitch -v 0xdefault vendor id -p 0xdefault product id -c /etc/usb_modeswitch.d/defult vendor id:default product id
Eg:
sudo usb_modeswitch -v 0x2001 -p 0xa706 -c /etc/usb_modeswitch.d/2001:a706
Now your modem must be switched to modem mode by using usb switch mode (Takes about 10s to appear in NetworkManager). Now make it automatic.
-
Type in terminal:
sudo gedit /lib/udev/rules.d/40-usb_modeswitch.rules
changing the default id(vendor & product) of one of modem with your ones & save it.
D-Link DWM-156 HSUPA 3.75G USB Modem ATTRS{idVendor}=="0791", ATTRS{idProduct}=="a800", RUN+="usb_modeswitch '%b/%k'"
Change the above to look like the one below:
D-Link DWM-156 HSUPA 3.75G USB Modem ATTRS{idVendor}=="your defult vendor id", ATTRS{idProduct}=="your default product id", RUN+="usb_modeswitch '%b/%k'"
Like mentioned in the above cases, name does not matter, only default id's needed, save it & now reconnect your modem and it will be detected automatically as modem.
If you run the lsusb
command you will see something like this:
ubuntu@ubuntu:~$ lsusb
Bus 002 Device 019: ID 2001:a706 D-Link Corp.
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Where 2001=vendor id; a706=product id. Default vendor:product Id's obtained BEFORE ejecting the driver cd. here, i used- 2001:a706
Target vendor:product Id's obtained AFTER ejecting the driver cd (as modem mode). here, i used 2001:7d01
You can also find the message content at /usr/share/usb_modeswitch/configPack.tar.gz
and find suitable for you by matching names, some may not be appropriate or at internet(difficult).
Note ID's & message content are different for different modems.
So basically here you have done two things:
Provided your device id's by adding it in
sudo gedit /etc/usb_modeswitch.d/
You made it to work automatically by adding your default id's in udev rules of usb mode switch
Remember that the ID's look like the following for the D-link dwm 3.75G usb adapter:
2001:a706 (Before ejecting) 2001:7d01 (After ejecting),
The USB Modem is supported since 13.10 with the USB Mode Switch 1.2.3. In 14.04, which is 2.1.1 already has an updated Id list. If you are having any issues, update to the latest Ubuntu version.