6

I am using Trisquel 7.0 LTS and mobile broadband (Net-Setter) to establish connection.

Following states (1-4) are showing different conditions/situations for clear understanding of problem.

State-1:-

After Installation of Trisquel 7.0 LTS, Everything is working fine. My modem is detected as follows (lsusb output):

$ lsusb
Bus 001 Device 004: ID 12d1:1436 Huawei Technologies Co., Ltd. E173 3G Modem (modem-mode)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

And It is also detected by nm-applet or say by using nmcli as follows:

$ nmcli dev list
GENERAL.DEVICE:                         ttyUSB2
GENERAL.TYPE:                           gsm
GENERAL.VENDOR:                         HUAWEI Technology
GENERAL.PRODUCT:                        HUAWEI Mobile

State-2:-

But I recently ran an installation script from Mobile Partner, which did not properly install, and hence I also ran the Un-installation script And Unfortunately, in spite of uninstallation, now my modem isn't working (detecting properly).

There is now a change in detection and new (current) output by lsusb is:

$ lsusb
Bus 001 Device 003: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 002: ID 093a:2510 Pixart Imaging, Inc. Optical Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Here you can see the difference that is-
Ealier:

Bus 001 Device 004: ID 12d1:1436 Huawei Technologies Co., Ltd. E173 3G Modem (modem-mode)

And Now:

Bus 001 Device 003: ID 12d1:1446 Huawei Technologies Co., Ltd. 1552/E1800/E173 (HSPA modem)

And now the modem isn't detected in nm-applet (nor listed by nmcli).

So, How can I reset settings to default because default Trisquel has no problem with my device. In other words which files are affected by this new behavior and How do I revert to Earlier condition ? (Otherwise I have to re-install my whole OS!)


State3:-

I've written a file named 12d1:1446 under /etc/usb_modeswitch.d/ which is:

DefaultVendor= 0x12d1 
DefaultProduct=0x1446

MessageContent="55534243123456780000000000000011062000000100000000000000000000"

And I run this by command:

sudo usb_modeswitch -I -W -c /etc/usb_modeswitch.d/12d1\:1446

Which works fine and cause lsusb changed

From:

Bus 001 Device 003: ID 12d1:1446 Huawei Technologies Co., Ltd. E1552/E1800/E173 (HSPA modem)

Back To:

Bus 001 Device 004: ID 12d1:1436 Huawei Technologies Co., Ltd. E173 3G Modem (modem-mode)

And hence it will be detected by network-manager ; I will be able to connect.


State-4:(Following to this answer)-

I've written file named 99-mymodem.rules under /etc/rules.d containing:

ACTION=="add", ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="/home/pandya/usbmode"

And /home/pandya/usbmode contains:

#!/bin/bash
sudo usb_modeswitch -I -W -c /etc/usb_modeswitch.d/12d1\:1446

Hence, When I plugged in my modem, 99-mymodem.rules runs /home/pandya/usbmode and I managed to detect my modem as:

Bus 001 Device 004: ID 12d1:1436 Huawei Technologies Co., Ltd. E173 3G Modem (modem-mode)

Ultimately I can successfully connect modem by network-manager (nm-applet).


Conclusion:-

However, current condition (State-4) is alternatively what I'm looking for but not Exactly (State-1) because we are passing through udev-rule and usb-modeswitch every time when modem is plugged-in.

In other words Why I have to usb_modeswitch Now? (Earlier no necessary, Also If I boot from Live DVD and choose Try OS without installing, modem is working fine without manually usb_modeswitch).

Therefore (since I've written this question) My aim is to revert to State-1.

Pandya
  • 23,898
  • 29
  • 92
  • 144
  • @don_crissti I've attached scripts at the last of the post. – Pandya Dec 29 '14 at 04:20
  • 1. Does your device belong to your ISP/Wireless Company? Without using the USB modeswitch Script, do you have a PPPoE Daemon, such as `pppd`? – eyoung100 Dec 30 '14 at 16:06
  • AFAIK all this is to be handled by udev and I think it's `modemmanager` that's supposed to install udev rules. Have you filed a bug / feature request? – Pavel Šimerda Jan 04 '15 at 09:12

4 Answers4

4

Try udev rule wich launch a script every time you plug the modem.

ACTION=="add", ATTRS{idVendor}=="XXXX", ATTRS{idProduct}=="UUUU", RUN+="/home/user/script.sh"

Replace XXXX and UUUU with vendor and id product,put rule in /etc/udev/rules.d/99-yourrule.rules and reboot or restart udev. Must work

Pandya
  • 23,898
  • 29
  • 92
  • 144
elbarna
  • 12,050
  • 22
  • 92
  • 170
  • Yes, I tried it and is working fine. This seems alternative permanent solution but not actually because we manually passing through 1.udev rules and 2. usb_modeswitch by auto script(s) every time at plugged in. The perfect solution is to revert to default condition as explained in question. Any way thank-you for udev suggestion (+1) – Pandya Dec 31 '14 at 09:47
1

Please be sure that in configuration file /etc/usb_modeswitch.conf you have set

DisableSwitching=0

Otherwise automatic mode switching is disabled globally.

jimmij
  • 46,064
  • 19
  • 123
  • 136
  • Yes, I've checked that is already `DisableSwitching=0` in `/etc/usb_modeswitch.conf` ! – Pandya Jan 04 '15 at 06:07
  • Your Idea of automatic mode switching helps me to troubleshoot my problem and I found [solution](http://unix.stackexchange.com/a/177369/66803). Thank-you. – Pandya Jan 04 '15 at 16:06
1

At Last (Ultimately) I've found out what cause problem with automatic usb_mode switching.

The file 40-usb_modeswitch.rules under /lib/udev/rules.d contains:

# Huawei, newer modems
ATTR{idVendor}=="12d1", ATTR{idProduct}=="1446", RUN+="usb_modeswitch '%b/%k'"

So, My modem must be automatically usb_modeswitch by 40-usb_modeswitch.rules.

But the problem is that /usr/sbin/usb_modeswitch & /usr/sbin/usb_modeswitch_dispatcher not set chmod +x (Allow to execute file). Probably installation script (attached in question) had modified attribute.

While manually sudo usb_modeswitch -I -W -c /etc/usb_modeswitch.d/12d1\:1446 (explained in question) I sudo chmod +x /usr/sbin/usb_modeswitch But /usr/sbin/usb_modeswitch_dispatcher still not have execution permission.

So Now I've just sudo chmod +x /usr/sbin/usb_modeswitch_dispatcher and I almost Done!

After that I removed all manual switching process stated in State-4 (see question) and Now my modem successfully detected as:

Bus 001 Device 004: ID 12d1:1436 Huawei Technologies Co., Ltd. E173 3G Modem (modem-mode)

In other words 40-usb_modeswitch.rules working fine.

Finally I reverted to State-1. [SOLVED]

Pandya
  • 23,898
  • 29
  • 92
  • 144
  • Though this looks encouraging, I must say that I am confronted with the same problem, but on my system both files have the executable bit set - therefore I conclude that there must be other underlying contributing factors. – ralien Feb 15 '17 at 21:46
0

I've dealt with the same problem and the accepted solution did not work for me. If you have a Raspbian distro, there is a known bug discussed here: https://github.com/RPi-Distro/repo/issues/47.

The solution is:

  1. edit /lib/udev/rules.d/40-usb_modeswitch.rules
  2. edit ATTRS{idVendor}=="12d1", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'", by changing '%b/%k' to '%k'.

Tested on Raspbian 8 with Huawei EC315.

ralien
  • 101
  • 2