Automatic Activation, Hotplug and UDEV, Configuration
ewildgoose
Posts: 2
Joined: 06 Feb 2013, 14:59

Confirm E3131 modeswitch to CDC mode?

Post by ewildgoose » 06 Feb 2013, 17:09

Hi, I see various hints that it's possible to switch a huawei E3131 into CDC serial port mode, rather than cdc ethernet? I'm just ordering one now for testing, but would like to avoid bricking it 2 mins after it arrives. Can someone please confirm what has been put into the android ppp utility for example? (which claims it will work)

Is there a long term solution to this situation? From the forum threads it's suggested that there is an overlap of device ids which need very different eject sequences?

Also, I read on some threads that it's claimed that the device 12d1/1f01 corresponds with an E353 plus thie E3131, however, the E353 that I have here initially identifies itself as a 12d1/1446, then usb_modeswitch switches it to 12d1/1506? Are there many variants of the E353 which explain this?

Trying to understand how I can support both types of device safely on my router?

Thanks

Ed W

Guest
Posts: 6
Joined: 07 Jan 2013, 13:46

Re: Confirm E3131 modeswitch to CDC mode?

Post by Guest » 09 Feb 2013, 01:50

Hi ewildgoose,
I am trying to do the samething with my 12d1:1f01 (Huawei E353), the goal is to able to use at commands through serial port.
I have read from a thread that switch to serial rather than cdc ethernet can be done if for example I changed the MessageContent
from something like that
55534243123456780000000000000a11062000000000000100000000000000
to that
55534243123456780000000000000011062000000000000100000000000000

Not sure if this works as I don't see any changes in the usb interfaces and endpoints before and after conversion.

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Confirm E3131 modeswitch to CDC mode?

Post by LOM » 09 Feb 2013, 06:55

Try with the MessageContent 55534243123456780000000000000011060000000000000000000000000000

which switches some 12d1:1f01 versions into 12d1:14db with serial type interfaces.

If it works on yours then please post the output of lsusb -v -d 12d1:14db here.

Guest
Posts: 6
Joined: 07 Jan 2013, 13:46

Re: Confirm E3131 modeswitch to CDC mode?

Post by Guest » 09 Feb 2013, 11:28

woooooooooow LOM, it works :D

I have now new product ID 1001, the content of lsusb -v is :

Code: Select all


Bus 002 Device 006: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1001 E169/E620/E800 HSDPA Modem
  bcdDevice            1.02
  iManufacturer           2 
  iProduct                1 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           85
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      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              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      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              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      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              32
      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              32

The question I would like to ask is how can I get a knowledge like that I mean is there a documentation about different configuration being sent in the message content ?

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

Re: Confirm E3131 modeswitch to CDC mode?

Post by Josh » 09 Feb 2013, 13:52

Guest wrote:The question I would like to ask is how can I get a knowledge like that I mean is there a documentation about different configuration being sent in the message content ?
To prevent any misunderstanding: there is no configuration "sent" to the modem.

It is entirely up to the manufacturer (or more specifically to the developer of the modem firmware) to define commands that change the device mode in any way. In most cases there are only two modes ("install" and "modem"), however, we just don't know for sure.

These modes are already part of the firmware. There is no way to somehow provide additional modes from outside. All that the different switching sequences are doing is to trigger the mode switch.

Usually there is no documentation at all about these commands. All known variants were determined by sniffing the data exchange between the Windows driver - once it is installed - and the modem. Since the modems always start up in install mode, this driver must contain or run the tools to switch them to target mode.

Regarding newer modems:
We are starting to see a movement away from standard serial ports that provide PPP-style connections. Unfortunately, there is no real standard for the new ports - most variants require changes in the Linux driver source code.

Some (not all!) recent Huawei modems include a 'fallback' mode where the old serial ports are still available.

ursus
Posts: 7
Joined: 09 Feb 2013, 18:17

Re: Confirm E3131 modeswitch to CDC mode?

Post by ursus » 09 Feb 2013, 18:26

Hi,

today I was trying to switch my E3131 to serial mode and discovered the following:

by default device is working as CD-Rom with ID 12d1:1f01

After I've executed command "/usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00"
device swithced to CDC mode? with ID 12d1:14db

When I executed http://192.168.1.1/html/switchProjectMode.html
device switched to serial mode with ID 12d1:1442

modprobe
echo “12d1 1442″ > /sys/bus/usb-serial/drivers/option1/new_id

and device is available as /dev/ttyUSB0 and /dev/ttyUSB1

What files should I update in order my E3131 would automatically connect as 12d1:1442?

Many thanks!

Guest
Posts: 6
Joined: 07 Jan 2013, 13:46

Re: Confirm E3131 modeswitch to CDC mode?

Post by Guest » 09 Feb 2013, 18:45

@Josh,
Thanks for you respone, I think ursus answered my next question :)
I didn't know that I can convert the usb modem to serial ports using something like http://192.168.1.1/html/switchProjectMode.html
what is interesting is that when I used this method usb modem converted to product ID not like the one I have before this one is 1442 (the previous one was 1001), I think it may be using another Message Content I will sniff and figure out if this is true.
But what is clear to me that usb modems may be support more than serial port interfaces with different product IDs.
why Huawei do something like that ?

Code: Select all

Bus 002 Device 030: ID 12d1:1442 Huawei Technologies Co., Ltd. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1442 
  bcdDevice            1.02
  iManufacturer           2 HUAWEI
  iProduct                1 HUAWEI HiLink
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           55
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      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              32
      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              32


@ursus,
I think the answer to your question is by force the usb modem to go in serial port mode directly using the appriopriate Message Content in /usr/share/usb_modeswitch/12d1\:1f01, like what I did

ursus
Posts: 7
Joined: 09 Feb 2013, 18:17

Re: Confirm E3131 modeswitch to CDC mode?

Post by ursus » 09 Feb 2013, 21:44

If I'm doing properly, the I command I should use is:
usb_modeswitch -v 12d1 -p 14db -V 12d1 -P 1442 -M "55534243123456780000000000000011062000000100000000000000000000"
usb_modeswitch -v 12d1 -p 14db -V 12d1 -P 1442 -M "55534243123456780000000000000011060000000000000000000000000000"
usb_modeswitch -v 12d1 -p 14db -V 12d1 -P 1442 -M "55534243123456780000000000000a11062000000000000100000000000000"



I've tried several messages, but I get is:
Looking for default devices ...
found matching product ID
adding device
Found device in default mode, class or configuration (1)
Accessing device 020 on bus 001 ...
Getting the current device configuration ...
OK, got current device configuration (1)
Using first interface: 0x00
Error: message endpoint not given or found. Aborting.

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Confirm E3131 modeswitch to CDC mode?

Post by LOM » 10 Feb 2013, 02:26

ursus wrote:
When I executed http://192.168.1.1/html/switchProjectMode.html
device switched to serial mode with ID 12d1:1442

modprobe
echo “12d1 1442″ > /sys/bus/usb-serial/drivers/option1/new_id

and device is available as /dev/ttyUSB0 and /dev/ttyUSB1

What files should I update in order my E3131 would automatically connect as 12d1:1442?

Many thanks!
The switchProjectMode is a hidden and undocumented web page in the stick and you can only reach it when
the stick is in ethernet mode. How do you get it back to ethernet mode now?

The 2 serial interfaces of 12d1:1442 are not modem interfaces, I suspect they are used for maintenance and diagnostics like operator lock of the stick or for flashing a new firmware to the stick.
ursus wrote:If I'm doing properly, the I command I should use is:
usb_modeswitch -v 12d1 -p 14db -V 12d1 -P 1442 -M "55534243123456780000000000000011062000000100000000000000000000"
usb_modeswitch -v 12d1 -p 14db -V 12d1 -P 1442 -M "55534243123456780000000000000011060000000000000000000000000000"
usb_modeswitch -v 12d1 -p 14db -V 12d1 -P 1442 -M "55534243123456780000000000000a11062000000000000100000000000000"



I've tried several messages, but I get is:
Looking for default devices ...
found matching product ID
adding device
Found device in default mode, class or configuration (1)
Accessing device 020 on bus 001 ...
Getting the current device configuration ...
OK, got current device configuration (1)
Using first interface: 0x00
Error: message endpoint not given or found. Aborting.
12d1:14db is not a default mode id, it is a target mode id.
usb_modeswitch can not switch a stick which already is in target mode.

ursus
Posts: 7
Joined: 09 Feb 2013, 18:17

Re: Confirm E3131 modeswitch to CDC mode?

Post by ursus » 10 Feb 2013, 10:15

The problems is that after
command "/usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00"

device is always in 12d1:14db mode

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Confirm E3131 modeswitch to CDC mode?

Post by LOM » 10 Feb 2013, 11:29

ursus wrote:The problems is that after
command "/usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00"

device is always in 12d1:14db mode
Yes it is supposed to switch to 12d1:14db when you send that message to it.
If you don't want it to switch to 12d1:14db then don't send that message, use the one which I gave to "Guest".

ursus
Posts: 7
Joined: 09 Feb 2013, 18:17

Re: Confirm E3131 modeswitch to CDC mode?

Post by ursus » 10 Feb 2013, 13:09

I'm not sending any message or command when I plug or unplug the device, it's always in 12d1:14db mode

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Confirm E3131 modeswitch to CDC mode?

Post by LOM » 10 Feb 2013, 13:47

Is cd-rom interface disabled?
If it is then the stick might not return to install mode (cd-rom mode).

ursus
Posts: 7
Joined: 09 Feb 2013, 18:17

Re: Confirm E3131 modeswitch to CDC mode?

Post by ursus » 10 Feb 2013, 13:53

I as told I've executed command "/usr/bin/sg_raw /dev/sr0 11 06 20 00 00 00 00 00 01 00" in the beginning and it's always detected as 14db.
As I understand I need to retoron to cdrom mode and only after switch to 1442?
Could you please give me the proper commands?
Thanks!

LOM
Posts: 1404
Joined: 11 Jul 2012, 15:14
Location: Koh Samui, TH

Re: Confirm E3131 modeswitch to CDC mode?

Post by LOM » 10 Feb 2013, 14:31

There is no known command for switching from one target id to another target id.

What you can prey for is that one of the serial interfaces of 12d1:1442 takes AT cmds which can reset the stick.
If you get an OK when sending AT to ttyUSB0 or ttyUSB1 then you can try the AT^UDIAG=276 command.

Post Reply