This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Huawei modem is mode-switched by the usb-storage driver
#1
hallo all, 

i hawe huawei modem attached to tinkerboard with android 6, any version from 2017, i installed PPP3 widget for using internet over that modem, but problem, modem is not detected
i contacted author of ppp3 widget and he found solution

mr. author of android, can you change kernel using this solution?

thank you wery much

The Linux kernel for the Tinkerboard Android was patched so that every Huawei modem is mode-switched by the usb-storage driver.

https://github.com/TinkerBoard/android_ ... ual_devs.h
Code:
UNUSUAL_VENDOR_INTF(0x12d1, 0x08, 0x06, 0x50,
                 "HUAWEI MOBILE",
                 "Mass Storage",
                 USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_init,
                 0),


And here is the function:
Code:
 int usb_stor_huawei_init(struct us_data *us)
 {
    int idProduct;
    idProduct = us->pusb_dev->descriptor.idProduct;
    if (idProduct==0x1F01) {
        int result ;
        int act_len;
        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};
        result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, cmd, 31, &act_len);
        printk("usb_stor_bulk_transfer_buf performing result is %d, "
               "transfer the actual length=%d\n", result,act_len);
        return result;
    } else {
    ...


https://github.com/TinkerBoard/android_ ... ializers.c

This forces a certain mode that can't be overridden.
Reply
#2
+1 we need to enable huawei 3g/4g modem on tinker board for android
Reply
#3
(01-30-2018, 08:33 AM)youknowme09 Wrote: +1 we need to enable huawei 3g/4g modem on tinker board for android

thank wery much, when can by done updated image? Smile
Reply
#4
I assume that it can take weeks or even month until they will publish an update.
Maybe you guys can help yourself by switching the modem with usb_modeswitch. I compiled this tool for use on Android.

.zip   armeabi-v7a.zip (Size: 62.24 KB / Downloads: 14)
To install, you need to push it with adb to /system/bin/ and the usb library to /system/lib/
Then I adapted this cmd[32] to the needed string, you can try to switch the modem with this command:

Code:
/system/bin/usb_modeswitch -v 12d1 -p 1F01 -M '55534243000000000000000000000011063000000100010000000000000000'
I hope it works for you. I can't test it as I don't have the same modem.
Reply
#5
thx wery much, im going to try

and there is answer:

root@rk3288:/ # lsusb                                                          
Bus 001 Device 002: ID 0bda:481a
Bus 003 Device 002: ID 05e3:0610
Bus 001 Device 001: ID 1d6b:0002
Bus 002 Device 001: ID 1d6b:0002
Bus 003 Device 001: ID 1d6b:0002
Bus 003 Device 003: ID 12d1:1506
Bus 003 Device 004: ID 1241:1503
Bus 003 Device 005: ID 046d:c52f

cmd i was changed to right device identifier

root@rk3288:/ # /system/bin/usb_modeswitch -v 12d1 -p 1506 -M '5553424300000000000000000000001106*
Look for default devices ...
   product ID matched
 Found devices in default mode (1)
Access device 003 on bus 003
Get the current device configuration ...
Current configuration number is 1
Use interface number 0
 with class 255
Error: can't use storage command in MessageContent with interface 0; interface class is 255, expected 8. Abort

what do you think about it?
Reply
#6
That's because if you use the above command with your modem that it is already in ppp mode. Note that you show with lsiusb that it has pid 1506. I have a Huawei E398 that it is first in storage mode pid 1505, but directly from the kernel function usb_stor_huawei_init switched to ppp mode with pid 1506.
It makes no sense to switch it again. It would not be the right switching command. The above posted patch refers to a modem with pid 1f01. And that is eg. an E3372 in storage mode.
With your modem as pid 1506 you should have the three ttyUSB devices:
Code:
root@rk3288:/ # ls -l /dev/ttyUSB*
crw-rw---- radio    radio    188,   0 2013-01-21 09:54 ttyUSB0
crw-rw---- radio    radio    188,   1 2013-01-21 09:54 ttyUSB1
crw-rw---- radio    radio    188,   2 2013-01-21 09:54 ttyUSB2
That means that the modem is in ppp mode.
But I never saw this ppp widget working! I tried now, but it says that it needs to be installed via google play. I don't have google play on my tinker board. I tried it time ago on a Odroid C1, but never made it work.
That's one reason why I use an E3372 that I switch to Hilink mode. Together with a custom kernel where is unconfigured the cable network. This way the  usb_ether driver creates a eth0 interface with the Hilink modem and Android uses it as ethernet device. That's working well.
Reply
#7
ok, thanx,


can you please write mi help for how can i use it as eth0, please

finaly i need internet over e3372 any way

thx very much
Reply
#8
OK, you need to compile your own kernel and flash it to the sdcard as described here: https://tinkerboarding.co.uk/wiki/index.php?title=Software#How_to_build_Kernel_source_code
Once you managed this, you need to change the code and compile again.
But on the wiki is not explained that you need to install a toolchain first. I have used this once: https://releases.linaro.org/components/t...abi.tar.xz , and decompress it to your prefered folder.

And before the make command:
Code:
export ARCH=arm
export CROSS_COMPILE=/path/to/toolchain/gcc-linaro-4.9.4-2017.01-x86_64_arm-eabi/bin/arm-eabi-


To disable the cable network:

Code:
diff --git a/arch/arm/configs/rockchip_defconfig b/arch/arm/configs/rockchip_defconfig
index 809fea9..b481f2c 100755
--- a/arch/arm/configs/rockchip_defconfig
+++ b/arch/arm/configs/rockchip_defconfig
@@ -257,8 +257,8 @@ CONFIG_TUN=y
# CONFIG_NET_VENDOR_SMSC is not set
# CONFIG_NET_VENDOR_STMICRO is not set
# CONFIG_NET_VENDOR_WIZNET is not set
-CONFIG_RK_VMAC_ETH=y
-CONFIG_RK_GMAC_ETH=y
+###CONFIG_RK_VMAC_ETH is not set
+###CONFIG_RK_GMAC_ETH is not set


To change the E3372 to Hilink:
Code:
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
index a684f69..1a0241b 100644
--- a/drivers/usb/storage/initializers.c
+++ b/drivers/usb/storage/initializers.c
@@ -93,19 +93,6 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
}
 int usb_stor_huawei_init(struct us_data *us)
 {
-        int idProduct;
-        idProduct = us->pusb_dev->descriptor.idProduct;
-        if(idProduct==0x1F01){
-        int result ;
-        int act_len;
-        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};
-        result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, cmd, 31, &act_len);
-        printk("usb_stor_bulk_transfer_buf performing result is %d, transfer the actual length=%d\n", result,act_len);
-        return result;
-    } else {
        int result = 0;
        int act_len = 0;
        struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
@@ -122,7 +109,6 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
                                         US_BULK_CB_WRAP_LEN, &act_len);
         printk("transfer actual length=%d, result=%d\n", act_len, result);
         return result;
-     }
}
/* This places the HUAWEI E220 devices in multi-port mode */
int usb_stor_huawei_e220_init(struct us_data *us)
Reply
#9
thank you wery much, 
it works great, huawei  is up, i made changes as you wrote and something more, i found this patch from huawei tec. https://www.paoli.cz/out/media/Guide_to_...ndroid.pdf 

... but i have next problem, analog audio output is muted, music playing but no sound, i tried to change output in hdmi and sound settings but no change, do you know where can be problem? i have last TB android version , at the version before was not problem, at this version i dont see analog output


tnax

do not sovle, i turned off the automatic routing to usb in the developer settings /  media
Reply
#10
(02-04-2018, 12:09 PM)StanleyC Wrote: ..
... but i have next problem, analog audio output is muted, music playing but no sound, i tried to change output in hdmi and sound settings but no change, do you know where can be problem? i have last TB android version , at the version before was not problem, at this version i dont see analog output

...

I had the same problem in the latest build too. I found that it reverted back to HDMI all the time. Selecting "headset" multiple times eventually made it stick (even after a re-boot). Looks like its related to the changes made in the recent build to automatically detect a 3.5mm plug in event.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)