Page 1 of 1

Error in usb_modeswitch.tcl 2.2.6

Posted: Fri Jan 08, 2016 7:58 pm
by dmd

In version 2.2.6 usb_modeswitch.tcl is missing initialization of flags(nombim), which causes it to crash at line 258 if compiled with libjim.
The symptom is you would see an output similar to this, and no switching will occur:

Code: Select all

# cat /var/log/usb_modeswitch_1-1

USB_ModeSwitch log from Fri Jan  08 09:10:01 PST 2016

Use global config file: /etc/usb_modeswitch.conf
Raw args from udev: /1-1

Use top device dir /sys/bus/usb/devices/1-1
Check class of first interface ...
 Interface 0 class is 08.

USB values from sysfs:
  manufacturer  HUAWEI_MOBILE
  product       HUAWEI_MOBILE
  serial        0123456789ABCDEF
bNumConfigurations is 1 - don't check for active configuration
ConfigList: /usr/share/usb_modeswitch/12d1:1f01 /usr/share/usb_modeswitch/12d1:#linux
SCSI attributes not needed, move on
Check config: /usr/share/usb_modeswitch/12d1:1f01
! matched. Read config data
config: NoDriverLoading is set to active
Driver will not be handled by usb_modeswitch

A simple fix is to initialize the flag at the beginning of the script:

Code: Select all

--- usb_modeswitch.tcl.orig     2015-11-01 01:11:22.000000000 -0700
+++ usb_modeswitch.tcl  2016-01-08 09:48:59.234541012 -0800
@@ -28,6 +28,7 @@ set flags(logging) 1
 set flags(noswitching) 0
 set flags(stordelay) 0
 set flags(logwrite) 0
+set flags(nombim) 0

 # Execution starts at file bottom

Re: Error in usb_modeswitch.tcl 2.2.6

Posted: Sat Jan 09, 2016 11:04 pm
by Josh
Thanks for spotting this !!

It's really weird though that the tcl script is running at all ... It should exit with an error every time a modem configuration is found ...