52 lines
1.7 KiB
Diff
52 lines
1.7 KiB
Diff
|
diff -Nru usb-modeswitch-1.1.9.orig/usb_modeswitch.tcl usb-modeswitch-1.1.9/usb_modeswitch.tcl
|
||
|
--- usb-modeswitch-1.1.9.orig/usb_modeswitch.tcl 2011-08-05 23:40:30.000000000 +0200
|
||
|
+++ usb-modeswitch-1.1.9/usb_modeswitch.tcl 2011-09-28 20:56:40.235554246 +0200
|
||
|
@@ -85,30 +85,35 @@
|
||
|
# providing these attributes - or not. So more probing
|
||
|
# is needed
|
||
|
|
||
|
-if {[string length [lindex $argList 0]] == 0} {
|
||
|
+set devdir ""
|
||
|
+
|
||
|
+if {![string length [lindex $argList 0]] == 0} {
|
||
|
+ set dev_top [lindex $argList 0]
|
||
|
+ if {[regexp {(.*?):} $dev_top d dev_top]} {
|
||
|
+ set devdir /sys/bus/usb/devices/$dev_top
|
||
|
+ }
|
||
|
+}
|
||
|
+
|
||
|
+if {$devdir eq "" || ![file isdirectory $devdir]} {
|
||
|
+ Log "Top sysfs directory not found using bus id or bus id not given ($devdir); trying with kernel name!"
|
||
|
if {[string length [lindex $argList 1]] == 0} {
|
||
|
Log "No device number values given from udev! Exiting"
|
||
|
SafeExit
|
||
|
} else {
|
||
|
- Log "Bus ID for device not given by udev."
|
||
|
Log " Trying to determine it from kernel name ([lindex $argList 1]) ..."
|
||
|
if {![regexp {(.*?):} [lindex $argList 1] d dev_top]} {
|
||
|
Log "Could not determine top device dir from udev values! Exiting"
|
||
|
SafeExit
|
||
|
}
|
||
|
+ set devdir /sys/bus/usb/devices/$dev_top
|
||
|
+ if {![file isdirectory $devdir]} {
|
||
|
+ Log "Top sysfs directory not found ($devdir)! Exiting"
|
||
|
+ SafeExit
|
||
|
+ }
|
||
|
}
|
||
|
-} else {
|
||
|
- set dev_top [lindex $argList 0]
|
||
|
- regexp {(.*?):} $dev_top d dev_top
|
||
|
-}
|
||
|
-
|
||
|
-
|
||
|
-set devdir /sys/bus/usb/devices/$dev_top
|
||
|
-if {![file isdirectory $devdir]} {
|
||
|
- Log "Top sysfs directory not found ($devdir)! Exiting"
|
||
|
- SafeExit
|
||
|
}
|
||
|
|
||
|
+Log "Top sysfs directory found ($devdir)"
|
||
|
|
||
|
# Mapping of the short string identifiers (in the config
|
||
|
# file names) to the long name used here
|