The C Source, Patches and (shudder!) Bugs
rsd.za
Posts: 2
Joined: 23 Aug 2013, 15:04

Re: Added new device Huawei K4305

Post by rsd.za » 23 Aug 2013, 21:31

Thanks. I have investigated the web interface and found a lot of API calls which are extremely useful, specifically:

Code: Select all

/api/monitoring/status
/api/net/current-plmn
/api/monitoring/traffic-statistics
The only data I can't find is what tower I am connected to, which would be extremely helpful for troubleshooting issues with customer support etc.

The modem is connected to a raspberry pi and I'm logging as much data as I can regarding signal strength, connection speeds and whatever else I can find.

Edit:

After some poking around I have solved my problem - the answer lies in: /api/net/location

mandusm
Posts: 4
Joined: 05 Dec 2013, 17:53

Re: Added new device Huawei K4305

Post by mandusm » 05 Dec 2013, 18:26

HI Guys.

I hope you can help me. I have extensively gone through forums, googled and cried to get this sorted. And I think my problem is because I am trying to get this to work on the Raspberry Pi, but hopefully I am wrong.

Problem: I cant get my Huawei K4305 modem to work on my Raspberry Pi, Raspbian (Debian) device.

I have gotten to the point where I have everything installed, and I configured my usb mode switch per your configuration in the forum, but I am not getting any changes when I am running mode switch and neither Sakis3g or Wvdail is picking up this modem. I have an older modem that I tested, and I got that working very nicely with both wvdial, and sakis3g.

Please see my output from everything below.

I have been running everything as root.

Lsusb Before
root@raspberrypi:/home/pi# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 060b:5252 Solid Year
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 12d1:1f15 Huawei Technologies Co., Ltd.
Bus 001 Device 005: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 008: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 010: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 006: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter

Code: Select all

root@raspberrypi:/home/pi# lsusb -v -d 12d1:1f15

Bus 001 Device 004: ID 12d1:1f15 Huawei Technologies Co., Ltd. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol       255 
  bMaxPacketSize0        64
  idVendor           0x12d1 Huawei Technologies Co., Ltd.
  idProduct          0x1f15 
  bcdDevice            1.02
  iManufacturer           5 Vodafone (Huawei)
  iProduct                4 K4305
  iSerial                 6 FFFFFFFFFFFFFFFF
  bNumConfigurations      2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          1 configuration 0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      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               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               0
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           87
    bNumInterfaces          2
    bConfigurationValue     2
    iConfiguration          3 configuration 1
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass      14 
      bFunctionProtocol       0 
      iFunction               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass     14 
      bInterfaceProtocol      0 
      iInterface              0 
      CDC Header:
        bcdCDC               1.10
      UNRECOGNIZED CDC:  0c 24 1b 00 01 00 04 10 0f dc 05 20
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      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
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      2 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      2 
      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     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval              32
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 ?
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
/etc/usb_modeswitch.conf
DisableSwitching=0
CheckMBIM=1
# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others
EnableLogging=1
DefaultVendor= 0x12d1
DefaultProduct= 0x1f15
TargetVendor= 0x12d1
TargetProduct= 0x1400
MessageContent="55534243123456780000000000000011062000000000000100000000000000"
root@raspberrypi:/home/pi# usb_modeswitch -c /etc/usb_modeswitch.conf

Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
found matching product ID
adding device
Found device in default mode, class or configuration (1)
Accessing device 004 on bus 001 ...
Getting the current device configuration ...
OK, got current device configuration (1)
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
No driver found. Either detached before or never attached

SCSI inquiry data (for identification)
-------------------------
Vendor String: Vodafone
Model String: Storage(Huawei)
Revision String: 2.31
-------------------------

USB description data (for identification)
-------------------------
Manufacturer: Vodafone (Huawei)
Product: K4305
Serial No.: FFFFFFFFFFFFFFFF
-------------------------
Setting up communication with interface 0
Using endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
OK, message successfully sent
Resetting response endpoint 0x81
Resetting message endpoint 0x01
-> Run lsusb to note any changes. Bye.
root@raspberrypi:/home/pi# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 060b:5252 Solid Year
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 12d1:1f15 Huawei Technologies Co., Ltd.
Bus 001 Device 005: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 008: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 010: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 006: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
root@raspberrypi:/home/pi#
As you can see there is no change, and there is also no log output in /var/log/usb_modeswitch xxx.log

Some Linux details
uname -a output
Linux raspberrypi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv6l GNU/Linux
root@raspberrypi:/home/pi# lscpu
Architecture: armv6l
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
root@raspberrypi:/home/pi# usb_modeswitch -e

* usb_modeswitch: handle USB devices with multiple modes
* Version 1.2.3 (C) Josua Dietze 2012
* Based on libusb0 (0.1.12 and above)

! PLEASE REPORT NEW CONFIGURATIONS !
root@raspberrypi:/home/pi# wvdial --version
WvDial 1.61
Copyright (c) 1997-2005 Net Integration Technologies, Inc.

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

Re: Added new device Huawei K4305

Post by LOM » 05 Dec 2013, 19:21

Remove the CheckMBIM line from your config file, it was a temporary variable for testing and is furthermore not supported in the old version 1.23 of usb_modeswitch that you are using.
Do also remove the DisableSwitching line, I don't know why you have it there since you want the device to switch , it will switch to 12d1:1400 and give you a cdc_ether interface.
(using this dongle in mbim mode requires usb_modeswitch 1.27 and a linux 3.8 or higher kernel version where the cdc_mbim driver is included)

Add the -I switch to your usb_modeswitch cmdline, does it make any difference in lsusb after switching?

mandusm
Posts: 4
Joined: 05 Dec 2013, 17:53

Re: Added new device Huawei K4305

Post by mandusm » 05 Dec 2013, 21:14

Dude! You are my hero!

I decided to start from scratch and I created a whole new install of Raspbian.

I then decided to rather compile my own version of usb_modeswitch, and I compiled the latest version
* usb_modeswitch: handle USB devices with multiple modes
* Version 2.0.1 (C) Josua Dietze 2013
* Based on libusb1/libusbx

! PLEASE REPORT NEW CONFIGURATIONS !
I also changed my configuration to add the changes you suggested, and now automatically when I add the device it switches it.
root@raspberrypi:/home/pi# lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 009: ID 060b:5252 Solid Year
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 013: ID 12d1:1400 Huawei Technologies Co., Ltd.
Bus 001 Device 005: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 006: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 007: ID 0781:5567 SanDisk Corp. Cruzer Blade
Bus 001 Device 008: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
It brings up the ethernet device just like you said.
eth1 Link encap:Ethernet HWaddr 58:2c:80:13:92:63
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3821 (3.7 KiB) TX bytes:0 (0.0 B)
I can also see, based on the light on the device, that it has established a connection.

I know that I now need to find the IP address of the device.

I tried assigning an ip address to the device, and then I can successfully ping it, but I am unable to access the web frontend on the device.

It also doesnt work when I make the device my default route .

The documentation says I need to open http://vodafonemobile.api in my browser, but obviously there is no software to set that resolv in my resolv.conf.

How do I determine the IP of the device so that I can access the device?

Thanks again!
You are awesome!

mandusm
Posts: 4
Joined: 05 Dec 2013, 17:53

Re: Added new device Huawei K4305

Post by mandusm » 05 Dec 2013, 21:36

Sorry for the double post.

Realising I am an idiot. Its an ethernet device, I ran dhclient eth1, and I got the IP.

Thanks for your support!!!

mandusm
Posts: 4
Joined: 05 Dec 2013, 17:53

Re: Added new device Huawei K4305

Post by mandusm » 15 Dec 2014, 15:58

Is there any reason why this would have stopped working on the latest Raspbian Build?
With the latest version of usb_mode_switch? usb-modeswitch-2.2.0

Instead of getting a eth1 device, I am now getting a wwan0 device? But it's not establishing a connection...

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

Re: Added new device Huawei K4305

Post by Josh » 17 Dec 2014, 20:13

I'm pretty sure that this is not usb_modeswitch's responsibility.

Naming interfaces is usually a matter of the kernel drivers or the udev daemon. Did you update anything else apart from usb_modeswitch ?

Post Reply