Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
bjoern.hoefer
Posts: 10
Joined: 02 Jan 2012, 23:47

D-Link DWL 156 A.3

Post by bjoern.hoefer » 03 Jan 2012, 00:03

Hi,

i've got a strange behavior with my D-Link DWL-156 Revision 3.

My setting:
Netgear WNDR3700v2
OpenWRT Backfire - 10.03.1-RC6, r28680

Packages installed:

Code: Select all

kmod-usb-acm - 2.6.32.27-1
kmod-usb-core - 2.6.32.27-1
kmod-usb-ohci - 2.6.32.27-1
kmod-usb-serial - 2.6.32.27-1
kmod-usb-serial-option - 2.6.32.27-1
kmod-usb-uhci - 2.6.32.27-1
kmod-usb2 - 2.6.32.27-1
usb-modeswitch - 1.1.8-1
usb-modeswitch-data - 20110705-1
usbutils - 003-1
ppp - 2.4.4-16.1
ppp-mod-pppoe - 2.4.4-16.1
chat - 2.4.4-16.1
comgt - 0.32-9

The output of my lsusb:

Code: Select all

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 002: ID 07d1:a804 D-Link System 

The config for the stick in /etc/usb-modeswitch.d/07d1:a804 looks like this (not changed):

Code: Select all

########################################################
# D-Link DWM-156 HSUPA 3.75G USB Modem

DefaultVendor= 0x07d1
DefaultProduct=0xa804

TargetVendor=  0x07d1
TargetProduct= 0x7e11

MessageContent="5553424312345678000000000000061b000000020000000000000000000000"

CheckSuccess=20


If i run the command logread after plugging in the usb-modem I'll get the following message:

Code: Select all

Jan  2 22:34:21 user.info kernel: usb 1-1: new high speed USB device using ar71xx-ehci and address 2
Jan  2 22:34:21 user.info kernel: usb 1-1: configuration #1 chosen from 1 choice
Jan  2 22:34:21 user.notice usb-modeswitch: 1-1:1.0: Manufacturer=D-Link,Incorporated
                Product=D-Link_WCDMA_Technologies_MSM Serial=MF112DDLKD010000
Jan  2 22:34:21 user.notice usb-modeswitch: 1-1:1.0: Selecting
                /etc/usb_modeswitch.d/07d1:a804 for mode switching
Jan  2 22:34:21 user.warn kernel: usb 1-1: usbfs: process 1507 (usb_modeswitch)
                did not claim interface 0 before use


My Problem is that I neither get any /dev/ttyUSB devices nor the output of lsusb -v -d 07d1:a804 looks so good...

Code: Select all

Bus 001 Device 002: ID 07d1:a804 D-Link System 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x07d1 D-Link System
  idProduct          0xa804 
  bcdDevice            0.00
  iManufacturer           3 D-Link,Incorporated
  iProduct                2 D-Link WCDMA Technologies MSM
  iSerial                 4 MF112DDLKD010000
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          1 D-Link Configuration
    bmAttributes         0xe0
      Self 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 (Zip)
      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
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
My lsmod looks like this:

Code: Select all

Module                  Size  Used by    Not tainted
option                 17712  0 
usbserial              24352  1 option
cdc_acm                12624  0 
uhci_hcd               17728  0 
ohci_hcd               16912  0 
nf_nat_tftp              432  0 
nf_conntrack_tftp       2400  1 nf_nat_tftp
nf_nat_irc               816  0 
nf_conntrack_irc        2512  1 nf_nat_irc
nf_nat_ftp              1328  0 
nf_conntrack_ftp        4640  1 nf_nat_ftp
ipt_MASQUERADE           992  1 
iptable_nat             2768  1 
nf_nat                 10912  5 nf_nat_tftp,nf_nat_irc,nf_nat_ftp,ipt_MASQUERADE,iptable_nat
xt_NOTRACK               544  0 
iptable_raw              656  1 
xt_state                 768  3 
nf_conntrack_ipv4       7920  6 iptable_nat,nf_nat
nf_defrag_ipv4           624  1 nf_conntrack_ipv4
nf_conntrack           38848 12 nf_nat_tftp,nf_conntrack_tftp,nf_nat_irc,nf_conntrack_irc,nf_nat_ftp,nf_conntrack_ftp,
  ipt_MASQUERADE,iptable_nat,nf_nat,xt_NOTRACK,xt_state,nf_conntrack_ipv4
ehci_hcd               31456  0 
pppoe                   8304  0 
pppox                   1216  1 pppoe
ipt_REJECT              1680  2 
xt_TCPMSS               2560  1 
ipt_LOG                 4176  0 
xt_comment               464  0 
xt_multiport            1792  0 
xt_mac                   576  0 
xt_limit                1008  1 
iptable_mangle           992  1 
iptable_filter           768  1 
ip_tables               8544  4 iptable_nat,iptable_raw,iptable_mangle,iptable_filter
xt_tcpudp               1760  4 
x_tables                9296 13 ipt_MASQUERADE,iptable_nat,xt_NOTRACK,xt_state,ipt_REJECT,xt_TCPMSS,ipt_LOG,xt_comment,
  xt_multiport,xt_mac,xt_limit,ip_tables,xt_tcpudp
sit                     7744  0 
tunnel4                 1616  1 sit
ppp_async               6400  0 
ppp_generic            18864  3 pppoe,pppox,ppp_async
slhc                    4160  1 ppp_generic
ath9k                  84592  0 
ath9k_common            1200  1 ath9k
ath9k_hw              305904  2 ath9k,ath9k_common
ath                    14160  3 ath9k,ath9k_common,ath9k_hw
mac80211              217040  1 ath9k
usbcore                97616  7 option,usbserial,cdc_acm,uhci_hcd,ohci_hcd,ehci_hcd
nls_base                4800  1 usbcore
crc_ccitt                976  1 ppp_async
cfg80211              134240  3 ath9k,ath,mac80211
compat                 16192  3 ath9k,mac80211,cfg80211
arc4                     816  4 
aes_generic            30256  2 
deflate                 1360  0 
ecb                     1328  0 
cbc                     2016  0 
ipv6                  228928 19 sit
leds_gpio               1456  0 
button_hotplug          2576  0 
gpio_buttons            2128  0 
input_polldev           1360  1 gpio_buttons
input_core             17056  4 button_hotplug,gpio_buttons,input_polldev

Can anybody help me get this running?

Thanks in advance for any help...

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

Post by Josh » 03 Jan 2012, 18:17

Can you run usb_modeswitch manually from a shell (as root)?

Code: Select all

usb_modeswitch -I -c /etc/usb_modeswitch.d/07d1:a804
The warning about "claim interface" may be harmless.


bjoern.hoefer
Posts: 10
Joined: 02 Jan 2012, 23:47

Post by bjoern.hoefer » 03 Jan 2012, 20:17

I've made a few steps in the right way - I think....

after changing the file /etc/modules.d/60-usb-serial to

Code: Select all

usbserial vendor=0x7d1 product=0x7e11
option
and installing kmod-usb-storage - 2.6.32.27-1
i'm getting rid of some "errors" in in logread/dmesg and get some ttyUSB devices

If I unplug the usb-modem and plug it in again, it doesn't seem to work so if i detach the modem I have to reboot the router (not a real problem...)

logread when i insert the usb-modem again:

Code: Select all

Jan  3 19:02:39 user.info kernel: usb 1-1: new high speed USB device using
                ar71xx-ehci and address 4
Jan  3 19:02:39 user.info kernel: usb 1-1: configuration #1 chosen from 1 choice
Jan  3 19:02:39 user.info kernel: scsi1 : SCSI emulation for USB Mass Storage devices
Jan  3 19:02:39 user.debug kernel: usb-storage: device found at 4
Jan  3 19:02:39 user.debug kernel: usb-storage: waiting for device to settle
                before scanning
Jan  3 19:02:40 user.notice usb-modeswitch: 1-1:1.0: Manufacturer=D-Link,Incorporated
                Product=D-Link_WCDMA_Technologies_MSM Serial=MF112DDLKD010000
Jan  3 19:02:40 user.notice usb-modeswitch: 1-1:1.0: Selecting
                /etc/usb_modeswitch.d/07d1:a804 for mode switching
Jan  3 19:02:40 user.warn kernel: usb 1-1: usbfs: process 1810 (usb_modeswitch)
                did not claim interface 0 before use
lsusb after replug
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 07d1:a804 D-Link System

usb_modeswitch -I -c /etc/usb_modeswitch.d/07d1\:a804 (after replug)

Code: Select all

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found devices 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 endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: D-Link,Incorporated
     Product: D-Link WCDMA Technologies MSM
  Serial No.: MF112DDLKD010000
-------------------------
Looking for active driver ...
 No driver found. Either detached before or never attached
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.
After a reboot I get the proper ttyUSB devices...
dmesg after reboot:

Code: Select all

ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ar71xx-ehci ar71xx-ehci: Atheros AR71xx built-in EHCI controller
ar71xx-ehci ar71xx-ehci: new USB bus registered, assigned bus number 1
ar71xx-ehci ar71xx-ehci: irq 3, io mem 0x1b000000
ar71xx-ehci ar71xx-ehci: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
nf_conntrack version 0.5.0 (967 buckets, 3868 max)
CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use
nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or
sysctl net.netfilter.nf_conntrack_acct=1 to enable it.
usb 1-1: new high speed USB device using ar71xx-ehci and address 2
usb 1-1: configuration #1 chosen from 1 choice
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
ar71xx-ohci ar71xx-ohci: Atheros AR71xx built-in OHCI controller
ar71xx-ohci ar71xx-ohci: new USB bus registered, assigned bus number 2
ar71xx-ohci ar71xx-ohci: irq 14, io mem 0x1c000000
usb usb2: configuration #1 chosen from 1 choice
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
uhci_hcd: USB Universal Host Controller Interface driver
usbcore: registered new interface driver cdc_acm
cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters
usbcore: registered new interface driver usbserial
USB Serial support registered for generic
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial Driver core
USB Serial support registered for GSM modem (1-port)
usbcore: registered new interface driver option
option: v0.7.2:USB Driver for GSM modems
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usb 1-1: usbfs: process 887 (usb_modeswitch) did not claim interface 0 before use
usb 1-1: USB disconnect, address 2
usb 1-1: new high speed USB device using ar71xx-ehci and address 3
usb 1-1: configuration #1 chosen from 1 choice
usbserial_generic 1-1:1.0: generic converter detected
usb 1-1: generic converter now attached to ttyUSB0
usbserial_generic 1-1:1.1: generic converter detected
usb 1-1: generic converter now attached to ttyUSB1
usbserial_generic 1-1:1.2: generic converter detected
usb 1-1: generic converter now attached to ttyUSB2
usbserial_generic 1-1:1.3: generic converter detected
usb 1-1: generic converter now attached to ttyUSB3

Now that the ttyUSB0(1,2,3) showing up in /dev - but it looks like gcom (comgt) can't query the interface (for tests), also pppd or chat cant communicate "proper" to the modem...

I've tried to query every ttyUSB - but none of them seem to work.
PIN was disabled with my mobile-phone and the connection was established succesful with windows a few moments ago (for testing) with a windows xp test-machine.

Additional Infos

My /etc/config/network

Code: Select all

config 'interface' 'wan3g'
        option 'ifname' 'ppp0'
        option 'apn' 'drei.at'
        option 'service' 'umts'
        option 'proto' '3g'
        option 'device' '/dev/ttyUSB2'
I've entered the /dev/ttyUSB2 caused by reading this (german) thread: http://forum.ubuntuusers.de/topic/umts- ... -maverick/ also i've tried the USB_ModeSwitch-Config mentioned in this thread... Changed nothing :-(

/etc/chatscripts/3g.chat

Code: Select all

ABORT   BUSY
ABORT   'NO CARRIER'
ABORT   ERROR
REPORT  CONNECT
TIMEOUT 12
""      "AT&F"
OK      "ATE1"
OK      'AT+CGDCONT=1,"IP","$USE_APN"'
SAY     "Calling UMTS/GPRS"
TIMEOUT 30
OK      "ATD*99#"
CONNECT '

Code: Select all

root@OpenWrt:~# gcom info -d /dev/ttyUSB0
##### Wireless WAN Modem Configuration #####
Product text:
====

====
Manufacturer:           IMEI and Serial Number: comgt 18:57:40 -> -- Error Report --
comgt 18:57:40 -> ---->                       ^
comgt 18:57:40 -> Error @776, line 45, String is shorter than second argument. (7)

root@OpenWrt:~# gcom info -d /dev/ttyUSB1
##### Wireless WAN Modem Configuration #####
Product text:
====

====
Manufacturer:           IMEI and Serial Number: comgt 18:57:52 -> -- Error Report --
comgt 18:57:52 -> ---->                       ^
comgt 18:57:52 -> Error @776, line 45, String is shorter than second argument. (7)

root@OpenWrt:~# gcom info -d /dev/ttyUSB2
##### Wireless WAN Modem Configuration #####
Product text:
====

====
Manufacturer:           IMEI and Serial Number: comgt 18:58:04 -> -- Error Report --
comgt 18:58:04 -> ---->                       ^
comgt 18:58:04 -> Error @776, line 45, String is shorter than second argument. (7)

root@OpenWrt:~# gcom info -d /dev/ttyUSB3
##### Wireless WAN Modem Configuration #####
Product text:
====

====
Manufacturer:           IMEI and Serial Number: comgt 18:58:16 -> -- Error Report --
comgt 18:58:16 -> ---->                       ^
comgt 18:58:16 -> Error @776, line 45, String is shorter than second argument. (7)
lsusb -vd 07d1:7e11

Code: Select all

Bus 001 Device 003: ID 07d1:7e11 D-Link System 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x07d1 D-Link System
  idProduct          0x7e11 
  bcdDevice            0.00
  iManufacturer           3 D-Link,Incorporated
  iProduct                2 D-Link WCDMA Technologies MSM
  iSerial                 4 MF112DDLKD010000
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          108
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          1 D-Link Configuration
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    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
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              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               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               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           3
      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            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               5
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 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     0x04  EP 4 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            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
proper

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

Post by Josh » 04 Jan 2012, 00:36

There are several fishy things going on when I look at your data.

The device, after mode switching, has three vendor-specific (class 255) and one storage (class 8) interface.
But "usbserial" is bound to all of them, including the storage. Your "ttyUSB2" is really a confused pseudo CDROM ...
This can't be good, particularly when you try to treat it like a modem. (BTW, if talking to a interface failed, it is advised to always re-plug because the attempt may have hanged the device.)

Annother thing is that the "option" driver is available and active on your system as seen in the "lsmod" output. This driver is tailored for 3G devices and can accept new device IDs even after load time.

To solve your problems, remove the parameters for "usb-serial" that you added to "60-usb-serial". Make sure that usbstorage is available (for some devices storage initialization is essential to make the subsequent mode switch work).
Then re-plug, wait a moment until "dmesg" shows that the storage device was discovered by its driver, and start the switching process. Again, wait a moment and confirm that the storage driver has found the new storage interface.

Now issue this command:

Code: Select all

# echo "07d1 7e11" > /sys/bus/usb-serial/drivers/option1/new_id
Afterwards, "dmesg" should tell you about three serial devices provided by the "option" driver.

Finally, you should have a working ttyUSB2 which is in fact the right port for connection, but now it's actually the fourth interface.

You should be able to put all this in scripts and make it work automatically from the hotplug system. Just insert a "sleep" here and there to give the system time for adjustments.

In the original source of usb_modeswitch (designed for "full" systems), all this is automated. There were obviously space restrictions to consider for the router package version.


bjoern.hoefer
Posts: 10
Joined: 02 Jan 2012, 23:47

Post by bjoern.hoefer » 04 Jan 2012, 23:20

works like a charm...
Speed-Result: http://www.speedtest.net/result/1686774618.png - quiet OK

i've currently writing this post "via" openwrt connecting through the D-Link USB Modem.

Thank you a lot.

Next approach: creating a script that automates all the steps - which i will post here, so that the solution for this stick is complete...
After this milestone comes the bigger challenge - called ZTE MF652 (I think with a branded firmware from my provider - Hutchinson (aka drei.at)... The DWL-156 will be my 'backup-solution' because the stick don't have a antenna-jack...

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

Post by Josh » 05 Jan 2012, 01:07

The ZTE MF652 seems to pop up in several variants and USB IDs. There is one that is not yet confirmed working (never got a reply for my suggestion in this thread). But I'm confident we will get it to switch eventually.

Apart from that, "option" can take more than one new USB ID, so - once mode switching works - just use two of the "echo" commands, one for each modem, and the driver will know both of them.

Also, the connection port on ZTE devices is usually ttyUSB2, just like with your D-Link.


bjoern.hoefer
Posts: 10
Joined: 02 Jan 2012, 23:47

Post by bjoern.hoefer » 05 Jan 2012, 10:41

Saw this thread a few days ago.

Tried a few minute to apply the config mentioned in the thread.

Does'nt work for my stick - also i've got different USB-IDs...

Bus 001 Device 006: ID 19d2:1520 ONDA Communication S.p.A.

If alle the ZTE Messages won't work, I'll make a USB-Dump and post the link to it here - but further discussion in the thread...

bjoern.hoefer
Posts: 10
Joined: 02 Jan 2012, 23:47

Post by bjoern.hoefer » 06 Jan 2012, 00:05

Found a pretty simple (but I think also dirty) solution/workaround without creating a script for all the steps...

i Just added on line to the /etc/hotplug.d/usb/20-modeswitch config file:

The original file looks like:

Code: Select all

#!/bin/sh

local uVid uPid uMa uPr uSe
local sVe sMo sRe

local modeswitch="/usr/bin/usb_modeswitch"


log() {
        logger -t "usb-modeswitch" "$@"
}

sanitize() {
        sed -e 's/[[:space:]]\+$//; s/[[:space:]]\+/_/g' "$@"
}

..... and so on...

i just added sleep 3 after the logger event - and everything works just like it should...

Code: Select all

#!/bin/sh

local uVid uPid uMa uPr uSe
local sVe sMo sRe

local modeswitch="/usr/bin/usb_modeswitch"


log() {
        logger -t "usb-modeswitch" "$@"
}

sleep 3

sanitize() {
        sed -e 's/[[:space:]]\+$//; s/[[:space:]]\+/_/g' "$@"
}
and on the end of the file (after the last fi) i added:

Code: Select all

echo "07d1 7e11" > /sys/bus/usb-serial/drivers/option1/new_id
Quick and dirty - i know... but it works ;-)



Works after a reboot - so it looks good for me...

To make a "Proof of concept" i will reinstall my router this weekend and report...

bjoern.hoefer
Posts: 10
Joined: 02 Jan 2012, 23:47

Post by bjoern.hoefer » 06 Jan 2012, 19:26

Concept proofed!

Workflow with newled installed firmware (according to the manual: http://wiki.openwrt.org/doc/recipes/3gdongle)

opkg update
opkg install kmod-usb2 kmod-usb-serial-option usb-modeswitch usb-modeswitch-data kmod-usb-storage usbutils luci-proto-3g
edit /etc/config/network for your needs
edit the /etc/hotplug.d/usb/20-modeswitch and add sleep 4 like i mentioned above.

Enjoy!


PS: Strange behavoir if i unplug and replug the stick i'll getting a:
OpenWrt user.warn kernel: usb 1-1: usbfs: process 2780 (usb_modeswitch) did not claim interface 0 before use

strange...

luzemario
Posts: 4
Joined: 29 May 2012, 21:48

Post by luzemario » 29 May 2012, 22:16

Josh wrote:There are several fishy things going on when I look at your data.

The device, after mode switching, has three vendor-specific (class 255) and one storage (class 8) interface.
But "usbserial" is bound to all of them, including the storage. Your "ttyUSB2" is really a confused pseudo CDROM ...
This can't be good, particularly when you try to treat it like a modem. (BTW, if talking to a interface failed, it is advised to always re-plug because the attempt may have hanged the device.)
Hi Josh. After a bit of research, I found Mageia 2 to recognize the device via usb_modeswitch 1.2.1. Three ttyUSB devices are created as expected, and strangely I can talk to modem via ttyUSB1 and ttyUSB2 devices at same time (unsolicited network status reports are dumped to ttyUSB1 only).

When I issue a 'ATD*99#' command on either serial port, device answers with a 'CONNECT 7200000' then gives no answer anymore on this port (no PPP traffic nor AT console). I can use another instance of minicom to talk to modem by the other port. Issuing 'atd*99#' after this gives a 'ERROR' response. Maybe device is already connected by another serial port?

Appears to be module option is hanging when CD signal goes up, or online data is being redirected to another endpoint. Can you give me some steps to debug?

My device is the DWL-156 3.01LA, same USB device ID.

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

Post by Josh » 31 May 2012, 09:14

Does your device really have the same interface setup as the other one from the post above? (Try "lsusb -v" ...)

If so, it looks like the very last ttyUSB is the one for connection. If all goes well it should be ttyUSB2 (out of three).


luzemario
Posts: 4
Joined: 29 May 2012, 21:48

Post by luzemario » 31 May 2012, 23:10

Josh wrote:Does your device really have the same interface setup as the other one from the post above?
I will start another thread so we can investigate it. This tread is not directly related and is going too long.. :)

Post Reply