Activation Codes and Methods, Hardware Details, Sniffing
Mathias (Dovado)
Posts: 2
Joined: 24 Mar 2009, 11:46

Post by Mathias (Dovado) » 30 Mar 2009, 08:35

Nice job Josh :-)

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

Post by Josh » 04 Apr 2009, 23:17

Here's annother research report:

Driver setup (blacklisting usb-storage or ignoring device in unusual_devs.h) does not seem to change the behaviour in any way.

Sendig a reset immediately after the switch command does in fact make the MD 400 switch to modem right away (with the kernel message "device firmware changed"), but the device still vanishes a second later for around 20 secs and then comes back in the default mode. I tried countless commands from the logs to make it stable after the "quick switch", but with no success so far.

The "slow switch" is still the only stable solution.

sanyynn
Posts: 2
Joined: 24 May 2009, 21:59
Location: Budapest
Contact:

Post by sanyynn » 24 May 2009, 22:03

Hi!

I'm new here. I bought an md400 today, and I have a few questions. I downloaded and made this usb_modeswitch and after running it and waited for those 5 secs I don't know what to do to proceed. I already removed the pin, but I just can't figure out how can I use the net with this.

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

Post by Josh » 25 May 2009, 18:28

It should take around 20 seconds to switch. How do you arrive at 5 seconds?

Also, if the switch succeeded, follow instructions on the USB_ModeSwitch page, topic "How to automate and use".

sanyynn
Posts: 2
Joined: 24 May 2009, 21:59
Location: Budapest
Contact:

Post by sanyynn » 26 May 2009, 06:07

Hi!

Now it took a lot more. I thought I don't want to automate it 'till it doesn't work the first time... am I wrong?

"root@kitty:~# usb_modeswitch -v 0x0fce -p 0xd0e1 -O 1

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

Looking for default devices ...
Found default devices (1)
Prepare switching, accessing device 003 on bus 001 ...
Looking for active driver ...
OK, driver found ("usb-storage")
OK, driver "usb-storage" detached
Trying to send Sony control message
OK, control message sent, waiting for device to return ...
###############
After 15 seconds: device came back, proceeding
Sending Sony control message again ...
OK, control message sent
-> device should be stable now. Bye"

After this I don't know if there are any further steps or what, but if I try to open a web page it doesn't work...

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

Post by Josh » 26 May 2009, 14:33

I admit the information in "How to automate .." was probably not very well structured. Since these issues pop up very often I changed the text, and the headline is now "How to use and automate".

The paragraph now contains what I would answer on your question directly. Of course you want to see that it worked before you make it automatic.

jbn
Posts: 5
Joined: 27 May 2009, 16:49

Post by jbn » 28 May 2009, 17:34

I couldn't see any solutions in this thread, if I missed something I apologise.

When using modeswitch 0.9.7 which has a configuration for MD400 I have no success even after uncommenting the correct configuration. This is on some eee-version of Ubuntu 8.04, I think I recall it being ubuntu-eee, but there are so many distros with similar names by now.

With configuration=2 commented out I get:

Code: Select all

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found default devices (1)
Prepare switching, accessing device 013 on bus 005 ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
Trying to send Sony control message
 OK, control message sent, waiting for device to return ...
##############################
 After 30 seconds: device still gone, cancelling
Note: ignoring MessageContent. Can't combine with special mode
-> switching was not completed. Bye
And with configuration=2 uncommented I got:

Code: Select all

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found default devices (1)
Prepare switching, accessing device 017 on bus 005 ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
Trying to send Sony control message
 OK, control message sent, waiting for device to return ...
##############################
 After 30 seconds: device still gone, cancelling
Note: ignoring MessageContent. Can't combine with special mode
Changing configuration to 2 ...
 Setting the configuration returned error -9. Trying to continue
-> switching was not completed. Bye
I'm under the impression that the only thing I need to do with the MD400-options uncommented in the config-file is to run 'sudo usb_modeswitch'.

Any clues to why it won't work would be greatly appreciated.

sipeti
Posts: 1
Joined: 30 May 2009, 00:40

Post by sipeti » 30 May 2009, 00:51

jbn wrote:I couldn't see any solutions in this thread, if I missed something I apologise.

When using modeswitch 0.9.7 which has a configuration for MD400 I have no success even after uncommenting the correct configuration. This is on some eee-version of Ubuntu 8.04, I think I recall it being ubuntu-eee, but there are so many distros with similar names by now.

With configuration=2 commented out I get:

Code: Select all

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found default devices (1)
Prepare switching, accessing device 013 on bus 005 ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
Trying to send Sony control message
 OK, control message sent, waiting for device to return ...
##############################
 After 30 seconds: device still gone, cancelling
Note: ignoring MessageContent. Can't combine with special mode
-> switching was not completed. Bye
And with configuration=2 uncommented I got:

Code: Select all

Looking for target devices ...
 No devices in target mode or class found
Looking for default devices ...
 Found default devices (1)
Prepare switching, accessing device 017 on bus 005 ...
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
Trying to send Sony control message
 OK, control message sent, waiting for device to return ...
##############################
 After 30 seconds: device still gone, cancelling
Note: ignoring MessageContent. Can't combine with special mode
Changing configuration to 2 ...
 Setting the configuration returned error -9. Trying to continue
-> switching was not completed. Bye
I'm under the impression that the only thing I need to do with the MD400-options uncommented in the config-file is to run 'sudo usb_modeswitch'.

Any clues to why it won't work would be greatly appreciated.
Hello there from Hungary. I've got the same errors, using Ubuntu, and SE MD400. Sometimes i see the connection manager telling that connection aborted after running usb_modeswitch, so as I see, it switches to modem, but immediately it switches back. Help, please.

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

Post by Josh » 30 May 2009, 10:33

O.K., people, this behaviour is new and might be kernel-related. I just checked and our brave Solutor, starter of this thread, seems to have reported the MD400 to the kernel/USB maintainers so that it is now listed in "unusal_devs.h" to be ignored by the usb-storage driver. I'm not sure that helps.

Anyway, we need to do some testing.

First thing to do is to grab the 0.9.6 version of USB_ModeSwitch. The difference is that the Sony control message is in there too, but 0.9.7 sends it twice to prevent the infamous switch-back.
You can do the same with 0.9.6 if you run it for a second time manually after checking that it switched properly on the first time. For testing, this is more flexible because you can react to what you see.

There are several methods to see changes on the USB system: call "lsusb" repeatedly, call "dmesg" repeatedly or open an extra terminal window and call "udevmonitor" once.
The last method is quite comfortable but you might get more information than you can process. "lsusb" is very compact but sometimes slow with reflecting changes.

You certainly know that you can call previously typed programs by hitting the "up" arrow in the terminal, right? Also, it may be advised to work as root instead of all this "sudo" detouring. Do "sudo su - " once and you should be root permanently until you type "exit" again.

Test sequence with 0.9.6:

- plug in
- run "dmesg"
- device recognized? Else "dmesg" again
- do you see "device ignored" ? That would be the special entry
- run "usb_modeswitch -v 0x0fce -p 0xd0e1 -O 1"
- run "dmesg"
- "device disconnected" or similar? Run "dmesg" until "new device"
- do you see "ttyACM0" somewhere? Then it switched
- run "usb_modeswitch -v 0x0fce -p 0xd0e1 -O 1"
- if successful, the modem should be stable and not switching back

[edit on] If you are in the folder where your unpacked binary of usb_modeswitch 0.9.6 sits, you rather call "./usb_modeswitch ..." to use the local copy instead of the one installed systemwide.[edit off]

If that all works, note the time between

- plugging in and device recognition
- running "usb_modeswitch" and disappearance
- disappearance and coming back

If something does not work, report.

Gentlemen, start your engines ... 8)

jbn
Posts: 5
Joined: 27 May 2009, 16:49

Post by jbn » 04 Jun 2009, 09:52

Hmm, haven't gotten alerted that my favorite topic was updated yet.

Initial plug-in:

Code: Select all

[  229.990023] usb 5-2: new high speed USB device using ehci_hcd and address 9
[  230.123625] usb 5-2: configuration #1 chosen from 1 choice
[  230.184854] scsi8 : SCSI emulation for USB Mass Storage devices
[ ..snip..]
[  232.774214] sd 8:0:0:1: [sdd] Attached SCSI removable disk
[  232.774318] sd 8:0:0:1: Attached scsi generic sg3 type 0
command:

Code: Select all

./usb_modeswitch -v 0x0fce -p 0xd0e1 -O 1

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

Looking for default devices
 Found default devices (1)
Prepare switching, accessing latest device
 OK, Sony control message successfully sent.
-> See /proc/bus/usb/devices (or call lsusb) for changes. Bye

Error: releasing interface failed (error -22). Trying to continue
dmesg, after usb_modeswitch:

Code: Select all

[  269.864819] usb 5-2: USB disconnect, address 9
[  274.384272] usb 5-2: new high speed USB device using ehci_hcd and address 10
[  274.461890] usb 5-2: configuration #2 chosen from 1 choice
[  274.481173] cdc_acm 5-2:2.1: ttyACM0: USB ACM device
[  274.489586] cdc_acm 5-2:2.3: ttyACM1: USB ACM device
[  274.515378] scsi9 : SCSI emulation for USB Mass Storage devices
[  274.530028] usb-storage: device found at 10
[  274.530060] usb-storage: waiting for device to settle before scanning
[  277.779924] usb-storage: device scan complete
[  277.782547] scsi 9:0:0:0: Direct-Access     SEMC     MMC Flash Card      0 PQ: 0 ANSI: 0
[  277.784483] scsi 9:0:0:1: Direct-Access     SEMC     MMC Flash Card      0 PQ: 0 ANSI: 0
[  277.793464] sd 9:0:0:0: [sdc] 348261 512-byte hardware sectors (178 MB)
[  277.803675] sd 9:0:0:0: [sdc] Test WP failed, assume Write Enabled
[  277.803721] sd 9:0:0:0: [sdc] Assuming drive cache: write through
[  277.810111] sd 9:0:0:0: [sdc] 348261 512-byte hardware sectors (178 MB)
[  277.812949] sd 9:0:0:0: [sdc] Test WP failed, assume Write Enabled
[  277.812980] sd 9:0:0:0: [sdc] Assuming drive cache: write through
[  277.813017]  sdc: sdc1
[  277.816434] sd 9:0:0:0: [sdc] Attached SCSI removable disk
[  277.816774] sd 9:0:0:0: Attached scsi generic sg2 type 0
[  277.819879] sd 9:0:0:1: [sdd] 1967104 512-byte hardware sectors (1007 MB)
[  277.821906] sd 9:0:0:1: [sdd] Test WP failed, assume Write Enabled
[  277.821936] sd 9:0:0:1: [sdd] Assuming drive cache: write through
[  277.826518] sd 9:0:0:1: [sdd] 1967104 512-byte hardware sectors (1007 MB)
[  277.828658] sd 9:0:0:1: [sdd] Test WP failed, assume Write Enabled
[  277.828688] sd 9:0:0:1: [sdd] Assuming drive cache: write through
[  277.828725]  sdd: sdd1
[  277.832126] sd 9:0:0:1: [sdd] Attached SCSI removable disk
[  277.832390] sd 9:0:0:1: Attached scsi generic sg3 type 0
I didn't clock this but if it's necessary I'll take the time to do it at a later point. I tried running it again but I probably waited too long for it to have any effect.

---

Fiddling a bit more I ran the modeswitch again as soon as I could get ttyAMC0 out of dmesg. Then I fiddled around with trying to get a connection, can't say I succeeded but wvdialconf recognizes the modem so I guess I'm on the right way.

Thanks for the help so far.

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

Post by Josh » 04 Jun 2009, 18:13

Thanks for the info! I can see that your device returns in fact after less than five seconds. The function in USB_ModeSwitch starts to search for the returned device after six seconds in order to give it time to vanish in the first place (took around two seconds on my system, on yours it's gone immediately).

I will rewrite this function to start searching as soon as the first device is vanishing. Until then, you might use a script which just calls USBModeSwitch twice with a "sleep(5)" (or more) in between.

jbn
Posts: 5
Joined: 27 May 2009, 16:49

Problem solved for me?

Post by jbn » 04 Jun 2009, 22:45

I updated my system to a modern Ubuntu where mobile modems are actually detected after switching.

I found "sudo usb_modeswitch -v 0x0fce -p 0xd0e1 -O 1" on a blog and it worked like a charm. Then I realized it started switching back, running the command once more after the initial switch seems to cure this. Not sure what the -O 1 option is so I'm uncertain of what I should put into my config.

Anyway, I've got it working, should probably attempt to automate it at some point, but it's not so hard as it is.

Seems stable.

Thanks a lot. Awesome tool, fiddly modem.

Kulfaangaren
Posts: 4
Joined: 05 Jun 2009, 02:01

Post by Kulfaangaren » 05 Jun 2009, 02:11

jbn & sipeti:

Code: Select all

...
Trying to send Sony control message
 OK, control message sent, waiting for device to return ...
##############################
 After 30 seconds: device still gone, cancelling
...
Is easily fixed by not uncommenting the "; TargetClass= 0x02" line for MD400. For some reason this makes the switch not work.

I have a question: I have been unable to find any information on which kernel module is required to make this HW work. The switching works great (but slow :) ) but I still get no devices. Do I need to apply Carl's patch or is there a kernel module that can handle this modem ?

Thanks in advance

// Fredrik

Kulfaangaren
Posts: 4
Joined: 05 Jun 2009, 02:01

Re: Problem solved for me?

Post by Kulfaangaren » 05 Jun 2009, 02:20

jbn wrote:...
Not sure what the -O 1 option is so I'm uncertain of what I should put into my config.
You should check out the main page and especially read the Download section. It says to download the latest usb_modeswitch.conf and at the top of the conf you can find the documentation for all commandline switches AND their config-file equavilents.

Code: Select all

...
# * SonyMode <0/1>           -O
#
# Some Sony-Ericsson devices can be switched by a special control
# message. This is experimental and might not have a stable result
...
Now check the MD400 section in the same file...

Code: Select all

...
########################################################
# Sony Ericsson MD400
#
# This is experimental. Might switch back after some time. Please report!

;DefaultVendor=  0x0fce 
;DefaultProduct= 0xd0e1

;TargetClass=    0x02

;SonyMode=1

# This might work too instead; subject to testing
;Configuration=2
...
See the SonyMode=1 line?

Uncomment DefaultVendor, DefaultProduct and SonyMode but leave TargetClass commented.

// Fredrik

jbn
Posts: 5
Joined: 27 May 2009, 16:49

Post by jbn » 05 Jun 2009, 13:21

I'll have to admit to having skimmed some parts of the the text and thus not having read the start of the .conf. Sorry about that.

I've no idea which module is required but my Ubuntu Netboox Remix of Jaunty with 2.6.28-11-generic worked like a charm.

Post Reply