Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
ojo
Posts: 6
Joined: 13 Aug 2014, 17:50

Automatic switching of Huawei dongle

Post by ojo » 16 Jan 2018, 21:14

Hi,

most of the time the automatic switching after boot works like a charm, sometimes it doesn't. Then I issue

sudo usb_modeswitch -v 0x12d1 -p 0x1f01 -V 0x12d1 -P 0x14dc -M "55534243123456780000000000000a11062000000000000100000000000000"

(probably stolen from here, I can't remember) and everything works fine.

Anything that could be done to automatically switch at _every_ boot?

TIA,
Oliver


PS: For completeness:

After the switch lsusb gives:

Code: Select all

ojo@apollo:~$ lsusb -v -d 12d1:

Bus 003 Device 006: ID 12d1:14dc Huawei Technologies Co., Ltd. 
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            2 Communications
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x14dc 
  bcdDevice            1.02
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           94
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      6 Ethernet Networking
      bInterfaceProtocol      0 
      iInterface              5 
      CDC Header:
        bcdCDC               1.10
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      CDC Ethernet:
        iMacAddress                      7 (??)
        bmEthernetStatistics    0x00000000
        wMaxSegmentSize               1514
        wNumberMCFilters            0x0000
        bNumberPowerFilters              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               9
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      6 
      bInterfaceProtocol      0 
      iInterface              6 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1

Josh
Site Admin
Posts: 6570
Joined: 03 Nov 2007, 00:30

Re: Automatic switching of Huawei dongle

Post by Josh » 17 Jan 2018, 17:45

You did not give your usb_modeswitch version.

If it's pre-2.5.x, I suggest using the latest version from here. If your problem persists with the current version, I suspect a timing issue.

In the latter case, copy the config file for your modem ("12d1:1f01") to /etc/usb_modeswitch.d.
Edit it and add a line with the parameter "WaitBefore=2". That gives a delay in seconds before usb_modeswitch starts to act. Play around with the value.

ojo
Posts: 6
Joined: 13 Aug 2014, 17:50

Re: Automatic switching of Huawei dongle

Post by ojo » 17 Jan 2018, 22:14

Code: Select all

ojo@apollo:~$ usb_modeswitch --version

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.5 (C) Josua Dietze 2015
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !
I'll try playing with the config.

Thanks!

Kind regards,
Oliver

ojo
Posts: 6
Joined: 13 Aug 2014, 17:50

Re: Automatic switching of Huawei dongle

Post by ojo » 11 Apr 2018, 20:59

ojo wrote:

Code: Select all

ojo@apollo:~$ usb_modeswitch --version

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 2.2.5 (C) Josua Dietze 2015
 * Based on libusb1/libusbx

 ! PLEASE REPORT NEW CONFIGURATIONS !
I'll try playing with the config.

Thanks!

Kind regards,
Oliver
Duh!

I misread your reply to refer to version < 2.2.5.

OK, I'll try to install a newer one.

Regards,
Oliver

Post Reply