Package: usb-modeswitch
Version: 1.1.2-3
Severity: important

*** Please type your report below this line ***

This patch adds functionality to the 1.1.2-3 version of usb-modeswitch:

Multiple interrupt devices as the Olivetti OliCard100 only work reliably
w/ this patch. The gsmmodem link doesn't get set correclty w/o this patch.

Details can be found here:
http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?t=391&postdays=0&postorder=asc&start=15

-- citation start
[..]
USB_ModeSwitch log from Sun May 23 16:02:19 CEST 2010
symlink call
dirList: {} devices pci0000:00 0000:00:1a.7 usb1 1-3 1-3:1.3 ttyUSB2 tty ttyUSB2
tty: ttyUSB2
ttyNo: 2
Path: /devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.3/ttyUSB2/tty/ttyUSB2
ifDir: /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3
port: ttyUSB2
dev_top: 1-3
className: /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.3/bInterfaceClass
classType: ff
found INT: /sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:1.3/ep_84/type
INT-portList: 3
INFO: 2 smaller than or equal to 3
returning symlinkname: gsmmodem2

In the last call (the one for ttyUSB2) here's the correlation between path 
element __1.3__/ttyUSB2 and "found INT: 
/sys/devices/pci0000:00/0000:00:1a.7/usb1/1-3/1-3:__1.3__/ep_84/type" 
[..]

[..] The id in the path name from udev and the one from the lowest found 
interrupt must be identical [..]
-- citation end


Unfortunately, upstream only re-implemented half of it in an updated version: 
just the lowest found interrupt port is used, no path id correlation is done. 

However, at the installations on our sites this correlation is mandatory. W/o 
it the link doesn't get set reliably. 

The patch correlation has been rejected so far as reports from users 
have been received by upstream. Those reports received have not been further 
detailed by upstream except that there might be a misleading correlation in 
kernels/systems.

We're running on debian, ubuntu and kernels .33.4 and .32.x w/ success, no 
such thing as a bad path id correlation occurred to us so far.

It was suggested to report this bug/patch to the dbts as upstream's personality
is objecting further cooperation (see above link ff), this feature however is 
required for this device and other users w/ a multi interrupt device might 
profit this way.

Thank you.


              Cheers,


                          Nils

--- /lib/udev/usb_modeswitch.orig       2010-05-18 12:01:18.000000000 +0200
+++ /lib/udev/usb_modeswitch    2010-05-23 22:29:44.000000000 +0200
@@ -553,36 +553,52 @@
 
 proc {SymLinkName} {path} {
 
-# HACK ... /tmp/gsmmodem_* was generated by a switching run before;
-# no way found to signal annother instance in the udev environment
-set tmpname [lindex [glob -nocomplain /tmp/gsmmodem_*] 0]
-set dev_top [lindex [split $tmpname _] 1]
-
 set dirList [split $path /]
 set idx -1
 set idx [lsearch -regexp $dirList {\d+-\d+:\d+\.\d+}]
 if {$idx == -1} {
        return ""
 }
-set ifDir /sys[join [lrange $dirList 0 $idx] /]
-set port [lindex $dirList end]
 
+# HACK ... /tmp/gsmmodem_* was generated by a switching run before;
+# no way found to signal annother instance in the udev environment
+set tmpname [lindex [glob -nocomplain /tmp/gsmmodem_*] 0]
+set dev_top [lindex [split $tmpname _] 1]
 if {![regexp "/$dev_top/" $path]} {
        return ""
 }
 
+### Idea is: the lower the tty the better it is: ttyUSB0 is 
+###   working, ttyUSB4 isn't (holds for devices with more 
+###   than one interrupt line like olicard100) This doesn't 
+###   take into account more than one /dev/gsmmodem link.
 set symlinkName ""
-foreach epDir [glob -nocomplain $ifDir/ep_*] {
+set usbIds {}
+set devDirBricks [lrange $dirList 0 [expr {$idx-1}]]
+lappend devDirBricks $dev_top
+set ifDirPrefixed /sys[join $devDirBricks /]
+foreach epDir [glob -nocomplain $ifDirPrefixed:\[0-9\].\[0-9\]/ep_*] {
        if [file exists $epDir/type] {
                set rc [open $epDir/type r]
                set type [read $rc]
                close $rc
                if [regexp {Interrupt} $type] {
-                       set symlinkName "gsmmodem"
-                       break
+      lappend usbIds [regsub $ifDirPrefixed:.\.(\[0-9\])/.* $epDir {\1}]
                }
        }
 }
+set minUsbId [lindex [lsort -decreasing $usbIds] end]
+
+### The id from the device on the given usb port (path from udev)
+### and the lowest found interrupt line path id must be identical.
+### This works for 1-interrupt devs like the Onda ZTE MF636 and 
+### multi-interrupt devices like the Olivetti Olicard100 sticks.
+set usbPathId [lindex $dirList 6]
+set lastCharUsbPathId [lindex [split $usbPathId .] end]
+if {$lastCharUsbPathId == $minUsbId} {
+  set symlinkName "gsmmodem"
+}
+
 cd /dev
 set idx 2
 set trunkName $symlinkName



-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.33.4 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages usb-modeswitch depends on:
ii  libc6                        2.11.2-2    Embedded GNU C Library: Shared lib
ii  libusb-0.1-4                 2:0.1.12-15 userspace USB programming library
ii  tcl                          8.4.16-2    The Tool Command Language (default
ii  tcl8.4 [tclsh]               8.4.19-4    Tcl (the Tool Command Language) v8
ii  tcl8.5 [tclsh]               8.5.8-2     Tcl (the Tool Command Language) v8
ii  usb-modeswitch-data          20100418-1  mode switching data for usb-modesw

usb-modeswitch recommends no packages.

Versions of packages usb-modeswitch suggests:
ii  comgt                         0.32-2     Option GlobeTrotter and Vodafone d
ii  wvdial                        1.60.3     PPP dialer with built-in intellige



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to