Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
centosette
Posts: 2
Joined: 07 Nov 2009, 17:29
Location: Italy

Sony MD400 on Fedora Core 11

Post by centosette » 01 Jan 2010, 18:46

I've got a Sony MD400 HSDPA Modem and recently upgraded to FC11 from FC8. Unfortunately after the upgrade usb_modeswitch stopped working properly. More specifically, when dealing with Sony stuff, usb_modeswitch sends a particular message to the device to cause it to switch to modem mode. The message must be sent a second time for the "trick" to work. Both the first and the second message are sent inside the switchSonyMode function.
Between the first message and the second one, the device is temporarily lost, and usb_modeswitch tries to re-detect it by means of a function called "search_devices".
This function failed because two variables (busnum and devnum) were not correctly reinitialized to -1 before the second call to search_devices. I succesfully fixed the problem adding:

Code: Select all

devnum=-1;
busnum=-1;
before:

Code: Select all

i=0;
	dev = NULL;
	while ( dev == NULL && i < 20 ) {...
        
inside the switchSonyMode function.

Maybe someone else encountered this problem, so the code should be fixed this way.

Regards, and happy new year!
Marco

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

Post by Josh » 02 Jan 2010, 21:35

You are right, of course. I missed that side effect when I tried to improve success checking.
Sometimes I despise not having all those devices around for testing ...

I'll probably change the whole mechanics at some point, but for the next version I'll gladly include your fix.

Thanks a lot!

BTW, my version says:
"while ( dev == NULL && i < 30 ) {"
instead of "i < 20". Do you have a modified version?

During my trials with the device I had a waiting time of about 19 seconds until it came back; so I'd figure 20 seconds before aborting the wait proc is a little too close ...


centosette
Posts: 2
Joined: 07 Nov 2009, 17:29
Location: Italy

Post by centosette » 04 Jan 2010, 22:17

BTW, my version says:
"while ( dev == NULL && i < 30 ) {"
instead of "i < 20". Do you have a modified version?

During my trials with the device I had a waiting time of about 19 seconds until it came back; so I'd figure 20 seconds before aborting the wait proc is a little too close ...
When playing around with code, i put a "sleep (15)" just before the whole cycle, so the resulting behaviour is more or less the same. 30 secs like in the original code is fine: as you correctly tested, the device takes about 20 to switch (and it's a mystery why it's doing this way!).

Let me thank you for all this work, i could never use the modem under Linux if you wouldn't do it.

Bye
Marco

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

Post by Josh » 06 Jan 2010, 00:40

This is one of the two devices I actually had in my hands for testing. The Windows driver sends the switching command as the very first when the device is connected. No discovering or anything.

This is just not possible with the Linux USB system. So I was glad to find there's a "plan B" with the 19 seconds blackout.
If that second control message is not sent, the device flips back to storage mode after annother 30 seconds (you can try out if you want :wink: ).

Oh, well. I thought: better wait for a while than not being able to use it at all ...

If you don't object, I'll name you as a bug fix contributor in the source. If that's O.K. you could give me your whole name by PM or mail.


rosydam
Posts: 6
Joined: 09 Jan 2024, 09:52
Contact:

Re: Sony MD400 on Fedora Core 11

Post by rosydam » 21 Mar 2024, 09:45

Unlike traditional crafting games, infinite craft dismantles the notion of pre-defined blocks and restrictions. It opens the floodgates of pure creative freedom, encouraging players to chart their own course in the vast sea of imagination.

Post Reply