Automatic Activation, Hotplug and UDEV, Configuration
Post Reply
CoolNameMan
Posts: 3
Joined: 24 Apr 2012, 16:28

Micromax MMX 310G doesn't switch when plugging in after boot

Post by CoolNameMan » 24 Apr 2012, 17:00

Hi!

Sorry about the incomplete subject. Here's the situation:

1> When the modem (Micromax MMX 310G) is plugged in during boot, it's always switched to modem mode. 4 log files are created. usb_modeswitch_ttyUSB(0 to 2) are like

Code: Select all

USB_ModeSwitch log from Tue Apr 24 19:30:47 IST 2012

usb_modeswitch called with --symlink-name
 parameter: /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0/ttyUSB0/tty/ttyUSB0

My name is ttyUSB0

Checking my endpoints ...
 in /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0
  checking ep_81 ...
  checking ep_01 ...

--> I am not an interrupt port

Return empty name and exit
usb_modeswitch_ttyUSB3 is

Code: Select all

USB_ModeSwitch log from Sat Apr 07 16:16:58 IST 2012

usb_modeswitch called with --symlink-name
 parameter: /devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.3/ttyUSB3/tty/ttyUSB3

My name is ttyUSB3

Checking my endpoints ...
 in /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.3
  checking ep_84 ...
  ep_84 has interrupt transfer type

--> I am an interrupt port

Looking for lower ports with interrupt endpoints
 in ifDir /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.0 ...
  checking ep_81 ...
  checking ep_01 ...
 in ifDir /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.1 ...
  checking ep_82 ...
  checking ep_02 ...
 in ifDir /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1:1.2 ...
  checking ep_83 ...
  checking ep_03 ...

--> No interrupt interface below me

Return symlink name "gsmmodem" and exit
2> When plugged in after boot, sometimes switching occurs, but more frequently it does not.

When switching occurs, a log file called usb_modeswitch_1-1:1.0 (or 2-1:1.0 depending on where I'm plugging in the device) is created. It's like

Code: Select all

USB_ModeSwitch log from Tue Apr 24 16:42:24 IST 2012

Raw args from udev: /2-2:1.0

Using global config file: /etc/usb_modeswitch.conf
Using top device dir /sys/bus/usb/devices/2-2
----------------
USB values from sysfs:
  manufacturer	USB Modem
  product	USB Modem
  serial	000000000000
----------------
bNumConfigurations is 1 - don't check for active configuration
SCSI attributes not needed, moving on
checking config: /etc/usb_modeswitch.d/1c9e:f000
! matched. Reading config data
Using config file from override folder /etc/usb_modeswitch.d
Logger is /usr/bin/logger
config: TargetVendor set to 1c9e
config: TargetProductList set to 9000,9603,9605
config: CheckSuccess set to 20
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Command to be run:
usb_modeswitch -I -W -D -s 20 -u -1 -b 2 -g 4 -v 1c9e -p f000 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------
usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 008
usb_os_find_busses: Found 007
usb_os_find_busses: Found 006
usb_os_find_busses: Found 005
usb_os_find_busses: Found 004
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
usb_os_find_devices: Found 001 on 008
usb_os_find_devices: Found 001 on 007
usb_os_find_devices: Found 001 on 006
usb_os_find_devices: Found 001 on 005
usb_os_find_devices: Found 001 on 004
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 004 on 002
usb_os_find_devices: Found 001 on 002
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 003 on 001
skipping descriptor 0xB
skipped 1 class/vendor specific endpoint descriptors
skipped 6 class/vendor specific interface descriptors
skipping descriptor 0x25
skipped 1 class/vendor specific endpoint descriptors
skipped 11 class/vendor specific interface descriptors
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device

Reading long config from command line

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 1.2.3 (C) Josua Dietze 2012
 * Based on libusb0 (0.1.12 and above)

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x1c9e
DefaultProduct= 0xf000
TargetVendor=   0x1c9e
TargetProduct=  not set
TargetClass=    not set
TargetProductList="9000,9603,9605"

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint=  not set
MessageContent="55534243123456788000000080000606f50402527000000000000000000000"
NeedResponse=0
ResponseEndpoint= not set

InquireDevice disabled
Success check enabled, max. wait time 20 seconds
System integration mode enabled


Use given bus/device number: 002/004 ...
Looking for default devices ...
 bus/device number matched
  searching devices, found USB ID 1c9e:f000
   found matching vendor ID
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Skipping the check for the current configuration
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: USB Modem
     Product: USB Modem
  Serial No.: 000000000000
-------------------------
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
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
Bus/dev search active, referring success check to wrapper. Bye.

ok:busdev
--------------------------------
(end of usb_modeswitch output)

Checking success of mode switch for max. 20 seconds ...
 Reading attributes ...
 Reading attributes ...
 All attributes matched
Mode switching was successful, found 1c9e:9605 (USB Modem: Modem Configuration)
Now checking for bound driver ...
 driver has bound, device is known
Checking for AVOID_RESET_QUIRK kernel attribute
 AVOID_RESET_QUIRK activated

All done, exiting
When switching doesn't occur, the log file looks like

Code: Select all

USB_ModeSwitch log from Tue Apr 24 13:14:39 IST 2012

Raw args from udev: /2-1:1.0

Using global config file: /etc/usb_modeswitch.conf
Using top device dir /sys/bus/usb/devices/2-1
----------------
USB values from sysfs:
  manufacturer	USB Modem
  product	USB Modem
  serial	000000000000
----------------
bNumConfigurations is 1 - don't check for active configuration
SCSI attributes not needed, moving on
checking config: /etc/usb_modeswitch.d/1c9e:f000
! matched. Reading config data
Using config file from override folder /etc/usb_modeswitch.d
Logger is /usr/bin/logger
config: TargetVendor set to 1c9e
config: TargetProductList set to 9000,9603,9605
config: CheckSuccess set to 20
Driver module is "option", ID path is /sys/bus/usb-serial/drivers/option1

Command to be run:
usb_modeswitch -I -W -D -s 20 -u -1 -b 2 -g 12 -v 1c9e -p f000 -f $configBuffer

Verbose debug output of usb_modeswitch and libusb follows
(Note that some USB errors are to be expected in the process)
--------------------------------
usb_set_debug: Setting debugging level to 15 (on)
usb_os_find_busses: Found 008
usb_os_find_busses: Found 007
usb_os_find_busses: Found 006
usb_os_find_busses: Found 005
usb_os_find_busses: Found 004
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
usb_os_find_devices: Found 001 on 008
usb_os_find_devices: Found 001 on 007
usb_os_find_devices: Found 006 on 006
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 001 on 006
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 001 on 005
usb_os_find_devices: Found 001 on 004
usb_os_find_devices: Found 001 on 003
usb_os_find_devices: Found 012 on 002
usb_os_find_devices: Found 001 on 002
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 003 on 001
skipping descriptor 0xB
skipped 1 class/vendor specific endpoint descriptors
skipped 6 class/vendor specific interface descriptors
skipping descriptor 0x25
skipped 1 class/vendor specific endpoint descriptors
skipped 11 class/vendor specific interface descriptors
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device

Reading long config from command line

 * usb_modeswitch: handle USB devices with multiple modes
 * Version 1.2.3 (C) Josua Dietze 2012
 * Based on libusb0 (0.1.12 and above)

 ! PLEASE REPORT NEW CONFIGURATIONS !

DefaultVendor=  0x1c9e
DefaultProduct= 0xf000
TargetVendor=   0x1c9e
TargetProduct=  not set
TargetClass=    not set
TargetProductList="9000,9603,9605"

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
QisdaMode=0
GCTMode=0
KobilMode=0
SequansMode=0
MobileActionMode=0
CiscoMode=0
MessageEndpoint=  not set
MessageContent="55534243123456788000000080000606f50402527000000000000000000000"
NeedResponse=0
ResponseEndpoint= not set

InquireDevice disabled
Success check enabled, max. wait time 20 seconds
System integration mode enabled


Use given bus/device number: 002/012 ...
Looking for default devices ...
 bus/device number matched
  searching devices, found USB ID 1c9e:f000
   found matching vendor ID
   found matching product ID
   adding device
 Found device in default mode, class or configuration (1)
Skipping the check for the current configuration
Using first interface: 0x00
Using endpoints 0x01 (out) and 0x81 (in)

USB description data (for identification)
-------------------------
Manufacturer: USB Modem
     Product: USB Modem
  Serial No.: 000000000000
-------------------------
Looking for active driver ...
 OK, driver found ("usb-storage")
 OK, driver "usb-storage" detached
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
Bus/dev search active, referring success check to wrapper. Bye.

ok:busdev
--------------------------------
(end of usb_modeswitch output)

Checking success of mode switch for max. 20 seconds ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...
 Reading attributes ...

Target config not matching - current values are
    2-1:1.0/bInterfaceClass:   08
    bConfigurationValue:       1
    bNumConfigurations:        1
    busnum:                    2
    devnum:                    12
    idProduct:                 f000
    idVendor:                  1c9e
    manufacturer:              USB Modem
    product:                   USB Modem
    serial:                    000000000000

Mode switching may have failed. Exiting
Running the command

Code: Select all

sudo usb_modeswitch -v 0x1c9e -p 0xf000 -V 0x1c9e -P 0x9605 -M 55534243123456788000000080000606f50402527000000000000000000000
after automatic switching fails gives

Code: Select all

Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
Found devices in default mode or class (1)
Accessing device 005 on bus 001 ...
Using endpoints 0x01 (out) and 0x81 (in)
Using endpoints 0x01 (out) and 0x81 (in)
Inquiring device details; driver will be detached ...
Looking for active driver ...
No driver found. Either detached before or never attached 
and gets stuck there.

How can I ensure that switching doesn't involve shutting down and booting up my computer (restart doesn't work)?

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

Post by Josh » 24 Apr 2012, 21:08

That is strange behaviour indeed.

Is there anything unusual in the output of "dmesg" after you plug into the running system?

Anyway, there are a number of things to try.
  1. Disable automatic switching globally (in /etc/usb_modeswitch.conf), plug in and run the manual command again. What happens?
  2. Your config file is in /etc/usb_modeswitch.d - did you change the default in any way? If so, try using the original file again.
  3. If the file in /etc/usb_modeswitch.d is unchanged, edit it and add a "ResetUSB=1" line. This will lead to a device reset command after concluding the message sending. Any changes?
  4. There may be timing issues involved (like with some other modems). You can play around with the ReleaseDelay and WaitBefore parameters (see device_reference.txt for a description).

CoolNameMan
Posts: 3
Joined: 24 Apr 2012, 16:28

Disabling automatic switching works

Post by CoolNameMan » 25 Apr 2012, 07:46

Thanks a lot Josh, disabling automatic switching globally and manually running the command has resolved the issue. I was able to switch the device 3 times in a row after making that change which is the kind of thing that would never have happened earlier.

I'll post relevant dmesg outputs if you'd like to see them.

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

Post by Josh » 25 Apr 2012, 08:32

Good to hear it's working - but this is annother symptom, not the cure yet ...

It confirms that timing issues are involved. The only substantial difference to the automatic switching is that there is a larger time span between plugging in and switching.

When automatic switching is enabled again I suggest to use "WaitBefore=8" in your config file to delay the process. If that works, try to reduce the value (it's just the number of seconds).


CoolNameMan
Posts: 3
Joined: 24 Apr 2012, 16:28

Switching automated now.

Post by CoolNameMan » 25 Apr 2012, 20:01

Automatic switching works with WaitBefore=1.

Thanks a lot again, Josh.

Post Reply