Activation Codes and Methods, Hardware Details, Sniffing
Post Reply
hyc
Posts: 7
Joined: 04 Nov 2016, 23:43

Huawei E3372 and Geekbox

Post by hyc » 04 Nov 2016, 23:50

I actually have two Huawei LTE modems and both are showing the same behavior. Plugged into my Ubuntu laptop they work fine and switch from 12d1:1f01 to 12d1:14dc coming up as cdc_ether devices, ethX interface and work immediately. Also working fine with a TP-Link router running OpenWRT.

Plugged into the Geekbox, they switch to 12d1:155e and use cdc_ncm driver. 3 ttyUSBX devices get created with them. The geekbox is running an ARM64 kernel

Linux geekbox 3.10.0 #5 SMP PREEMPT Sun Mar 13 01:14:21 CET 2016 aarch64 GNU/Linux

and Debian Jessie. I don't know what to do with this ncm driver. How do I get it to switch to :14dc and use cdc_ether instead? Or is there anything useful I can do with it using the ncm driver?

Here's the log from a recent attempt:

Code: Select all

USB_ModeSwitch log from Fri Nov 04 21:31:28 UTC 2016

Use global config file: /etc/usb_modeswitch.conf

Started via systemd
Raw args from udev: /1/1.4:1.0

Use top device dir /sys/bus/usb/devices/1-1.4

----------------
USB values from sysfs:
  manufacturer  HUAWEI_MOBILE
  product       HUAWEI_MOBILE
  serial        0123456789ABCDEF
----------------
bNumConfigurations is 1 - don't check for active configuration
Found packed config collection /usr/share/usb_modeswitch/configPack.tar.gz
ConfigList: /etc/usb_modeswitch.d/12d1:#android pack/12d1:#android pack/12d1:#android
SCSI attributes not needed, move on
Check config: /etc/usb_modeswitch.d/12d1:#android
! matched. Read config data
Use config file from override folder /etc/usb_modeswitch.d
Logger is /usr/bin/logger
config: TargetVendor set to 12d1
config: TargetProductList set to 14db,14dc
config: NoDriverLoading is set to active
Driver will not be handled by usb_modeswitch
Note: Using generic manufacturer configuration for "android"
Command to be run:
usb_modeswitch -W -D -s 20 -u -1 -b 1 -g 13 -v 12d1 -p 1f01 -f $configBuffer

In this attempt, I took the 12d1:1f01 config file and copied it into /etc/usb_modeswitch.d/12d1:#android thinking that I could change the behavior but it made no difference.

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

Re: Huawei E3372 and Geekbox

Post by Josh » 05 Nov 2016, 08:56

Some essential information is missing:

What's the content of the 12d1:1f01 config file that you put into /etc/usb_modeswitch.d ?

Does the log actually stop at the last line you posted?

What version of usb_modeswitch is running on the geekbox? Was it part of the original installation or did you install it manually?

hyc
Posts: 7
Joined: 04 Nov 2016, 23:43

Re: Huawei E3372 and Geekbox

Post by hyc » 05 Nov 2016, 14:57

Josh wrote:Some essential information is missing:

What's the content of the 12d1:1f01 config file that you put into /etc/usb_modeswitch.d ?

Code: Select all

# Huawei E353 (3.se) and others
TargetVendor=0x12d1
TargetProductList="14db,14dc"
#MessageContent="55534243123456780000000000000011062000000101000100000000000000"
MessageContent="55534243123456780000000000000011062000000000000200000000000000"
#MessageContent="55534243123456780000000000000a11062000000000000100000000000000"
#NoDriverLoading=1
I originally copied this 12d1:1f01 file from a 2.1.1 install on my Ubuntu laptop. Then I tried a couple other messages found in other threads on this forum. None of the changes made any difference.
Does the log actually stop at the last line you posted?
Yes, that's all there is.
What version of usb_modeswitch is running on the geekbox? Was it part of the original installation or did you install it manually?
it's 2.2.0, the vanilla package for this distro.

I'm suspicious that something else is triggering a mode switch before usb_modeswitch runs. I actually renamed the usb_modeswitch binaries to elsewhere and the USB device still changes. This kernel is actually one built for android, which is what originally ships on the Geekbox. Do android kernels have modeswitching built in?

hyc
Posts: 7
Joined: 04 Nov 2016, 23:43

Re: Huawei E3372 and Geekbox

Post by hyc » 05 Nov 2016, 15:00

Current attempt:

Code: Select all

root@geekbox:/etc/usb_modeswitch.d# cat /var/log/usb_modeswitch_1-1.4\:1.0 

USB_ModeSwitch log from Sat Nov 05 05:01:55 UTC 2016

Use global config file: /etc/usb_modeswitch.conf

Started via systemd
Raw args from udev: /1/1.4:1.0

Use top device dir /sys/bus/usb/devices/1-1.4

----------------
USB values from sysfs:
  manufacturer	HUAWEI_MOBILE
  product	HUAWEI_MOBILE
  serial	0123456789ABCDEF
----------------
bNumConfigurations is 1 - don't check for active configuration
ConfigList: /etc/usb_modeswitch.d/12d1:#android
SCSI attributes not needed, move on
Check config: /etc/usb_modeswitch.d/12d1:#android
! matched. Read config data
Use config file from override folder /etc/usb_modeswitch.d
Logger is /usr/bin/logger
config: TargetVendor set to 12d1
config: TargetProductList set to 14db,14dc
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Note: Using generic manufacturer configuration for "android"
Command to be run:
usb_modeswitch -W -D -s 20 -u -1 -b 1 -g 39 -v 12d1 -p 1f01 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------

Read long config from command line

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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x12d1
DefaultProduct= 0x1f01
TargetVendor=   0x12d1
TargetProductList="14db,14dc"
MessageContent="55534243123456780000000000000011062000000000000200000000000000"
NeedResponse=0
Success check enabled, max. wait time 20 seconds
System integration mode enabled

Use given bus/device number: 001/039 ...
Look for default devices ...
 No devices in default mode found. Nothing to do. Bye!
--------------------------------
(end of usb_modeswitch output)

Device directory in sysfs is gone! Something went wrong, abort

root@geekbox:/etc/usb_modeswitch.d# 

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

Re: Huawei E3372 and Geekbox

Post by LOM » 05 Nov 2016, 17:46

You are not using the correct switch message.
The data package released at the same time as the 2.1.1 executables has the correct config file for your device, use it instead of experimenting with your own created ones..

hyc
Posts: 7
Joined: 04 Nov 2016, 23:43

Re: Huawei E3372 and Geekbox

Post by hyc » 05 Nov 2016, 21:46

LOM wrote:You are not using the correct switch message.
The data package released at the same time as the 2.1.1 executables has the correct config file for your device, use it instead of experimenting with your own created ones..
That was the very first thing I tried. It still didn't work.

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

Re: Huawei E3372 and Geekbox

Post by LOM » 06 Nov 2016, 01:45

hyc wrote:
LOM wrote:You are not using the correct switch message.
The data package released at the same time as the 2.1.1 executables has the correct config file for your device, use it instead of experimenting with your own created ones..
That was the very first thing I tried. It still didn't work.
It didn't work with your home made switch message either so the log you posted is not of much use. It does show though that the device 12d1:1f01 is gone before usb_modeswitch has had a chance to send the switch message which could be caused by not enough power for the dongle on the usb port or caused by another switching tool having switched the dongle.
You should always check with lsusb to see what state the dongle is in after running usb_modeswitch and your dmesg log may also give a hint to what has happened.
hyc wrote: This kernel is actually one built for android, which is what originally ships on the Geekbox. Do android kernels have modeswitching built in?
Only if the creator of the distro has included it, you'll have to ask those who have provided you with this distro.

hyc
Posts: 7
Joined: 04 Nov 2016, 23:43

Re: Huawei E3372 and Geekbox

Post by hyc » 06 Nov 2016, 02:05

The dmesg / kernel log only tells me that a switch happened. I don't know what triggered it.

Code: Select all

Nov  5 04:48:23 geekbox kernel: [  989.505809]  [0:          khubd:   63] usb 1-1.4: new high-speed USB device number 36 using ehci-platform
Nov  5 04:48:23 geekbox kernel: [  989.626586]  [0:          khubd:   63] usb 1-1.4: New USB device found, idVendor=12d1, idProduct=1f01
Nov  5 04:48:23 geekbox kernel: [  989.626683]  [0:          khubd:   63] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov  5 04:48:23 geekbox kernel: [  989.626747]  [0:          khubd:   63] usb 1-1.4: Product: HUAWEI_MOBILE
Nov  5 04:48:23 geekbox kernel: [  989.626807]  [0:          khubd:   63] usb 1-1.4: Manufacturer: HUAWEI_MOBILE
Nov  5 04:48:23 geekbox kernel: [  989.626867]  [0:          khubd:   63] usb 1-1.4: SerialNumber: 0123456789ABCDEF
Nov  5 04:48:23 geekbox kernel: [  989.696707]  [0:          khubd:   63] usb-storage 1-1.4:1.0: USB Mass Storage device detected
Nov  5 04:48:23 geekbox kernel: [  989.700364]  [0:          khubd:   63] usb_stor_bulk_transfer_buf performing result is 0, transfer the actual length=31
Nov  5 04:48:23 geekbox kernel: [  989.700575]  [0:          khubd:   63] scsi11 : usb-storage 1-1.4:1.0
Nov  5 04:48:23 geekbox kernel: [  989.782884]  [0:          khubd:   63] usb 1-1.4: USB disconnect, device number 36
Nov  5 04:48:24 geekbox kernel: [  990.520175]  [0:          khubd:   63] usb 1-1.4: new high-speed USB device number 37 using ehci-platform
Nov  5 04:48:24 geekbox kernel: [  990.629405]  [0:          khubd:   63] usb 1-1.4: New USB device found, idVendor=12d1, idProduct=155e
Nov  5 04:48:24 geekbox kernel: [  990.629510]  [0:          khubd:   63] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov  5 04:48:24 geekbox kernel: [  990.629573]  [0:          khubd:   63] usb 1-1.4: Product: HUAWEI_MOBILE
Nov  5 04:48:24 geekbox kernel: [  990.629633]  [0:          khubd:   63] usb 1-1.4: Manufacturer: HUAWEI_MOBILE
Nov  5 04:48:24 geekbox kernel: [  990.689613]  [0:          khubd:   63] option 1-1.4:1.0: GSM modem (1-port) converter detected
Nov  5 04:48:24 geekbox kernel: [  990.690074]  [0:          khubd:   63] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB0
Nov  5 04:48:24 geekbox kernel: [  990.690660]  [0:          khubd:   63] option 1-1.4:1.1: GSM modem (1-port) converter detected
Nov  5 04:48:24 geekbox kernel: [  990.691309]  [0:          khubd:   63] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB1
Nov  5 04:48:24 geekbox kernel: [  990.691818]  [0:          khubd:   63] option 1-1.4:1.2: GSM modem (1-port) converter detected
Nov  5 04:48:24 geekbox kernel: [  990.692616]  [0:          khubd:   63] usb 1-1.4: GSM modem (1-port) converter now attached to ttyUSB2
Nov  5 04:48:24 geekbox kernel: [  990.772340]  [0:          khubd:   63] usb 1-1.4: MAC-Address: 00:1e:10:1f:00:00
Nov  5 04:48:24 geekbox kernel: [  990.773772]  [0:          khubd:   63] cdc_ncm 1-1.4:1.3 wwan0: register 'cdc_ncm' at usb-ff500000.usb-1.4, Mobile Broadband Network Device, 00:1e:10:1f:00:00

hyc
Posts: 7
Joined: 04 Nov 2016, 23:43

Re: Huawei E3372 and Geekbox

Post by hyc » 06 Nov 2016, 04:30

OK, I can confirm that the kernel is doing this modeswitch itself:

https://github.com/geekboxzone/lollipop ... eae7b7dac5

Code: Select all

+        unsigned  char  cmd[32] =  {0x55,  0x53, 0x42,  0x43,  0x00, 0x00,  0x00, 0x00,
+                                     0x00,  0x00, 0x00,  0x00,  0x00,  0x00,  0x00, 0x11,
+                                     0x06,  0x30, 0x00,  0x00,  0x01,  0x00,  0x01, 0x00,
+                                     0x00,  0x00, 0x00,  0x00,  0x00,  0x00, 0x00};
I wonder if there's a way to disable this so that it can be overridden in userland.

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

Re: Huawei E3372 and Geekbox

Post by LOM » 06 Nov 2016, 09:15

hyc wrote:OK, I can confirm that the kernel is doing this modeswitch itself:

https://github.com/geekboxzone/lollipop ... eae7b7dac5

Code: Select all

+        unsigned  char  cmd[32] =  {0x55,  0x53, 0x42,  0x43,  0x00, 0x00,  0x00, 0x00,
+                                     0x00,  0x00, 0x00,  0x00,  0x00,  0x00,  0x00, 0x11,
+                                     0x06,  0x30, 0x00,  0x00,  0x01,  0x00,  0x01, 0x00,
+                                     0x00,  0x00, 0x00,  0x00,  0x00,  0x00, 0x00};
I wonder if there's a way to disable this so that it can be overridden in userland.
Ugly idiotic short-sighted hack pretending to be a solution.
Mode switching in linux should be done in userland and not in the kernel.
The only thing you can do is edit the source and recompile the kernel.

hyc
Posts: 7
Joined: 04 Nov 2016, 23:43

Re: Huawei E3372 and Geekbox

Post by hyc » 06 Nov 2016, 15:58

I don't have the toolchain to recompile this kernel. But I was able to binary edit my kernel and change the USB vendor ID of this patch (to 0x02d1) to effectively disable it. Now usb_modeswitch does its thing and I get CDC ethernet and everything works.

Post Reply