On Sunday 12 June 2011 14:35:55 Didier Raboud wrote: > Le vendredi, 10 juin 2011 18.39:01, Alex Hermann a écrit : > First, let me disagree with the "could not possibly work" because: > 1) I tested this patch and it "worked for me" > 2) I made another user use the code in this patch and it "worked for > him" > (see > https://bugs.launchpad.net/ubuntu/+source/usb-modeswitch-data/+bug/776959 > )
Sorry, i should have explained a bit more about what went wrong exactly. I'll try to do that now. > Second, can you show me a case where the code as shipped in 1.1.7-1 fails ? Just drop in a file in the override dir for a new device. For example attached file. > Now, for your patch (which I am happy to discuss; by the way): > > --- usb_modeswitch_dispatcher.orig 2011-03-16 14:04:26.000000000 +0100 > +++ usb_modeswitch_dispatcher 2011-06-10 18:30:29.000000000 +0200 > @@ -571,10 +571,10 @@ > } > set configList [split $configList \n] > Log "Searching overriding entries named: $settings(dbdir_etc)/$config*" > - append configList [glob -nocomplain $settings(dbdir_etc)/$config*] > + append configList " " [glob -nocomplain -tails > -directory > $settings(dbdir_etc) $config*] > > What does this bring ? If I read it correctly, "my" line appends to the > configList variable the matching "/etc/usb_modeswitch.d/${config}*" > entries, while yours appends only the ${config}* part. I tried both > options and both work identically (because , so I don't see what this > change brings. > > set configList [lsearch -glob -all -inline $configList $config*] > } else { > - set configList [glob -nocomplain > $settings(dbdir)/$config*] > + set configList [glob -nocomplain -tails -directory $settings(dbdir_etc) > $config*] } > > Also I don't understand that change. The idea of the original code is to > look in dbdir (/usr/share/…) iff there is no available tarball: this is > legacy code to support past usb-modeswitch-data versions. Changing that > line to look into dbdir_etc changes the expectations one can have on the > behaviour of usb-modeswitch. Both changes accomplish nearly the same thing. This section of the ConfigGet function (list) is supposed to return a list of all supported devices. In the original version, the entire filename of the override file is appended to the list from the tar.gz, without separator. The list would look like: ... 201e:2009 230d:0001 8888:6500/etc/usb_modeswitch.d/12d1:14fe Then the lsearch function would not find the override file, because the lsearch is looking for just the filename, not the entire path. And because of the missing separator, it would fail anyway. The returned list will be empty. Attachedar a patch adding some logging and a resulting logfile showing the above behaviour. The patch adds a separator and only adds the filename (=usb vendor:product) to the list. Reexamining the codepaths, it seems that overriding a config which is already present in the tar.gz would work, because the original file is correctly put into the list (from the tar.gz, not the override file) and matched. Adding a new device wouldn't work because of the above mentioned reasons. > So all in all, in my humble opinion and under my current understanding, > your patch doesn't do any harm, nor helps. Maybe I overlooked something > and I would be happy to be proven wrong. I hope i have explained the issue a bit better now. -- Alex Hermann SpeakUp BV t: 088-7732587 f: 088-7732588
######################################################## # T-Mobile NL (Huawei E352) DefaultVendor= 0x12d1 DefaultProduct=0x14fe TargetVendor= 0x12d1 TargetProduct= 0x1506 MessageContent="55534243123456780000000000000011062000000100000000000000000000" CheckSuccess=20
--- usb_modeswitch_dispatcher.orig 2011-03-16 14:04:26.000000000 +0100 +++ usb_modeswitch_dispatcher.log 2011-06-14 11:53:49.000000000 +0200 @@ -570,8 +570,10 @@ return {} } set configList [split $configList \n] + Log "1 - $configList" Log "Searching overriding entries named: $settings(dbdir_etc)/$config*" append configList [glob -nocomplain $settings(dbdir_etc)/$config*] + Log "2 - $configList" set configList [lsearch -glob -all -inline $configList $config*] } else { set configList [glob -nocomplain $settings(dbdir)/$config*]
USB_ModeSwitch log from Tue Jun 14 11:58:10 CEST 2011 raw args from udev: /2-1.3:1.0 Using global config file: /etc/usb_modeswitch.conf Bus ID for device not given by udev. Trying to determine it from kernel name (2-1.3:1.0) ... USB dir exists: /sys/bus/usb/devices/2-1.3 Warning: USB attribute "serial" not found. ---------------- USB values from sysfs: manufacturer HUAWEI product HUAWEI Mobile serial ---------------- Found packed config collection /usr/share/usb_modeswitch/configPack.tar.gz 1 - 0421:060c 0421:0610 0421:0622 0421:0627 0471:1210:uMa=Philips 0471:1210:uMa=Wisue 0471:1237 0482:024d 04e8:689a 04e8:f000 057c:84ff 05c6:1000:sVe=Option 05c6:1000:uMa=AnyDATA 05c6:1000:uMa=Option 05c6:1000:uMa=SAMSUNG 05c6:1000:uMa=SSE 05c6:1000:uMa=Vertex 05c6:2000 05c6:2001 05c6:f000 05c7:1000 072f:100d 07d1:a800 0930:0d46 0ace:2011 0ace:20ff 0af0:6711 0af0:6731 0af0:6751 0af0:6771 0af0:6791 0af0:6811 0af0:6911 0af0:6951 0af0:6971 0af0:7011 0af0:7031 0af0:7051 0af0:7071 0af0:7111 0af0:7211 0af0:7251 0af0:7271 0af0:7301 0af0:7311 0af0:7361 0af0:7381 0af0:7401 0af0:7501 0af0:7601 0af0:7701 0af0:7801 0af0:7901 0af0:8200 0af0:8201 0af0:8300 0af0:8302 0af0:8304 0af0:8400 0af0:c031 0af0:c100 0af0:d013 0af0:d031 0af0:d033 0af0:d035 0af0:d055 0af0:d057 0af0:d058 0af0:d155 0af0:d157 0af0:d255 0af0:d257 0af0:d357 0b3c:c700 0b3c:f000 0cf3:20ff 0d46:45a1 0d46:45a5 0e8d:7109 0fce:d0cf 0fce:d0e1 0fce:d103 0fd1:1000 1004:1000 1004:607f 1004:613a 1004:613f 1004:6190 1033:0035 106c:3b03 106c:3b05 106c:3b06 1076:7f40 1199:0fff 1266:1000 12d1:1001 12d1:1003 12d1:1009 12d1:101e 12d1:1031 12d1:1414 12d1:1446 12d1:1449 12d1:14ad 12d1:14c1 12d1:1520 12d1:1521 12d1:1523 12d1:1553 12d1:1557 12d1:1c0b 12d1:1da1 12d1:380b 1410:5010 1410:5020 1410:5030 1410:5031 1410:5041 148f:2578 16d8:6281 16d8:6803 16d8:6803:? 16d8:700a 16d8:f000 198f:bccd 19d2:0003 19d2:0026 19d2:0040 19d2:0053 19d2:0083 19d2:0101 19d2:0103 19d2:0110 19d2:0115 19d2:1001 19d2:1007 19d2:1009 19d2:1013 19d2:2000 19d2:fff5 19d2:fff6 1a8d:1000 1ab7:5700 1b7d:0700 1bbb:f000 1c9e:1001 1c9e:6061 1c9e:9200 1c9e:9e00 1c9e:f000 1dd6:1000 1e0e:f000 1edf:6003 1ee8:0009 1ee8:0013 1ee8:0040 1f28:0021 1fac:0032 1fac:0130 201e:2009 230d:0001 8888:6500 Searching overriding entries named: /etc/usb_modeswitch.d/12d1:14fe* 2 - 0421:060c 0421:0610 0421:0622 0421:0627 0471:1210:uMa=Philips 0471:1210:uMa=Wisue 0471:1237 0482:024d 04e8:689a 04e8:f000 057c:84ff 05c6:1000:sVe=Option 05c6:1000:uMa=AnyDATA 05c6:1000:uMa=Option 05c6:1000:uMa=SAMSUNG 05c6:1000:uMa=SSE 05c6:1000:uMa=Vertex 05c6:2000 05c6:2001 05c6:f000 05c7:1000 072f:100d 07d1:a800 0930:0d46 0ace:2011 0ace:20ff 0af0:6711 0af0:6731 0af0:6751 0af0:6771 0af0:6791 0af0:6811 0af0:6911 0af0:6951 0af0:6971 0af0:7011 0af0:7031 0af0:7051 0af0:7071 0af0:7111 0af0:7211 0af0:7251 0af0:7271 0af0:7301 0af0:7311 0af0:7361 0af0:7381 0af0:7401 0af0:7501 0af0:7601 0af0:7701 0af0:7801 0af0:7901 0af0:8200 0af0:8201 0af0:8300 0af0:8302 0af0:8304 0af0:8400 0af0:c031 0af0:c100 0af0:d013 0af0:d031 0af0:d033 0af0:d035 0af0:d055 0af0:d057 0af0:d058 0af0:d155 0af0:d157 0af0:d255 0af0:d257 0af0:d357 0b3c:c700 0b3c:f000 0cf3:20ff 0d46:45a1 0d46:45a5 0e8d:7109 0fce:d0cf 0fce:d0e1 0fce:d103 0fd1:1000 1004:1000 1004:607f 1004:613a 1004:613f 1004:6190 1033:0035 106c:3b03 106c:3b05 106c:3b06 1076:7f40 1199:0fff 1266:1000 12d1:1001 12d1:1003 12d1:1009 12d1:101e 12d1:1031 12d1:1414 12d1:1446 12d1:1449 12d1:14ad 12d1:14c1 12d1:1520 12d1:1521 12d1:1523 12d1:1553 12d1:1557 12d1:1c0b 12d1:1da1 12d1:380b 1410:5010 1410:5020 1410:5030 1410:5031 1410:5041 148f:2578 16d8:6281 16d8:6803 16d8:6803:? 16d8:700a 16d8:f000 198f:bccd 19d2:0003 19d2:0026 19d2:0040 19d2:0053 19d2:0083 19d2:0101 19d2:0103 19d2:0110 19d2:0115 19d2:1001 19d2:1007 19d2:1009 19d2:1013 19d2:2000 19d2:fff5 19d2:fff6 1a8d:1000 1ab7:5700 1b7d:0700 1bbb:f000 1c9e:1001 1c9e:6061 1c9e:9200 1c9e:9e00 1c9e:f000 1dd6:1000 1e0e:f000 1edf:6003 1ee8:0009 1ee8:0013 1ee8:0040 1f28:0021 1fac:0032 1fac:0130 201e:2009 230d:0001 8888:6500/etc/usb_modeswitch.d/12d1:14fe Aargh! Config file missing for 12d1:14fe! Exiting