Activation Codes and Methods, Hardware Details, Sniffing
lhguanabara
Posts: 8
Joined: 19 Jan 2015, 18:27
Location: Brazil

Re: Modem D-Link DWM-221

Post by lhguanabara » 23 Jan 2015, 14:13

Hi LOM, thnx for the reply!

There is the output of sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -K -W

Code: Select all

noortek@netxms:~$ sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -K -W
Take all parameters from the command line


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

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x2001
DefaultProduct= 0xa401
TargetVendor=   0x2001
TargetProduct=  0x7e19

StandardEject=1
NeedResponse=0

Look for target devices ...
  found USB ID 2001:a401
   vendor ID matched
  found USB ID 04b4:6560
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
 No devices in target mode or class found
Look for default devices ...
  found USB ID 2001:a401
   vendor ID matched
   product ID matched
  found USB ID 04b4:6560
  found USB ID 1d6b:0002
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
  found USB ID 1d6b:0001
 Found devices in default mode (1)
Access device 003 on bus 001
Current configuration number is 1
Use interface number 0
Use endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: Mobile Connect
     Product: Mobile Connect
  Serial No.: 0123456789ABCDEF
-------------------------
Sending standard EJECT sequence
Looking for active driver ...
 No active driver found. Detached before or never attached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 1 (CSW) ...
 Response successfully read (13 bytes).
Trying to send message 2 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 2 (CSW) ...
 Response successfully read (13 bytes).
Reset response endpoint 0x81
Reset message endpoint 0x01
-> Run lsusb to note any changes. Bye!

noortek@netxms:~$ lsusb
Bus 001 Device 003: ID 2001:a401 D-Link Corp.
Bus 001 Device 002: ID 04b4:6560 Cypress Semiconductor Corp. CY7C65640 USB-2.0 "TetraHub"
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
The command didn't make any changes. =(

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

Re: Modem D-Link DWM-221

Post by Josh » 23 Jan 2015, 15:44

Look at this line in your log:

"No active driver found. Detached before or never attached"

In some cases the EJECT sequence works more reliably if the stick was bound to the storage driver initially. If you run usb_modeswitch manually for testing, always re-insert the stick for each attempt.

Also, make sure the "usb-storage" driver is not blacklisted.

Both measures are essential to guarantee that the stick is always in the defined initial state.

lhguanabara
Posts: 8
Joined: 19 Jan 2015, 18:27
Location: Brazil

Re: Modem D-Link DWM-221

Post by lhguanabara » 23 Jan 2015, 16:06

thx! I'll test again

lhguanabara
Posts: 8
Joined: 19 Jan 2015, 18:27
Location: Brazil

Re: Modem D-Link DWM-221

Post by lhguanabara » 23 Jan 2015, 16:16

Output of the command after unplug e plug the modem again:

Code: Select all

Sending standard EJECT sequence
Looking for active driver ...
 OK, driver detached
Set up interface 0
Use endpoint 0x01 for message sending ...
Trying to send message 1 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 1 (CSW) ...
 Response successfully read (13 bytes).
Trying to send message 2 to endpoint 0x01 ...
 OK, message successfully sent
Read the response to message 2 (CSW) ...
 Response successfully read (13 bytes).
Reset response endpoint 0x81
Reset message endpoint 0x01
-> Run lsusb to note any changes. Bye!

noortek@netxms:~$ lsusb
Bus 001 Device 004: ID 2001:a401 D-Link Corp.
Same status.

The driver is not blacklisted:

Code: Select all

noortek@netxms:~$ cat /etc/modprobe.d/blacklist.conf
# This file lists those modules which we don't want to be loaded by
# alias expansion, usually so some other driver will be loaded for the
# device instead.

# evbug is a debug tool that should be loaded explicitly
blacklist evbug

# these drivers are very simple, the HID drivers are usually preferred
blacklist usbmouse
blacklist usbkbd

# replaced by e100
blacklist eepro100

# replaced by tulip
blacklist de4x5

# causes no end of confusion by creating unexpected network interfaces
blacklist eth1394

# snd_intel8x0m can interfere with snd_intel8x0, doesn't seem to support much
# hardware on its own (Ubuntu bug #2011, #6810)
blacklist snd_intel8x0m

# Conflicts with dvb driver (which is better for handling this device)
blacklist snd_aw2

# causes failure to suspend on HP compaq nc6000 (Ubuntu: #10306)
blacklist i2c_i801

# replaced by p54pci
blacklist prism54

# replaced by b43 and ssb.
blacklist bcm43xx

# most apps now use garmin usb driver directly (Ubuntu: #114565)
blacklist garmin_gps

# replaced by asus-laptop (Ubuntu: #184721)
blacklist asus_acpi

# low-quality, just noise when being used for sound playback, causes
# hangs at desktop session start (Ubuntu: #246969)
blacklist snd_pcsp

# ugly and loud noise, getting on everyone's nerves; this should be done by a
# nice pulseaudio bing (Ubuntu: #77010)
blacklist pcspkr

# EDAC driver for amd76x clashes with the agp driver preventing the aperture
# from being initialised (Ubuntu: #297750). Blacklist so that the driver
# continues to build and is installable for the few cases where its
# really needed.
blacklist amd76x_edac

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

Re: Modem D-Link DWM-221

Post by LOM » 27 Jan 2015, 19:00

I assume that you tried that switch cmd on a desktop linux computer and not on your router, right?
The hardware is made by Mediatek so please do also try to switch it using a previously known Mediatek switch message:

sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -W -M 555342431234567800000000000006f0010300000000000000000000000000

chyiwen
Posts: 16
Joined: 27 Mar 2015, 04:55
Location: Taiwan

Re: Modem D-Link DWM-221

Post by chyiwen » 27 Mar 2015, 05:01

I have this requirement for my raspberry PI 2.

After lots of effort , I can not make it work with USB modemswitch.

Linux eject can works. I attached the USB snoop log . Hope there is somebody can understand it.

I took all the USB message from USB snoop log and put it into usbmode switch.

ex.
sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -W -m 1 -M 5553424368e6c6811200000080010c03000000120000000000000000000000



-- proof with eject.
# brief
1. pid changes after using eject CDROM command.

root@raspberrypi:/home/pi# lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 010: ID 2001:a401 D-Link Corp.

root@raspberrypi:/home/pi# eject /dev/sr0

root@raspberrypi:/home/pi# lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 011: ID 2001:7e19 D-Link Corp.


2. modem device is ttyUSB1

root@raspberrypi:/home/pi# cat /etc/wvdial.conf
[Dialer 4G]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","internet"
Stupid Mode = 1
Modem Type = Analog Modem
ISDN = 0
Phone = *99#
Modem = /dev/ttyUSB1
Username = { }
Password = { }
Baud = 460800
Attachments
DWM-221_UsbSnoop.log
USB Snoop log
(246.66 KiB) Downloaded 712 times

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

Re: Modem D-Link DWM-221

Post by LOM » 27 Mar 2015, 07:49

chyiwen wrote: Linux eject can works. I attached the USB snoop log . Hope there is somebody can understand it.

I took all the USB message from USB snoop log and put it into usbmode switch.

ex.
sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -W -m 1 -M 5553424368e6c6811200000080010c03000000120000000000000000000000
Your snoop log contains the scsi eject msg near the end of the capture so this cmd should work:
sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -W -M 5553424312345678000000000000061b000000020000000000000000000000

If you are using an usb_modeswitch version lower than 2.10 then do also add the -I switch to the cmd line above.

chyiwen
Posts: 16
Joined: 27 Mar 2015, 04:55
Location: Taiwan

Re: Modem D-Link DWM-221

Post by chyiwen » 27 Mar 2015, 18:29

I tried 5553424312345678000000000000061b000000020000000000000000000000.
But it does not work.

Anything more I should try ?

I tried asign -m 1 to send it to 0x01 or 0x81. But it no success.

I am wondering it needs interactive msg to the Dongle

Thanks

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

Re: Modem D-Link DWM-221

Post by LOM » 27 Mar 2015, 19:15

Which usb_modeswitch revision are you using?

What does your dmesg log tell about the DWM-221 on the usb bus?
Did the usb_storage driver bind to 2001:a401 before you tried to switch it?

Does it make any difference if you do the modeswitch cmd 2-3 times in a row?

chyiwen
Posts: 16
Joined: 27 Mar 2015, 04:55
Location: Taiwan

Re: Modem D-Link DWM-221

Post by chyiwen » 30 Mar 2015, 04:13

Hi Lom ,

Thansk a lot for your reply. That's very kind to me.

I am using 2.2.0 , it should be the lastest one.

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

! PLEASE REPORT NEW CONFIGURATIONS !

1# dmesg attached.
2# I tried 2 - 3 times, it does not work.

3#Did the usb_storage driver bind to 2001:a401 before you tried to switch it?
I am not sure how to do / check it.

Thanks any way. I believe this device is very challenge.
Attachments
dmesg.txt
(2.59 KiB) Downloaded 623 times
usb_modeswitch.txt
(8.87 KiB) Downloaded 633 times

chyiwen
Posts: 16
Joined: 27 Mar 2015, 04:55
Location: Taiwan

Re: Modem D-Link DWM-221

Post by chyiwen » 30 Mar 2015, 04:27

I found something interesting.


#1 When plug-in the DWM-221, dmesg showed /dev/sr0



#2: after CLI
sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -W -M 5553424312345678000000000000061b000000020000000000000000000000

/dev/sr0 gone.

dmesg :

[ 482.193675] sd 3:0:0:0: [sda] Synchronizing SCSI cache
[ 482.197876] sd 3:0:0:0: [sda]
[ 482.197907] Result: hostbyte=0x00 driverbyte=0x08
[ 482.197924] sd 3:0:0:0: [sda]
[ 482.197936] Sense Key : 0x5 [current]
[ 482.197960] sd 3:0:0:0: [sda]
[ 482.197972] ASC=0x20 ASCQ=0x0


But the dev vid & pid does not change.

So it does something after usb_modeswitch sends something.

Thanks
Attachments
1_dmesg.txt
(2.14 KiB) Downloaded 600 times

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

Re: Modem D-Link DWM-221

Post by LOM » 30 Mar 2015, 06:13

chyiwen wrote:I found something interesting.


#1 When plug-in the DWM-221, dmesg showed /dev/sr0

#2: after CLI
sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -W -M 5553424312345678000000000000061b000000020000000000000000000000

/dev/sr0 gone.


But the dev vid & pid does not change.

So it does something after usb_modeswitch sends something.
To start with, I am sure the switch message is the correct one.
It is a very common message for switching (ejecting the virtual cd-rom) usb 3G modems and is the same message as being used by D-Link for other dongles in the same series as DWM-221.

Raspberry pi has had problems with composite devices and with devices switching id since long time back. The usb controller reporting that the old id is present on the bus even after it has disappeared and the dongle has returned with a new id is just one of many raspberry pi usb problems.

Please test first on a standard linux desktop system to verify that the dongle can switch there.

You can, since you use usb_modeswitch 2.20, simplify the cmd line to:
sudo usb_modeswitch -v 2001 -p a401 -V 2001 -P 7e19 -K -W

chyiwen
Posts: 16
Joined: 27 Mar 2015, 04:55
Location: Taiwan

Re: Modem D-Link DWM-221

Post by chyiwen » 30 Mar 2015, 06:58

Hi LOM ,

Thanks a lot for your reply. It's amazing we are in the same timezone. :)

Rasperberry pi can exec eject command to switch the usb dongle.

The eject command is from "sudo apt-get install eject".

What's the different between the Linux-eject & usb-modeswitch -K ?


Here is the Linux-Eject result.

#####First , I plugin'd the doungle , dmesg :

pi@raspberrypi ~ $ sudo dmesg -c
[ 9429.248334] usb 1-1.3.2: new high-speed USB device number 24 using dwc_otg
[ 9429.349712] usb 1-1.3.2: New USB device found, idVendor=2001, idProduct=a401
[ 9429.349746] usb 1-1.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9429.349764] usb 1-1.3.2: Product: Mobile Connect
[ 9429.349781] usb 1-1.3.2: Manufacturer: Mobile Connect
[ 9429.349798] usb 1-1.3.2: SerialNumber: 0123456789ABCDEF
[ 9429.352261] usb-storage 1-1.3.2:1.0: USB Mass Storage device detected
[ 9429.352832] scsi host16: usb-storage 1-1.3.2:1.0
[ 9430.349078] scsi 16:0:0:0: Direct-Access SD Storage 0000 PQ: 0 ANSI: 2
[ 9430.350567] sd 16:0:0:0: Attached scsi generic sg0 type 0
[ 9430.352301] scsi 16:0:0:1: CD-ROM Mass Storage 0000 PQ: 0 ANSI: 2
[ 9430.352792] sd 16:0:0:0: [sda] Unit Not Ready
[ 9430.352817] sd 16:0:0:0: [sda]
[ 9430.352831] Sense Key : 0x5 [current]
[ 9430.352858] sd 16:0:0:0: [sda]
[ 9430.352869] ASC=0x20 ASCQ=0x0
[ 9430.357048] sd 16:0:0:0: [sda] READ CAPACITY failed
[ 9430.357086] sd 16:0:0:0: [sda]
[ 9430.357101] Result: hostbyte=0x00 driverbyte=0x08
[ 9430.357117] sd 16:0:0:0: [sda]
[ 9430.357129] Sense Key : 0x5 [current]
[ 9430.357158] sd 16:0:0:0: [sda]
[ 9430.357169] ASC=0x20 ASCQ=0x0
[ 9430.358640] sd 16:0:0:0: [sda] Write Protect is off
[ 9430.358706] sd 16:0:0:0: [sda] Mode Sense: 0f 00 00 00
[ 9430.359526] sd 16:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 9430.365002] sr 16:0:0:1: [sr0] scsi-1 drive
[ 9430.366633] sr 16:0:0:1: Attached scsi CD-ROM sr0
[ 9430.367402] sd 16:0:0:0: [sda] Unit Not Ready
[ 9430.367413] sd 16:0:0:0: [sda]
[ 9430.367428] Sense Key : 0x5 [current]
[ 9430.367436] sd 16:0:0:0: [sda]
[ 9430.367444] ASC=0x20 ASCQ=0x0
[ 9430.367490] sr 16:0:0:1: Attached scsi generic sg1 type 5
[ 9430.375969] sd 16:0:0:0: [sda] READ CAPACITY failed
[ 9430.375982] sd 16:0:0:0: [sda]
[ 9430.375993] Result: hostbyte=0x00 driverbyte=0x08
[ 9430.376004] sd 16:0:0:0: [sda]
[ 9430.376016] Sense Key : 0x5 [current]
[ 9430.376024] sd 16:0:0:0: [sda]
[ 9430.376031] ASC=0x20 ASCQ=0x0
[ 9430.377214] sd 16:0:0:0: [sda] Attached SCSI removable disk
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $
pi@raspberrypi ~ $


#####Second, I exec eject /dev/sr0 , dmesg :


pi@raspberrypi ~ $ eject /dev/sr0
pi@raspberrypi ~ $ sudo dmesg
[ 9488.925158] usb 1-1.3.2: USB disconnect, device number 24
[ 9488.927593] sd 16:0:0:0: [sda] Synchronizing SCSI cache
[ 9488.927917] sd 16:0:0:0: [sda]
[ 9488.927938] Result: hostbyte=0x01 driverbyte=0x00
[ 9489.258476] usb 1-1.3.2: new high-speed USB device number 25 using dwc_otg
[ 9489.362271] usb 1-1.3.2: New USB device found, idVendor=2001, idProduct=7e19
[ 9489.362296] usb 1-1.3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 9489.362313] usb 1-1.3.2: Product: Mobile Connect
[ 9489.362330] usb 1-1.3.2: Manufacturer: Mobile Connect
[ 9489.362347] usb 1-1.3.2: SerialNumber: 0123456789ABCDEF
[ 9489.369692] usb-storage 1-1.3.2:1.5: USB Mass Storage device detected
[ 9489.370338] scsi host17: usb-storage 1-1.3.2:1.5
[ 9490.369546] scsi 17:0:0:0: Direct-Access SD Storage 0000 PQ: 0 ANSI: 2
[ 9490.371244] sd 17:0:0:0: Attached scsi generic sg0 type 0
[ 9490.373994] sd 17:0:0:0: [sda] Unit Not Ready
[ 9490.374039] sd 17:0:0:0: [sda]
[ 9490.374062] Sense Key : 0x5 [current]
[ 9490.374094] sd 17:0:0:0: [sda]
[ 9490.374122] ASC=0x20 ASCQ=0x0
[ 9490.377046] sd 17:0:0:0: [sda] READ CAPACITY failed
[ 9490.377073] sd 17:0:0:0: [sda]
[ 9490.377087] Result: hostbyte=0x00 driverbyte=0x08
[ 9490.377102] sd 17:0:0:0: [sda]
[ 9490.377112] Sense Key : 0x5 [current]
[ 9490.377135] sd 17:0:0:0: [sda]
[ 9490.377146] ASC=0x20 ASCQ=0x0
[ 9490.377672] sd 17:0:0:0: [sda] Write Protect is off
[ 9490.377697] sd 17:0:0:0: [sda] Mode Sense: 0f 00 00 00
[ 9490.378369] sd 17:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 9490.382858] sd 17:0:0:0: [sda] Unit Not Ready
[ 9490.382869] sd 17:0:0:0: [sda]
[ 9490.382896] Sense Key : 0x5 [current]
[ 9490.382918] sd 17:0:0:0: [sda]
[ 9490.382935] ASC=0x20 ASCQ=0x0
[ 9490.385977] sd 17:0:0:0: [sda] READ CAPACITY failed
[ 9490.385987] sd 17:0:0:0: [sda]
[ 9490.385997] Result: hostbyte=0x00 driverbyte=0x08
[ 9490.386007] sd 17:0:0:0: [sda]
[ 9490.386075] Sense Key : 0x5 [current]
[ 9490.386083] sd 17:0:0:0: [sda]
[ 9490.386091] ASC=0x20 ASCQ=0x0
[ 9490.387182] sd 17:0:0:0: [sda] Attached SCSI removable disk




### BTW , here is the usb-modeswitch -K result , it does not work.

[ 9705.624994] sd 18:0:0:0: [sda] Attached SCSI removable disk
[ 9714.211395] sd 18:0:0:0: [sda] Synchronizing SCSI cache
[ 9714.214771] sd 18:0:0:0: [sda]
[ 9714.214803] Result: hostbyte=0x00 driverbyte=0x08
[ 9714.214821] sd 18:0:0:0: [sda]
[ 9714.214832] Sense Key : 0x5 [current]
[ 9714.214857] sd 18:0:0:0: [sda]
[ 9714.214869] ASC=0x20 ASCQ=0x0


### I think it is the sames as usb_modeswitch -M 5553424368e6c6811200000080010c03000000120000000000000000000000


Thanks a lot for your great help !!!

chyiwen
Posts: 16
Joined: 27 Mar 2015, 04:55
Location: Taiwan

Re: Modem D-Link DWM-221

Post by chyiwen » 30 Mar 2015, 16:01

Hi ,

I found this doc shows linux usb sniffer.

http://elinux.org/images/1/17/USB_Debug ... niques.pdf

I attached the pcap result , FYI.

Compare the usb sniffer result from Linux-Eject & usb_modeswitcher.

Linux eject sent the message to Endpoint 0x6 , Receive 0x8a.

I tried to do usb_modeswitcher -m 6 -M balabla , but it shows error message.

Trying to send message 1 to endpoint 0x06 ...
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000000] [000028f9] libusbx: error [submit_bulk_transfer] submiturb failed error -1 errno=2
Sending the message returned error -1. Try to continue


Does it means Raspberry PI's libusbx can not support to send the msg to endpoint 0x06 ?

I have another Linux PC , however , I have no idea to compile usb-modeswitcher. >.<


######full result #######

pi@raspberrypi ~ $ sudo usb_modeswitch -W -n -v 2001 -p a401 -V 2001 -P 7e19 -m 6 -r 8a -M 555342432b000000000000000000061e000000000000000000000000000000
Take all parameters from the 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= 0x2001
DefaultProduct= 0xa401
TargetVendor= 0x2001
TargetProduct= 0x7e19
MessageEndpoint=0x06
MessageContent="555342432b000000000000000000061e000000000000000000000000000000"
NeedResponse=1
ResponseEndpoint=0x8a

Look for target devices ...
found USB ID 0424:9514
found USB ID 1d6b:0002
found USB ID 0424:ec00
found USB ID 05e3:0608
found USB ID 046d:cab1
found USB ID 05e3:0608
found USB ID 2001:a401
vendor ID matched
found USB ID 04f3:0210
No devices in target mode or class found
Look for default devices ...
found USB ID 0424:9514
found USB ID 1d6b:0002
found USB ID 0424:ec00
found USB ID 05e3:0608
found USB ID 046d:cab1
found USB ID 05e3:0608
found USB ID 2001:a401
vendor ID matched
product ID matched
found USB ID 04f3:0210
Found devices in default mode (1)
Access device 036 on bus 001
Current configuration number is 1
Use interface number 0
Use endpoints 0x06 (out) and 0x8a (in)
Ambiguous Class/InterfaceClass: 0xef/0x08

USB description data (for identification)
-------------------------
Manufacturer: Mobile Connect
Product: Mobile Connect
Serial No.: 0123456789ABCDEF
-------------------------
Looking for active driver ...
No active driver found. Detached before or never attached
Set up interface 0
Use endpoint 0x06 for message sending ...
Trying to send message 1 to endpoint 0x06 ...
[timestamp] [threadID] facility level [function call] <message>
--------------------------------------------------------------------------------
[ 0.000000] [000028f9] libusbx: error [submit_bulk_transfer] submiturb failed error -1 errno=2
Sending the message returned error -1. Try to continue
Read the response to message 1 (CSW) ...
[ 0.000443] [000028f9] libusbx: error [submit_bulk_transfer] submiturb failed error -1 errno=2
Response reading failed (error -1)
Device is gone, skip any further commands
-> Run lsusb to note any changes. Bye!
Attachments
Archive.7z
filter_usb_modeswitch.pcap -- usb_modeswither result
linux_eject.pcap -- Linux-eject result
(1.25 KiB) Downloaded 594 times

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

Re: Modem D-Link DWM-221

Post by LOM » 30 Mar 2015, 17:24

chyiwen wrote:
Linux eject sent the message to Endpoint 0x6 , Receive 0x8a.
Those endpoints are only present in 2001:7e19 which is the id we get after a succesful switch, 2001:a401 has endpoint pairs 0x01/0x81.
So the dongle was already switched in Linux when you logged the eject of /dev/sr0.


Install the full lsusb program so that you can get verbose information about the interfaces on the DWM-221, ie lsusb -v -d 2001:a401 or lsusb -v -d 2001:7e19.
Start with getting the verbose info for 2001:a401 and check interface and endpoint numbers so that you know how it looks, then switch it with usb_modeswitch and do a new verbose lsusb check afterwards.
I wouldn't be surprised if the dongle still has the usb id 2001:a401 but has changed interface layout to the interfaces that 2001:7e19 has, this is something I have seen happen before on raspberry pi.


Make sure you use the right switch msg in usb_modeswitch, your last try is completely wrong.

The standard eject method used by usb_modeswitch contains 2 commands, the scsi 0x1e cmd (06 1e 00 00 ....) which translates to "allow media removal" and the scsi 0x1b cmd (06 1b 00 00 00 02 00 ...) which is the actual "eject media" cmd.
You can use the 0x1b cmd alone but many dongles switches easier if it gets the 0x1e cmd first, you can not use the 0x1e cmd alone since it is not a switch/eject cmd.

These 2 cmds are built into usb_modeswitch since ver 2.0 and are invoked with the -K on the usb_modeswitch cmd line or with the StandardEject=1 statement in usb_modeswitch device config files.

Post Reply