Activation Codes and Methods, Hardware Details, Sniffing
Post Reply
aarruda
Posts: 7
Joined: 12 Nov 2008, 02:02

Not changing product id

Post by aarruda » 12 Nov 2008, 02:50

I got a ZTE MF622 3G modem, i made all the steps for setting up usb_modeswitch. The program runs normally, no errors, and gives the message about doing a "lsusb" to check the changes.

After running the switch the device is detached from usb-storage, but the product id is the same (0x2000 still, didn't change to 0x0001). I have tried every possible usb_modeswitch settings, every single MF600 and MF622 settings avaliable, but there's no way the product id gets changed. I even tried different kernels (2.6.25, 2.6.26, 2.6.27).
I tried using usbserial with the original storage ID (0x2000), but the modem returns a bunch of binary code when wvdial sents the AT command.

I got it to work by initializing the device under WinXP in VirtualBox, then detaching it. The windows driver changes the device ID and then i can use it normally under linux. That's the only way i managed to get it working.

Anyone has any idea what might be wrong? I have spend over 6 hours today trying to figure this out :(

Thanks.

aarruda
Posts: 7
Joined: 12 Nov 2008, 02:02

Post by aarruda » 12 Nov 2008, 12:37

Btw, i tried usbsnoop, here is the log:

http://www.andrearruda.com.br/UsbSnoop.zip

I used the last endpoint 0x05 part before the device is reset:

Code: Select all

00000000: 55 53 42 43 a8 24 8f 81 12 00 00 00 80 00 0c 03
    00000010: 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00
And the usb_modeswitch.conf:

Code: Select all

DefaultVendor=  0x19d2
DefaultProduct= 0x2000
TargetVendor=   0x19d2
TargetProduct=  0x0001
MessageEndpoint = 0x05
MessageContent = "55534243a8248f811200000080000c03000000120000000000000000000000"
This gives no errors at all, all output is normal. But the device isn't switched.

joke_dst
Posts: 19
Joined: 04 Mar 2008, 12:21

Post by joke_dst » 12 Nov 2008, 14:39

Have you tried the command before that one in the log, i.e.:

[20476 ms] >>> URB 729 going down >>>
-- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
PipeHandle = 818fadf4 [endpoint 0x00000005]
TransferFlags = 00000000 (USBD_TRANSFER_DIRECTION_OUT, ~USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 0000001f
TransferBuffer = 81b5e1e8
TransferBufferMDL = 00000000
00000000: 55 53 42 43 a8 24 8f 81 00 00 00 00 00 00 06 00
00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
UrbLink = 00000000

This one looks more promising...
It would translate into this conf file:

DefaultVendor= 0x19d2
DefaultProduct= 0x2000
TargetVendor= 0x19d2
TargetProduct= 0x0001
MessageEndpoint = 0x05
MessageContent = "55534243a8248f810000000000000600000000000000000000000000000000"

aarruda
Posts: 7
Joined: 12 Nov 2008, 02:02

Post by aarruda » 12 Nov 2008, 18:12

Hello,

Thanks a lot for the tip, but it didn't work:

switch log:

Code: Select all

 * usb_modeswitch: tool for controlling "flip flop" mode USB devices
 * Version 0.9.5 (C) Josua Dietze 2008
 * Works with libusb 0.1.12 and probably other versions

DefaultVendor=0x19d2
DefaultProduct=0x2000
TargetVendor=0x19d2
TargetProduct=0x1
TargetClass=0x0
DetachStorageOnly=0
HuaweiMode=0
MessageEndpoint=0x5
MessageContent="55534243a8248f810000000000000600000000000000000000000000000000"
Interface=0x0

Looking for target devices
 No target device found
Looking for default devices
 Found default devices (1)
Prepare switching, accessing latest device
Looking for active default driver to detach it
 OK, driver found ("usb-storage")
 OK, Driver "usb-storage" successfully detached
Setting up communication with device
Trying to send the message
 OK, message successfully sent.
-> See /proc/bus/usb/devices (or call lsusb) for changes. Bye
lsusb:

Code: Select all

Bus 002 Device 003: ID 0c45:62c0 Microdia Pavilion Webcam
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 008: ID 19d2:2000  
Bus 001 Device 002: ID 062a:0000 Creative Labs Optical mouse
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
The message log shows that the device has been detached from usb-storage, but nothing happens then.

Anyone knows how i can debug the part where the program tries to change the product ID? strace maybe...

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

Post by Josh » 12 Nov 2008, 20:11

The program does not change the product ID. That's entirely up to the device.

What does udevmonitor say? It's useful to watch it on a second console/terminal.

aarruda
Posts: 7
Joined: 12 Nov 2008, 02:02

Post by aarruda » 12 Nov 2008, 22:49

Here's the log:

Code: Select all

udevmonitor will print the received events for:
UDEV the event which udev sends out after rule processing
UEVENT the kernel uevent

UEVENT[1226521707.085012] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6 (usb)
UEVENT[1226521707.085582] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/usb_endpoint/usbdev1.8_ep00 (usb_endpoint)
UEVENT[1226521707.087443] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0 (usb)
UEVENT[1226521707.089995] add      /class/scsi_host/host6 (scsi_host)
UEVENT[1226521707.090441] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/usb_endpoint/usbdev1.8_ep84 (usb_endpoint)
UEVENT[1226521707.090769] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/usb_endpoint/usbdev1.8_ep05 (usb_endpoint)
UDEV  [1226521707.100216] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6 (usb)
UDEV  [1226521707.108290] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/usb_endpoint/usbdev1.8_ep00 (usb_endpoint)
UDEV  [1226521707.177066] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0 (usb)
UDEV  [1226521707.183863] add      /class/scsi_host/host6 (scsi_host)
UDEV  [1226521707.187149] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/usb_endpoint/usbdev1.8_ep84 (usb_endpoint)
UDEV  [1226521707.205086] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/usb_endpoint/usbdev1.8_ep05 (usb_endpoint)
UEVENT[1226521708.100347] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0 (scsi)
UEVENT[1226521708.150314] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0/block/sr1 (block)
UEVENT[1226521708.150444] add      /class/scsi_device/6:0:0:0 (scsi_device)
UEVENT[1226521708.151238] add      /class/scsi_generic/sg2 (scsi_generic)
UEVENT[1226521708.151842] add      /class/bsg/6:0:0:0 (bsg)
UDEV  [1226521708.163815] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0 (scsi)
UDEV  [1226521708.257350] add      /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0/block/sr1 (block)
UDEV  [1226521708.268967] add      /class/scsi_device/6:0:0:0 (scsi_device)
UDEV  [1226521708.280673] add      /class/scsi_generic/sg2 (scsi_generic)
UDEV  [1226521708.285696] add      /class/bsg/6:0:0:0 (bsg)
UEVENT[1226521715.066973] change   /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0 (scsi)
UDEV  [1226521715.068111] change   /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0 (scsi)
UEVENT[1226521742.322604] remove   /class/bsg/6:0:0:0 (bsg)
UEVENT[1226521742.323471] remove   /class/scsi_generic/sg2 (scsi_generic)
UEVENT[1226521742.324142] remove   /class/scsi_device/6:0:0:0 (scsi_device)
UDEV  [1226521742.324896] remove   /class/bsg/6:0:0:0 (bsg)
UDEV  [1226521742.326077] remove   /class/scsi_device/6:0:0:0 (scsi_device)
UEVENT[1226521742.326574] remove   /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0/block/sr1 (block)
UEVENT[1226521742.326646] remove   /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0 (scsi)
UEVENT[1226521742.326747] remove   /class/scsi_host/host6 (scsi_host)
UDEV  [1226521742.328934] remove   /class/scsi_generic/sg2 (scsi_generic)
UDEV  [1226521742.348226] remove   /class/scsi_host/host6 (scsi_host)
UDEV  [1226521742.394944] remove   /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0/block/sr1 (block)
UDEV  [1226521742.420545] remove   /devices/pci0000:00/0000:00:0b.0/usb1/1-6/1-6:1.0/host6/target6:0:0/6:0:0:0 (scsi)

aarruda
Posts: 7
Joined: 12 Nov 2008, 02:02

Post by aarruda » 12 Nov 2008, 23:27

IT WORKED! :D

I got it to work manually, turns out the modem takes about 15 seconds after the switch to reset itself and come back as 0x0001.

The problem is that when using udev this delay makes the script hang, the device led goes red and it doesn't come back.

I'll take a look at the automation options to fix this now.

joke_dst, i used the MessageContent you adviced me to, thanks a lot!

Thanks Josh :)

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

Post by Josh » 13 Nov 2008, 09:49

You might try to play around with the new "ResetUSB" option.

Also, do you call a shell script from the udev rule file or the program directly?

aarruda
Posts: 7
Joined: 12 Nov 2008, 02:02

Post by aarruda » 13 Nov 2008, 12:47

I tried both ways, calling the program directly and through a bash script with a sleep/background process that launches the switcher.

This sleep is required because usb_storage takes about 1~2 seconds to attach the device.

The second problem is that when usbserial is launched udev freezes with the usb_storage process still running in the background. And all usb functions such as lsusb won't respond until i kill the bash process that launched the switcher.

Seems like this is more of a bash script problem, i'll try the second bash example described in this site. The MF622 has a long delay until it resets itself and comes back as a modem, sometimes close to 30 seconds.

aarruda
Posts: 7
Joined: 12 Nov 2008, 02:02

Post by aarruda » 13 Nov 2008, 13:04

One more thing, i know it's a bit off-topic but caught my attention. I thought the connection was rather slow even though the 3G signal in my city is high, usually the monitor has all the signal bars.

After a small research, i found out that i had to include an init string 'AT+COPS=0,0,"internet",2' so the modem would work in 3G mode. By using this my download speed increased from ~300kbps to ~2000kbps.

Is this common? i think this kind of setting is too important to go unnoticed in most of the documentation online.

Thanks again.

Post Reply