Freeze exception for usb-modeswitch{,-data}
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
After a round of RC bugs filing by various people, usb-modeswitch upstream
just released a new version correcting all the actually open bugs against
usb-modeswitch (and its little son u-m-data). In particular, the rewrite
handles #591761 which is severity grave.
For now, I uploaded both usb-modeswitch 1.1.4 and usb-modeswitch-data
20100817 to experimental. Here's their respective changelog entries:
usb-modeswitch (1.1.4-1~exp0) experimental; urgency=high
* New 1.1.4 upstream version; relevant changes:
- The package should work at boot time now (cold and warm);
(Closes: #591765, #591722)
- wrapper fix for the symlink feature: handling of multiple interrupt
ports was incomplete; (Closes: #587776)
- wrapper does not longer use a temporary file for the symlink feature
(security considerations, Marco d'Itri) (Closes: #591761)
- no udev rules grep'ing (Closes: #591760)
* Patches:
+ 01_no_bash_before_tcl.patch : add to avoid one more waiting.
+ 02_mp_correct_hyphens.patch: refresh.
+ 03_use_udev_specifics.patch: avoid code duplication by using udev
specific hotplug functions.
* Set urgency to high as new upstream fixes security bug.
* Correct documentation glitches in debian/README.Debian
(Closes: #590903)
-- Didier Raboud <didier@raboud.com> Tue, 24 Aug 2010 00:07:38 +0200
usb-modeswitch-data (20100817-1~exp0) experimental; urgency=low
* New upstream release
+ New devices
[04e8:689a] Samsung GT-B3730
[12d1:14ad] Vodafone (Huawei) K3806
[19d2:1013] Vodafone (ZTE) K3806-Z
[1c9e:9e00] BSNL Capitel
× Devices updates (see ChangeLog for details)
[05c6:1000] AnyData devices
[19d2:2000] ZTE devices (Closes: #590902)
[1c9e:f000] MobiData MBD-200HU and others
- Update patches.
* Add 02_no_tclsh_overhead.patch to avoid hardcoding tclsh path.
* Bump usb-modeswitch recommend to 1.1.4.
-- Didier Raboud <didier@raboud.com> Tue, 24 Aug 2010 00:23:42 +0200
Both debdiffs are attached. I tested those both as much as I can and I am
very confident about them; IMHO they should replace the 1.1.3 - 20100707
couple in Squeeze.
Thanks in advance for consideration, cheers,
OdyX
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
iJwEAQECAAYFAkxzy4MACgkQKA1Vt+jBwDgIJwP/QskU6JvSuEDAOyvo0AxHawm7
klaM1XOumB7fDbptos3gGBzLrlbhaVx40tTCBene4bCt1XMeqOjQde2uYPXfYVId
gFKfZSDMWFnG0B+6kNTxAIpDFpb7b8p1a5TxOsMIbbuId/EV1enTZ8iOk1ko5JzV
Nkm2Zr6gQDcgA6j7QRA=
=e3WX
-----END PGP SIGNATURE-----
diff -Nru usb-modeswitch-1.1.3/ChangeLog usb-modeswitch-1.1.4/ChangeLog
--- usb-modeswitch-1.1.3/ChangeLog 2010-06-21 21:30:26.000000000 +0200
+++ usb-modeswitch-1.1.4/ChangeLog 2010-08-18 00:20:39.000000000 +0200
@@ -1,7 +1,18 @@
-History of USB-ModeSwitch
+History of USB_ModeSwitch
=========================
+Version 1.1.4, 2010/08/17
+ The package should work at boot time now (cold and warm);
+ product IDs of "0000" do exist but were not accepted, fixed (thanks to
+ Sakis Dimopoulos); response endpoint is now always detected (led to
+ possible error report when resetting all endpoints in version 1.1.3);
+ wrapper script can now work with a packed collection of config files as
+ well as with the plain folder of files; use with the "install-packed"
+ make target of the data package (for use on systems with resource
+ constraints); wrapper fix for the symlink feature: handling of multiple
+ interrupt ports was incomplete; wrapper does not longer use a temporary
+ file for the symlink feature (security considerations, Marco d'Itri)
Version 1.1.3, 2010/06/21
Added delay option to separate multiple message transfers by millisecs;
fixed (possibly dangerous) sloppy string handling (thanks to Christophe
diff -Nru usb-modeswitch-1.1.3/debian/changelog usb-modeswitch-1.1.4/debian/changelog
--- usb-modeswitch-1.1.3/debian/changelog 2010-06-23 10:43:55.000000000 +0200
+++ usb-modeswitch-1.1.4/debian/changelog 2010-08-24 00:08:28.000000000 +0200
@@ -1,3 +1,27 @@
+usb-modeswitch (1.1.4-1~exp0) experimental; urgency=high
+
+ * New 1.1.4 upstream version; relevant changes:
+ - The package should work at boot time now (cold and warm);
+ (Closes: #591765, #591722)
+ - wrapper fix for the symlink feature: handling of multiple interrupt
+ ports was incomplete; (Closes: #587776)
+ - wrapper does not longer use a temporary file for the symlink feature
+ (security considerations, Marco d'Itri) (Closes: #591761)
+ - no udev rules grep'ing (Closes: #591760)
+
+ * Patches:
+ + 01_no_bash_before_tcl.patch : add to avoid one more waiting.
+ + 02_mp_correct_hyphens.patch: refresh.
+ + 03_use_udev_specifics.patch: avoid code duplication by using udev
+ specific hotplug functions.
+
+ * Set urgency to high as new upstream fixes security bug.
+
+ * Correct documentation glitches in debian/README.Debian
+ (Closes: #590903)
+
+ -- Didier Raboud <didier@raboud.com> Tue, 24 Aug 2010 00:07:38 +0200
+
usb-modeswitch (1.1.3-1) unstable; urgency=low
* New 1.1.3 upstream version; relevant changes:
diff -Nru usb-modeswitch-1.1.3/debian/patches/01_no_bash_before_tcl.patch usb-modeswitch-1.1.4/debian/patches/01_no_bash_before_tcl.patch
--- usb-modeswitch-1.1.3/debian/patches/01_no_bash_before_tcl.patch 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-1.1.4/debian/patches/01_no_bash_before_tcl.patch 2010-08-18 10:11:47.000000000 +0200
@@ -0,0 +1,31 @@
+Description: Avoid to wait once more on /usr/bin/tclsh: its presence is
+ guaranteed by Depends in the package and /usr/bin/env can only be launched
+ when /usr is present.
+Author: Didier Raboud <didier@raboud.com>
+Origin: vendor
+Last-Update: 2010-08-18
+Index: usb-modeswitch/usb_modeswitch.tcl
+===================================================================
+--- usb-modeswitch.orig/usb_modeswitch.tcl 2010-08-18 09:58:56.000000000 +0200
++++ usb-modeswitch/usb_modeswitch.tcl 2010-08-18 09:59:15.000000000 +0200
+@@ -1,19 +1,4 @@
+-#!/bin/sh
+-# next lines for bash, ignored by tclsh, restarting in background \
+-( \
+-count=120; \
+-while [ $count != 0 ]; do \
+- if [ ! -e "/usr/bin/tclsh" ]; then \
+- sleep 1; \
+- count=$(($count - 1)); \
+- else \
+- exec /usr/bin/tclsh "$0" "$@" 2>/dev/null & \
+- exit 0; \
+- fi; \
+-done; \
+-) & \
+-exit 0
+-
++#!/usr/bin/env tclsh
+
+ # Wrapper (tcl) for usb_modeswitch, called from
+ # /lib/udev/rules.d/40-usb_modeswitch.rules
diff -Nru usb-modeswitch-1.1.3/debian/patches/02_mp_correct_hyphens.patch usb-modeswitch-1.1.4/debian/patches/02_mp_correct_hyphens.patch
--- usb-modeswitch-1.1.3/debian/patches/02_mp_correct_hyphens.patch 2010-06-23 10:09:02.000000000 +0200
+++ usb-modeswitch-1.1.4/debian/patches/02_mp_correct_hyphens.patch 2010-08-18 10:08:39.000000000 +0200
@@ -5,8 +5,8 @@
Last-Update: 2010-06-23
Index: usb-modeswitch/usb_modeswitch.1
===================================================================
---- usb-modeswitch.orig/usb_modeswitch.1 2010-06-23 10:06:44.000000000 +0200
-+++ usb-modeswitch/usb_modeswitch.1 2010-06-23 10:08:29.000000000 +0200
+--- usb-modeswitch.orig/usb_modeswitch.1 2010-08-18 09:41:41.000000000 +0200
++++ usb-modeswitch/usb_modeswitch.1 2010-08-18 09:48:16.000000000 +0200
@@ -3,7 +3,7 @@
usb_modeswitch - switch mode of "multi-state" USB devices
.SH "SYNOPSIS"
@@ -26,7 +26,7 @@
.IP "\fB-P\fP \fB\-\-target-product NUM\fP " 10
Target product ID
@@ -75,7 +75,7 @@
- with \fB\-2\fR and \fB\-3\fR, this must be set to avoid transfer errors
+ with \fB\-2\fR and \fB\-3\fR, this may need to be set to avoid transfer errors
.IP "\fB-r\fP \fB\-\-response-endpoint NUM\fP " 10
Try to read the response to a storage command from there
-if option -n is active. Only for testing purposes; usually
diff -Nru usb-modeswitch-1.1.3/debian/patches/03_use_udev_specifics.patch usb-modeswitch-1.1.4/debian/patches/03_use_udev_specifics.patch
--- usb-modeswitch-1.1.3/debian/patches/03_use_udev_specifics.patch 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-1.1.4/debian/patches/03_use_udev_specifics.patch 2010-08-18 10:18:31.000000000 +0200
@@ -0,0 +1,29 @@
+Description: Use udev-in-Debian specific tools for the waiting script
+ This is inspired from alsa-utils'
+Author: Didier Raboud <didier@raboud.com>
+Origin: vendor
+Last-Update: 2010-08-18
+Index: usb-modeswitch/usb_modeswitch.sh
+===================================================================
+--- usb-modeswitch.orig/usb_modeswitch.sh 2010-08-18 10:15:16.000000000 +0200
++++ usb-modeswitch/usb_modeswitch.sh 2010-08-18 10:17:08.000000000 +0200
+@@ -1,13 +1,8 @@
+-#!/bin/sh
++#!/bin/sh -e
++#
++# udev script for usb-modeswitch
+ (
+-count=120
+-while [ $count != 0 ]; do
+- if [ ! -e "/usr/bin/tclsh" ]; then
+- sleep 1
+- count=$(($count - 1))
+- else
+- exec /usr/bin/tclsh /usr/sbin/usb_modeswitch_dispatcher "$@" 2>/dev/null &
+- exit 0
+- fi
+-done
++ . /lib/udev/hotplug.functions
++ wait_for_file /usr/sbin/usb_modeswitch_dispatcher
++ exec /usr/sbin/usb_modeswitch_dispatcher "$@" 2>/dev/null &
+ ) &
diff -Nru usb-modeswitch-1.1.3/debian/patches/series usb-modeswitch-1.1.4/debian/patches/series
--- usb-modeswitch-1.1.3/debian/patches/series 2010-06-23 09:43:15.000000000 +0200
+++ usb-modeswitch-1.1.4/debian/patches/series 2010-08-18 10:15:11.000000000 +0200
@@ -1 +1,3 @@
+01_no_bash_before_tcl.patch
02_mp_correct_hyphens.patch
+03_use_udev_specifics.patch
diff -Nru usb-modeswitch-1.1.3/debian/README.Debian usb-modeswitch-1.1.4/debian/README.Debian
--- usb-modeswitch-1.1.3/debian/README.Debian 2010-06-23 09:24:23.000000000 +0200
+++ usb-modeswitch-1.1.4/debian/README.Debian 2010-08-12 21:14:46.000000000 +0200
@@ -4,9 +4,9 @@
In Debian, usb-modeswitch is supposed to work automagically for all devices
known to work :
- /lib/udev/rules.d/80-usb_modeswitch is a udev rules file provided by
- usb-modeswitch-data. Along with the scripts in /usr/share/usb_modeswitch
- and the usb_modeswitch binary, it should trigger the flip-flop switch
+ /lib/udev/rules.d/40-usb_modeswitch.rules is a udev rules file provided by
+ usb-modeswitch-data. Along with the /lib/udev/usb_modeswitch and the
+ /usr/sbin/usb_modeswitch binary, it should trigger the flip-flop switch
when the device is plugged in.
If this method doesn't work, please go to usb_modeswitch homepage:
diff -Nru usb-modeswitch-1.1.3/debian/usb-modeswitch.install usb-modeswitch-1.1.4/debian/usb-modeswitch.install
--- usb-modeswitch-1.1.3/debian/usb-modeswitch.install 2010-06-23 09:24:23.000000000 +0200
+++ usb-modeswitch-1.1.4/debian/usb-modeswitch.install 2010-08-18 10:13:06.000000000 +0200
@@ -1,4 +1,5 @@
usr/sbin/usb_modeswitch
+usr/sbin/usb_modeswitch_dispatcher
lib/udev/usb_modeswitch
usr/share/man/*
etc/usb_modeswitch.conf
diff -Nru usb-modeswitch-1.1.3/debian/usb-modeswitch.lintian-overrides usb-modeswitch-1.1.4/debian/usb-modeswitch.lintian-overrides
--- usb-modeswitch-1.1.3/debian/usb-modeswitch.lintian-overrides 2010-06-23 09:24:23.000000000 +0200
+++ usb-modeswitch-1.1.4/debian/usb-modeswitch.lintian-overrides 1970-01-01 01:00:00.000000000 +0100
@@ -1,2 +0,0 @@
-# This script is a polyglot sh-tclsh script that works with a special quirk
-usb-modeswitch: shell-script-fails-syntax-check ./lib/udev/usb_modeswitch
diff -Nru usb-modeswitch-1.1.3/device_reference.txt usb-modeswitch-1.1.4/device_reference.txt
--- usb-modeswitch-1.1.3/device_reference.txt 2010-06-21 21:37:42.000000000 +0200
+++ usb-modeswitch-1.1.4/device_reference.txt 2010-08-18 00:19:31.000000000 +0200
@@ -1,6 +1,6 @@
# Device and Configuration Reference
#
-# Last modified: 2010-06-21
+# Last modified: 2010-07-07
#
# Collection of configurations for usb_modeswitch, a mode switching
# tool for controlling flip flop (multiple mode) USB devices
@@ -9,7 +9,7 @@
# http://www.draisberghof.de/usb_modeswitch
#
# You may want to check for a newer version of this file at:
-# http://www.draisberghof.de/usb_modeswitch/usb_modeswitch.setup
+# http://www.draisberghof.de/usb_modeswitch/device_reference.txt
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@@ -440,7 +440,7 @@
#
# Probably works with DetachStorageOnly too
#
-# Contributor: Flávio Moringa and others
+# Contributor: Flávio Moringa and others
;DefaultVendor= 0x19d2
;DefaultProduct= 0x2000
@@ -448,8 +448,8 @@
;TargetVendor= 0x19d2
;TargetProductList="0001"
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="55534243876543212000000080000c85010101180101010101000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -465,8 +465,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0002
-;MessageContent="5553424312345678240000008000061b000000020000000000000000000000"
-;MessageContent2="55534243f8f993882000000080000a85010101180101010101000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -488,8 +488,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0015
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="55534243876543212000000080000a85010101180101010101000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -519,8 +519,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0031
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="5553424312345678000000000000061b000000030000000000000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -536,8 +536,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0037
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="55534243876543212000000080000c85010101180101010101000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -604,8 +604,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0052
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="55534243876543212000000080000c85010101180101010101000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -621,8 +621,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0002
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="55534243876543212000000080000a85010101180101010101000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -638,8 +638,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0002
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="55534243876543210000010080000a28000000001c00002000000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -931,7 +931,7 @@
#
# Recommended init command: ATE0V1&D2&C1S0=0
#
-# Contributor: Jérôme Oufella
+# Contributor: Jérôme Oufella
;DefaultVendor= 0x1004
;DefaultProduct= 0x1000
@@ -1094,8 +1094,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0055
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
-;MessageContent2="55534243876543212000000080000c85010101180101010101000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -1207,7 +1207,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0063
-;MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -1455,7 +1456,8 @@
;TargetVendor= 0x19d2
;TargetProduct= 0x0094
-;MessageContent="5553424312345678240000008000061b000000020000000000000000000000"
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
;NeedResponse=1
@@ -1544,6 +1546,27 @@
########################################################
+# Vodafone (ZTE) K3805-Z
+#
+# Contributor: Betavine Project
+#
+# Note:
+# This device has multiple USB profiles. Depending upon how it is flipped
+# from storage mode to modem mode determines its final PID and the packages
+# shown on its ISO CD image.
+
+DefaultVendor= 0x19d2
+DefaultProduct=0x1001
+
+TargetVendor= 0x19d2
+TargetProduct= 0x1003
+
+MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
+
+NeedResponse=1
+
+
+########################################################
# Franklin Wireless U210
#
# Contributor: Adam J. Porter
@@ -1593,7 +1616,7 @@
########################################################
# Olivetti Olicard 100 and others
#
-# Contributor: Nils Radke
+# Contributor: Nils Radtke
;DefaultVendor= 0x0b3c
;DefaultProduct= 0xc700
@@ -1723,3 +1746,146 @@
;NeedResponse=1
+########################################################
+# Vodafone (Huawei) K4605
+#
+# Contributor: Betavine Project
+
+DefaultVendor= 0x12d1
+DefaultProduct=0x14c1
+
+TargetVendor= 0x12d1
+TargetProduct= 0x14c6
+
+CheckSuccess=20
+
+MessageContent="55534243123456780000000000000011060000000000000000000000000000"
+
+
+########################################################
+# Huawei R201
+#
+# Contributor: Betavine Project
+
+DefaultVendor= 0x12d1
+DefaultProduct=0x1523
+
+TargetVendor= 0x12d1
+TargetProduct= 0x1491
+
+CheckSuccess=20
+
+MessageContent="55534243123456780000000000000011060000000000000000000000000000"
+
+
+########################################################
+# Atheros Wireless / Netgear WNDA3200
+#
+# Contributor: Sujith Manoharan (Atheros)
+
+DefaultVendor= 0x0cf3
+DefaultProduct=0x20ff
+
+TargetVendor= 0x0cf3
+TargetProduct= 0x7010
+
+CheckSuccess=10
+NoDriverLoading=1
+
+MessageContent="5553424329000000000000000000061b000000020000000000000000000000"
+NeedResponse=1
+
+
+########################################################
+# Onda MW833UP
+#
+# Contributor: Riccardo Sepe aka zeroidle
+
+DefaultVendor= 0x1ee8
+DefaultProduct=0x0013
+
+TargetVendor= 0x1ee8
+TargetProduct= 0x0012
+
+CheckSuccess=20
+
+MessageContent="555342431234567800000000000010ff000000000000000000000000000000"
+ResponseNeeded=1
+
+
+########################################################
+# Huawei U8110 (Android smartphone)
+#
+# Contributor: David Erosa GarcÃa
+
+DefaultVendor= 0x12d1
+DefaultProduct=0x1031
+
+TargetVendor= 0x12d1
+TargetProduct= 0x1035
+
+CheckSuccess=20
+
+MessageContent="55534243123456780600000080010a11060000000000000000000000000000"
+
+# for Android SDK
+NoDriverLoading=1
+
+
+########################################################
+# Nokia CS-10
+#
+# Contributor: WacÅ?aw Sierek
+
+DefaultVendor= 0x0421
+DefaultProduct=0x060c
+
+TargetVendor= 0x0421
+TargetProduct= 0x060e
+
+CheckSuccess=20
+
+MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
+
+
+########################################################
+# ZTE WCDMA Stick from BNSL
+#
+# Contributor: Anoop John
+
+;DefaultVendor= 0x19d2
+;DefaultProduct= 0x2000
+
+;TargetVendor= 0x19d2
+;TargetProduct= 0x0108
+
+;MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+;MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
+
+;NeedResponse=1
+
+
+########################################################
+# BSNL Capitel
+
+;DefaultVendor= 0x1c9e
+;DefaultProduct= 0x9e00
+
+;TargetClass=0xff
+
+;MessageContent="55534243123456780000000000000606f50402527000000000000000000000"
+
+
+#######################################################
+# Samsung GT-B3730
+#
+# Contributor: Per Ã?yvind Karlsen
+
+;DefaultVendor= 0x04e8
+;DefaultProduct=0x689a
+
+;TargetVendor= 0x04e8
+;TargetProduct= 0x6889
+
+;MessageContent="55534243785634120100000080000601000000000000000000000000000000"
+
diff -Nru usb-modeswitch-1.1.3/Makefile usb-modeswitch-1.1.4/Makefile
--- usb-modeswitch-1.1.3/Makefile 2010-06-21 21:27:29.000000000 +0200
+++ usb-modeswitch-1.1.4/Makefile 2010-08-17 19:15:53.000000000 +0200
@@ -1,7 +1,8 @@
PROG = usb_modeswitch
-VERS = 1.1.3
+VERS = 1.1.4
CC = gcc
-CFLAGS += -Wall -l usb
+CFLAGS += -Wall
+LIBS = -l usb
RM = /bin/rm -f
OBJS = usb_modeswitch.c
PREFIX = $(DESTDIR)/usr
@@ -15,14 +16,15 @@
all: $(PROG)
$(PROG): $(OBJS)
- $(CC) -o $(PROG) $(OBJS) $(CFLAGS) $(LDFLAGS)
+ $(CC) -o $(PROG) $(OBJS) $(CFLAGS) $(LIBS) $(LDFLAGS)
clean:
$(RM) usb_modeswitch
install: all
install -D --mode=755 usb_modeswitch $(SBINDIR)/usb_modeswitch
- install -D --mode=755 usb_modeswitch.tcl $(UDEVDIR)/usb_modeswitch
+ install -D --mode=755 usb_modeswitch.tcl $(SBINDIR)/usb_modeswitch_dispatcher
+ install -D --mode=755 usb_modeswitch.sh $(UDEVDIR)/usb_modeswitch
install -D --mode=644 usb_modeswitch.conf $(ETCDIR)/usb_modeswitch.conf
install -D --mode=644 usb_modeswitch.1 $(MANDIR)/usb_modeswitch.1
diff -Nru usb-modeswitch-1.1.3/README usb-modeswitch-1.1.4/README
--- usb-modeswitch-1.1.3/README 2010-06-21 21:41:49.000000000 +0200
+++ usb-modeswitch-1.1.4/README 2010-08-18 00:07:34.000000000 +0200
@@ -31,7 +31,7 @@
driver, to isolate the command or action that does the switching, and to replay
the same thing with Linux.
-USB-ModeSwitch eases the pain considerably by taking just the important para-
+USB_ModeSwitch eases the pain considerably by taking just the important para-
meters from a configuration file and doing all the initialization and communi-
cation stuff, with heavy help from "libusb".
It is mainly used automatically - via udev events and rules - to do the switch
@@ -60,7 +60,8 @@
> make install
-This installs a wrapper script, a global config file, the binary and a man page.
+This installs a small shell script, a dispatcher (wrapper) script, a global
+config file, the binary and a man page.
Install the data package as well, and you are set already; if your device is
known, you should be able to just plug it and use it. If it doesn't work we'll
@@ -75,7 +76,7 @@
use it as a base to create your own configuration file.
It's heavily commented and should tell you what to do.
-Run "usb-modeswitch -h" to list the command line parameters. If any of them
+Run "usb_modeswitch -h" to list the command line parameters. If any of them
except -W and -q are used, the default config file in /etc is NOT read.
See also the provided man page.
@@ -85,7 +86,7 @@
Note: manual use is intended for testing and analyzing !
Once your new device is switching fine you can add a rule entry to the rules
-file to let udev run usb-modeswitch as soon as the default IDs are found
+file to let udev run usb_modeswitch as soon as the default IDs are found
(when the device is plugged). Then add your new setup file to
"/etc/usb_modeswitch.d". But don't forget to report your success !!
@@ -106,7 +107,7 @@
Contribute
==========
-USB-ModeSwitch comes quite handy for experimenting with your own hardware if
+USB_ModeSwitch comes quite handy for experimenting with your own hardware if
not supported yet. You could try this approach:
Note the device's Vendor and Product ID from /proc/bus/usb/devices (or from the
@@ -157,6 +158,7 @@
Sakis Dimopoulos
Steven Fernandez
Christophe Fergeau
+ Nils Radtke
Device information contributors are named in the "device_reference.txt" file.
@@ -180,4 +182,4 @@
-Last revised: 2010-06-21, Josua Dietze
+Last revised: 2010-08-17, Josua Dietze
diff -Nru usb-modeswitch-1.1.3/usb_modeswitch.1 usb-modeswitch-1.1.4/usb_modeswitch.1
--- usb-modeswitch-1.1.3/usb_modeswitch.1 2010-06-21 21:10:29.000000000 +0200
+++ usb-modeswitch-1.1.4/usb_modeswitch.1 2010-08-17 20:17:14.000000000 +0200
@@ -1,4 +1,4 @@
-.TH "USB-MODESWITCH" "1"
+.TH "USB_MODESWITCH" "1"
.SH "NAME"
usb_modeswitch - switch mode of "multi-state" USB devices
.SH "SYNOPSIS"
@@ -72,7 +72,7 @@
transfer.
Some devices have trouble switching if the response is not read; most
are disappearing right away. When sending multiple mass storage commands
-with \fB\-2\fR and \fB\-3\fR, this must be set to avoid transfer errors
+with \fB\-2\fR and \fB\-3\fR, this may need to be set to avoid transfer errors
.IP "\fB-r\fP \fB\-\-response-endpoint NUM\fP " 10
Try to read the response to a storage command from there
if option -n is active. Only for testing purposes; usually
diff -Nru usb-modeswitch-1.1.3/usb_modeswitch.c usb-modeswitch-1.1.4/usb_modeswitch.c
--- usb-modeswitch-1.1.3/usb_modeswitch.c 2010-06-21 19:18:00.000000000 +0200
+++ usb-modeswitch-1.1.4/usb_modeswitch.c 2010-08-17 20:54:33.000000000 +0200
@@ -1,6 +1,6 @@
/*
Mode switching tool for controlling flip flop (multiple device) USB gear
- Version 1.1.3, 2010/06/21
+ Version 1.1.4, 2010/08/21
Copyright (C) 2007, 2008, 2009, 2010 Josua Dietze (mail to "usb_admin" at the
domain from the README; please do not post the complete address to the Net!
@@ -42,7 +42,7 @@
/* Recommended tab size: 4 */
-#define VERSION "1.1.3"
+#define VERSION "1.1.4"
#include <stdio.h>
#include <stdlib.h>
@@ -95,7 +95,7 @@
char ByteString[LINE_DIM/2];
char buffer[BUF_SIZE];
-// Settable Interface and Configuration (for debugging mostly) (jmw)
+/* Settable Interface and Configuration (for debugging mostly) (jmw) */
int Interface = 0, Configuration = -1, AltSetting = -1;
@@ -120,7 +120,7 @@
{"gct-mode", no_argument, 0, 'G'},
{"need-response", no_argument, 0, 'n'},
{"reset-usb", no_argument, 0, 'R'},
- {"config", required_argument, 0, 'c'},
+ {"config-file", required_argument, 0, 'c'},
{"verbose", no_argument, 0, 'W'},
{"quiet", no_argument, 0, 'Q'},
{"sysmode", no_argument, 0, 'D'},
@@ -162,9 +162,12 @@
ParseParamHex(configFilename, Configuration);
ParseParamHex(configFilename, AltSetting);
- // TargetProductList has priority over TargetProduct
+ /* TargetProductList has priority over TargetProduct */
if (strlen(TargetProductList))
+ {
TargetProduct = 0;
+ SHOW_PROGRESS("Warning: TargetProductList overrides TargetProduct!\n");
+ }
config_read = 1;
}
@@ -202,10 +205,7 @@
printf ("MessageEndpoint=0x%02x\n", MessageEndpoint);
else
printf ("MessageEndpoint= not set\n");
-// if ( strlen(MessageContent) )
printf ("MessageContent=\"%s\"\n", MessageContent);
-// else
-// printf ("MessageContent= not set\n");
if ( strlen(MessageContent2) )
printf ("MessageContent2=\"%s\"\n", MessageContent2);
if ( strlen(MessageContent3) )
@@ -239,11 +239,10 @@
int readArguments(int argc, char **argv)
{
int c, option_index = 0, count=0;
-// if (argc==1)
-// return 0;
if (argc==1)
{
printHelp();
+ printVersion();
exit(1);
}
@@ -297,7 +296,7 @@
exit(0);
break;
- default: //Unsupported - error message has already been printed
+ default: /* Unsupported - error message has already been printed */
printf ("\n");
printHelp();
exit(1);
@@ -312,7 +311,7 @@
{
int numDefaults = 0, specialMode = 0, sonySuccess = 0;
- // Make sure we have an empty string even if not set by config
+ /* Make sure we have empty strings even if not set by config */
TargetProductList[0] = '\0';
MessageContent[0] = '\0';
MessageContent2[0] = '\0';
@@ -324,13 +323,12 @@
* Parameter parsing, USB preparation/diagnosis, plausibility checks
*/
- // Check command arguments, use params instead of config file when given
+ /* Check command arguments, use params instead of config file when given */
switch (readArguments(argc, argv)) {
- case 0: // no argument or -W, -q or -s
-// readConfigFile("/etc/usb_modeswitch.setup");
+ case 0: /* no argument or -W, -q or -s */
break;
- default: // one or more arguments except -W, -q or -s
- if (!config_read) // if arguments contain -c, the config file was already processed
+ default: /* one or more arguments except -W, -q or -s */
+ if (!config_read) /* if arguments contain -c, the config file was already processed */
if (verbose) printf("Taking all parameters from the command line\n\n");
}
@@ -340,7 +338,7 @@
if (verbose)
printConfig();
- // libusb initialization
+ /* libusb initialization */
usb_init();
if (verbose)
@@ -349,7 +347,7 @@
usb_find_busses();
usb_find_devices();
- // Plausibility checks. The default IDs are mandatory
+ /* Plausibility checks. The default IDs are mandatory */
if (!(DefaultVendor && DefaultProduct)) {
SHOW_PROGRESS("No default vendor/product ID given. Aborting.\n\n");
exit(1);
@@ -370,7 +368,7 @@
if (CheckSuccess && !(TargetVendor || TargetProduct || strlen(TargetProductList)) && !TargetClass)
printf("Note: target parameter missing; success check limited\n");
- // Count existing target devices (remember for success check)
+ /* Count existing target devices, remember for success check */
if (TargetVendor || TargetClass) {
SHOW_PROGRESS("Looking for target devices ...\n");
search_devices(&targetDeviceCount, TargetVendor, TargetProduct, TargetProductList, TargetClass, SEARCH_TARGET);
@@ -380,7 +378,7 @@
SHOW_PROGRESS(" No devices in target mode or class found\n");
}
- // Count default devices, return the last one found
+ /* Count default devices, get the last one found */
SHOW_PROGRESS("Looking for default devices ...\n");
dev = search_devices(&numDefaults, DefaultVendor, DefaultProduct, "\0", TargetClass, SEARCH_DEFAULT);
if (numDefaults) {
@@ -399,32 +397,34 @@
exit(0);
}
- // Get class of default device
+ /* Get class of default device/interface */
defaultClass = dev->descriptor.bDeviceClass;
if (defaultClass == 0)
defaultClass = dev->config[0].interface[0].altsetting[0].bInterfaceClass;
else
if (dev->config[0].interface[0].altsetting[0].bInterfaceClass == 8 && defaultClass != 8) {
- // Weird device with default class other than 0 and differing interface class
- SHOW_PROGRESS("Ambiguous Class/InterfaceClass: 0x%02x/0x08", defaultClass);
+ /* Weird device with default class other than 0 and differing interface class */
+ SHOW_PROGRESS("Ambiguous Class/InterfaceClass: 0x%02x/0x08\n", defaultClass);
defaultClass = 8;
}
- // Check or get endpoints if needed
- if (!MessageEndpoint && (strlen(MessageContent) || InquireDevice) ) {
- MessageEndpoint = find_first_bulk_output_endpoint(dev);
- if (!MessageEndpoint && strlen(MessageContent)) {
+ /* Check or get endpoints */
+ if (strlen(MessageContent) || InquireDevice) {
+ if (!MessageEndpoint)
+ MessageEndpoint = find_first_bulk_output_endpoint(dev);
+ if (!MessageEndpoint) {
fprintf(stderr,"Error: message endpoint not given or found. Aborting.\n\n");
exit(1);
}
- }
- if (!ResponseEndpoint && (NeedResponse || InquireDevice) ) {
- ResponseEndpoint = find_first_bulk_input_endpoint(dev);
- if (!ResponseEndpoint && NeedResponse) {
+ if (!ResponseEndpoint)
+ ResponseEndpoint = find_first_bulk_input_endpoint(dev);
+ if (!ResponseEndpoint) {
fprintf(stderr,"Error: response endpoint not given or found. Aborting.\n\n");
exit(1);
}
+ SHOW_PROGRESS("Using endpoints 0x%02x (out) and 0x%02x (in)\n", MessageEndpoint, ResponseEndpoint);
}
+
if (MessageEndpoint && ResponseEndpoint) {
SHOW_PROGRESS("Using endpoints 0x%02x (out) and 0x%02x (in)\n", MessageEndpoint, ResponseEndpoint);
} else
@@ -453,7 +453,7 @@
printf("-------------------------\n");
}
- // Some scenarios are exclusive, so check for unwanted combinations
+ /* Some scenarios are exclusive, so check for unwanted combinations */
specialMode = DetachStorageOnly + HuaweiMode + SierraMode + SonyMode;
if ( specialMode > 1 ) {
SHOW_PROGRESS("Invalid mode combination. Check your configuration. Aborting.\n\n");
@@ -496,7 +496,7 @@
if (SonyMode) {
if (CheckSuccess)
SHOW_PROGRESS("Note: ignoring CheckSuccess. Separate checks for Sony mode\n");
- CheckSuccess = 0; // separate and implied success control
+ CheckSuccess = 0; /* separate and implied success control */
sonySuccess = switchSonyMode();
}
@@ -537,7 +537,7 @@
if (sonySuccess) {
if (sysmode) {
syslog(LOG_NOTICE, "switched S.E. MD400 to modem mode");
- printf("ok:\n"); // ACM device, no driver action
+ printf("ok:\n"); /* ACM device, no driver action */
}
SHOW_PROGRESS("-> device should be stable now. Bye.\n\n");
} else {
@@ -698,6 +698,7 @@
{
int ret;
+ /* May be activated in future versions */
// if (MessageContent2[0] != '\0' || MessageContent3[0] != '\0')
// NeedResponse = 1;
@@ -767,16 +768,14 @@
}
}
- SHOW_PROGRESS("Resetting response endpoint 0x%02x\n", ResponseEndpoint);
+ SHOW_PROGRESS("Resetting response endpoint 0x%02x\n", ResponseEndpoint);
ret = usb_clear_halt(devh, ResponseEndpoint);
if (ret)
SHOW_PROGRESS(" Error resetting endpoint: %d\n", ret);
-// goto skip;
SHOW_PROGRESS("Resetting message endpoint 0x%02x\n", MessageEndpoint);
ret = usb_clear_halt(devh, MessageEndpoint);
if (ret)
SHOW_PROGRESS(" Error resetting endpoint: %d\n", ret);
-// goto skip;
ret = usb_release_interface(devh, Interface);
if (ret)
goto skip;
@@ -937,7 +936,9 @@
}
-// Detach driver either as the main action or as preparation for other modes
+/* Detach driver either as the main action or as preparation for other
+ * switching methods
+ */
int detachDriver()
{
int ret;
@@ -1004,8 +1005,9 @@
SHOW_PROGRESS("\nChecking for mode switch (max. %d times, once per second) ...\n", CheckSuccess);
sleep(1);
- // if target ID is not given but target class is, assign default as target;
- // it will be needed for sysmode output
+ /* if target ID is not given but target class is, assign default as target;
+ * it will be needed for sysmode output
+ */
if (!TargetVendor && TargetClass) {
TargetVendor = DefaultVendor;
TargetProduct = DefaultProduct;
@@ -1014,8 +1016,9 @@
if (devh) // devh is 0 if device vanished during command transmission
for (i=0; i < CheckSuccess; i++) {
- // Test if default device still can be accessed; positive result does
- // not necessarily mean failure
+ /* Test if default device still can be accessed; positive result does
+ * not necessarily mean failure
+ */
SHOW_PROGRESS(" Waiting for original device to vanish ...\n");
ret = usb_claim_interface(devh, Interface);
@@ -1040,9 +1043,10 @@
if ( TargetVendor && (TargetProduct || strlen(TargetProductList)) )
- // Recount target devices (compare with previous count) if target data is given.
- // Target device on the same bus with higher device number is returned,
- // description is read for syslog message
+ /* Recount target devices (compare with previous count) if target data is given.
+ * Target device on the same bus with higher device number is returned,
+ * description is read for syslog message
+ */
for (i=i; i < CheckSuccess; i++) {
SHOW_PROGRESS(" Searching for target devices ...\n");
usb_find_devices();
@@ -1072,7 +1076,7 @@
sleep(1);
}
else
- // No target data given, rely on the vanished device
+ /* No target data given, rely on the vanished device */
if (!devh) {
SHOW_PROGRESS(" (For a better success check provide target IDs or class)\n");
SHOW_PROGRESS(" Original device vanished after switching\n\nMode switch most likely succeeded. Bye.\n\n");
@@ -1143,8 +1147,9 @@
}
-// iterates over busses and devices, counts the ones found and returns the last one of them
-
+/* Iterates over busses and devices, counts the ones with the given
+ * ID/class and returns the last one of them
+*/
struct usb_device* search_devices( int *numFound, int vendor, int product, char* productList, int targetClass, int mode)
{
struct usb_bus *bus;
@@ -1152,14 +1157,14 @@
int devClass;
struct usb_device* right_dev = NULL;
- // only target class given
+ /* only target class given, target vendor and product assumed unchanged */
if ( targetClass && !(vendor || product) ) {
vendor = DefaultVendor;
product = DefaultProduct;
}
*numFound = 0;
- // sanity check
+ /* Sanity check */
if (!vendor || (!product && productList == '\0') )
return NULL;
@@ -1209,7 +1214,7 @@
NextToken:
token = strtok(NULL, ",");
}
- // product is given
+ /* Product ID is given */
} else
if (product == dev->descriptor.idProduct) {
if (verbose)
@@ -1224,7 +1229,7 @@
if (devClass == 0)
devClass = dev->config[0].interface[0].altsetting[0].bInterfaceClass;
else
- // Check for some quirky devices
+ /* Check for some quirky devices */
if (devClass != dev->config[0].interface[0].altsetting[0].bInterfaceClass)
devClass = dev->config[0].interface[0].altsetting[0].bInterfaceClass;
if (devClass == targetClass) {
@@ -1249,8 +1254,9 @@
}
}
}
- // dirty hack: if busnum has other than init value, we're at
- // success checking and probe for plausible new devnum/busnum
+ /* hack: if busnum has other than init value, we are called from
+ * successCheck() and do probe for plausible new devnum/busnum
+ */
if (busnum != -1)
if (dev->devnum < devnum || (int)strtol(dev->bus->dirname,NULL,10) != busnum) {
if (verbose)
@@ -1269,7 +1275,7 @@
#define USB_DIR_OUT 0x00
#define USB_DIR_IN 0x80
-// Autodetect bulk endpoints (ab)
+/* Autodetect bulk endpoints (ab) */
int find_first_bulk_output_endpoint(struct usb_device *dev)
{
@@ -1308,7 +1314,7 @@
-// the parameter parsing stuff
+/* Parameter parsing */
char* ReadParseParam(const char* FileName, char *VariableName)
{
@@ -1357,7 +1363,6 @@
if (P1!=NULL) *P1='\0';
else if (P2!=NULL) *P2='\0';
VarName=Str+Pos;
- //while (strspn(VarName, " \t")==strlen(VarName)) VarName++;
Pos=strspn (Equal, " \t");
if (Pos==strlen(Equal)) {
@@ -1373,9 +1378,6 @@
Next:;
}
- // not found
-// fprintf(stderr, "Error reading parameter file %s - Variable %s not found.",
-// FileName, VariableName);
fclose(file);
return NULL;
}
@@ -1411,24 +1413,21 @@
int a;
const char *ipos = hex;
char *opos = buffer;
-// printf("Debug: hexstr2bin bytestring is ");
for (i = 0; i < len; i++) {
a = hex2byte(ipos);
-// printf("%02X", a);
if (a < 0)
return -1;
*opos++ = a;
ipos += 2;
}
-// printf(" \n");
return 0;
}
void printVersion()
{
char* version = VERSION;
- printf("\n * usb-modeswitch: handle USB devices with multiple modes\n");
+ printf(" * usb_modeswitch: handle USB devices with multiple modes\n");
printf(" * Version %s (C) Josua Dietze 2010\n", version);
printf(" * Based on libusb0 (0.1.12 and above)\n\n");
printf(" ! PLEASE REPORT NEW CONFIGURATIONS !\n\n");
@@ -1436,9 +1435,9 @@
void printHelp()
{
- printf ("Usage: usb-modeswitch [-hvpVPmMrdHn] [-c filename]\n\n");
+ printf ("Usage: usb_modeswitch [-hvpVPmMrdHn] [-c filename]\n\n");
printf (" -h, --help this help\n");
- printf (" -e, --version print version number and exit\n");
+ printf (" -e, --version print version information and exit\n");
printf (" -v, --default-vendor NUM vendor ID of original mode (mandatory)\n");
printf (" -p, --default-product NUM product ID of original mode (mandatory)\n");
printf (" -V, --target-vendor NUM target mode vendor ID (optional)\n");
@@ -1446,7 +1445,7 @@
printf (" -C, --target-class NUM target mode device class (optional)\n");
printf (" -m, --message-endpoint NUM direct the message transfer there (optional)\n");
printf (" -M, --message-content <msg> message to send (hex number as string)\n");
- printf (" -2 <msg>, -3 <msg> additional messages to send (implies -n)\n");
+ printf (" -2 <msg>, -3 <msg> additional messages to send (-n recommended)\n");
printf (" -n, --need-response read response to the message transfer (CSW)\n");
printf (" -r, --response-endpoint NUM read response from there (optional)\n");
printf (" -d, --detach-only detach the active driver, no further action\n");
@@ -1455,12 +1454,12 @@
printf (" -O, --sony-mode apply a special procedure\n");
printf (" -G, --gct-mode apply a special procedure\n");
printf (" -R, --reset-usb reset the device after all other actions\n");
- printf (" -c, --config <filename> load configuration from file\n");
printf (" -Q, --quiet don't show progress or error messages\n");
printf (" -W, --verbose print all settings and debug output\n");
printf (" -D, --sysmode specific result and syslog message\n");
printf (" -s, --success NUM check switching result after NUM secs\n");
printf (" -I, --no-inquire do not get SCSI attributes (default on)\n\n");
+ printf (" -c, --config-file <filename> load configuration from file\n\n");
printf (" -i, --interface NUM select initial USB interface (default 0)\n");
printf (" -u, --configuration NUM select USB configuration\n");
printf (" -a, --altsetting NUM select alternative USB interface setting\n\n");
diff -Nru usb-modeswitch-1.1.3/usb_modeswitch.conf usb-modeswitch-1.1.4/usb_modeswitch.conf
--- usb-modeswitch-1.1.3/usb_modeswitch.conf 2010-06-21 21:21:16.000000000 +0200
+++ usb-modeswitch-1.1.4/usb_modeswitch.conf 2010-08-17 19:30:40.000000000 +0200
@@ -1,7 +1,8 @@
-# Configuration for the usb-modeswitch package, a mode switching tool for
+# Configuration for the usb_modeswitch package, a mode switching tool for
# USB devices providing multiple states or modes
#
-# This file is evaluated by the wrapper script "usb_modeswitch" in /lib/udev
+# This file is evaluated by the wrapper script "usb_modeswitch_dispatcher"
+# in /usr/sbin
# To enable an option, set it to "1", "yes" or "true" (case doesn't matter)
# Everything else counts as "disable"
diff -Nru usb-modeswitch-1.1.3/usb_modeswitch.h usb-modeswitch-1.1.4/usb_modeswitch.h
--- usb-modeswitch-1.1.3/usb_modeswitch.h 2010-06-21 19:36:56.000000000 +0200
+++ usb-modeswitch-1.1.4/usb_modeswitch.h 2010-08-17 19:27:22.000000000 +0200
@@ -1,8 +1,8 @@
/*
- This file is part of usb-modeswitch, a mode switching tool for controlling
+ This file is part of usb_modeswitch, a mode switching tool for controlling
flip flop (multiple device) USB gear
- Version 1.1.3, 2010/06/21
+ Version 1.1.4, 2010/08/17
Copyright (C) 2007, 2008, 2009, 2010 Josua Dietze
Config file parsing stuff borrowed from Guillaume Dargaud
diff -Nru usb-modeswitch-1.1.3/usb_modeswitch.sh usb-modeswitch-1.1.4/usb_modeswitch.sh
--- usb-modeswitch-1.1.3/usb_modeswitch.sh 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-1.1.4/usb_modeswitch.sh 2010-08-16 23:26:32.000000000 +0200
@@ -0,0 +1,13 @@
+#!/bin/sh
+(
+count=120
+while [ $count != 0 ]; do
+ if [ ! -e "/usr/bin/tclsh" ]; then
+ sleep 1
+ count=$(($count - 1))
+ else
+ exec /usr/bin/tclsh /usr/sbin/usb_modeswitch_dispatcher "$@" 2>/dev/null &
+ exit 0
+ fi
+done
+) &
diff -Nru usb-modeswitch-1.1.3/usb_modeswitch.tcl usb-modeswitch-1.1.4/usb_modeswitch.tcl
--- usb-modeswitch-1.1.3/usb_modeswitch.tcl 2010-06-15 22:06:15.000000000 +0200
+++ usb-modeswitch-1.1.4/usb_modeswitch.tcl 2010-08-18 00:18:34.000000000 +0200
@@ -1,27 +1,34 @@
#!/bin/sh
-# next lines for bash, ignored by tclsh, restarting in background\
-export PATH=/bin:/usr/bin; \
-if [ ! -e "/usr/bin/tclsh" ]; then \
- logger -p syslog.error "usb_modeswitch: tcl shell not found, install tcl package!"; \
-fi; \
-(/usr/bin/tclsh "$0" "$@" >/dev/null 2>&1 &); \
-sleep 1; \
-exit
+# next lines for bash, ignored by tclsh, restarting in background \
+( \
+count=120; \
+while [ $count != 0 ]; do \
+ if [ ! -e "/usr/bin/tclsh" ]; then \
+ sleep 1; \
+ count=$(($count - 1)); \
+ else \
+ exec /usr/bin/tclsh "$0" "$@" 2>/dev/null & \
+ exit 0; \
+ fi; \
+done; \
+) & \
+exit 0
# Wrapper (tcl) for usb_modeswitch, called from
# /lib/udev/rules.d/40-usb_modeswitch.rules
-# (part of data pack "usb-modeswitch-data")
+# (part of data pack "usb-modeswitch-data") via
+# /lib/udev/usb_modeswitch
#
# Does ID check on hotplugged USB devices and calls the
# mode switching program with the matching parameter file
# from /etc/usb_modeswitch.d
#
-# Part of usb-modeswitch-1.1.3 package
+# Part of usb-modeswitch-1.1.4 package
# (C) Josua Dietze 2009, 2010
-# Setting of the following switches is done in an external config
+# Setting of the these switches is done in the global config
# file (/etc/usb_modeswitch.conf)
set logging 0
@@ -35,7 +42,7 @@
proc {Main} {argc argv} {
-global scsi usb match wc device logging noswitching
+global scsi usb config match wc device logging noswitching settings
# The facility to add a symbolic link pointing to the
# ttyUSB port which provides interrupt transfer, i.e.
@@ -44,29 +51,29 @@
# This is run once for every device interface by an
# udev rule
-if {[lindex $argv 0] == "symlink"} {
-# puts "symlink: udev path is [lindex $argv 2]"
+if {[lindex $argv 0] == "--symlink-name"} {
# set device [clock clicks]
-# set logging 1
-# Log "symlink: udev path is [lindex $argv 2]"
- if [llength [glob -nocomplain /tmp/gsmmodem_*]] {
- set sl [SymLinkName [lindex $argv 2]]
-# Log "symlink name is :$sl:"
- puts $sl
-# puts [SymLinkName [lindex $argv 2]]
- } else {
- puts ""
- }
+ puts [SymLinkName [lindex $argv 1]]
+ SafeExit
+}
+
+# The facility to bind the driver on-the-fly after a warm
+# boot; the device is still in modem mode but if the
+# driver was bound by the switching script before (ID
+# not yet added to the driver), the device needs to be
+# bound again
+
+if {[lindex $argv 0] == "--driver-bind"} {
+ CheckDriverBind [lindex $argv 1] [lindex $argv 2] [lindex $argv 3] [lindex $argv 4]
SafeExit
}
-set dbdir /etc/usb_modeswitch.d
+set settings(dbdir) /etc/usb_modeswitch.d
set bindir /usr/sbin
set devList1 {}
set devList2 {}
-
# argv contains the values provided from the udev rule
# separated by "/"
@@ -78,7 +85,7 @@
set device "noname"
}
-ParseConfigFile
+ParseGlobalConfig
Log "raw args from udev: $argv"
@@ -151,34 +158,25 @@
if $noswitching {
Log "\nSwitching globally disabled. Exiting\n"
- catch {exec logger -p syslog.notice "usb_modeswitch: switching disabled, no action for $usb(idVendor):$usb(idProduct)"}
+ catch {exec logger -p syslog.notice "usb_modeswitch: switching disabled, no action for $usb(idVendor):$usb(idProduct)" 2>/dev/null}
SafeExit
}
-# Special ZTE check
-if {"$usb(idVendor)$usb(idProduct)" == "19d22000"} {
- foreach dir {/etc/udev/rules.d /lib/udev/rules.d} {
- catch {eval exec grep {"19d2.*2000.*eject"} [glob -nocomplain $dir/*]} result
- if [regexp {(.*?):.*19d2} $result d ruleFile] {
- Log "\nWarning: existing ZTE rule found in $ruleFile. Might cause problems\n"
- }
- }
-}
-
# Check if there is more than one config file for this USB ID,
# which would point to a possible ambiguity. If so, check if
# SCSI values are needed
-set configList [glob -nocomplain $dbdir/$usb(idVendor):$usb(idProduct)*]
+set configList [ConfigGet list $usb(idVendor):$usb(idProduct)]
+
if {[llength $configList] == 0} {
Log "Aargh! Config file missing for $usb(idVendor):$usb(idProduct)! Exiting"
SafeExit
}
-set scsiNeeded false
+set scsiNeeded 0
if {[llength $configList] > 1} {
if [regexp {:s} $configList] {
- set scsiNeeded true
+ set scsiNeeded 1
}
}
if {!$scsiNeeded} {
@@ -262,7 +260,7 @@
# storage driver, so it's just the last resort
if {$scsiNeeded && $scsi(vendor)==""} {
- set testSCSI [exec $bindir/usb_modeswitch -v 0x$usb(idVendor) -p 0x$usb(idProduct)]
+ set testSCSI [exec $bindir/usb_modeswitch -v 0x$usb(idVendor) -p 0x$usb(idProduct) 2>/dev/null]
regexp { Vendor String: (.*?)\n} $testSCSI d scsi(vendor)
regexp { Model String: (.*?)\n} $testSCSI d scsi(model)
regexp {Revision String: (.*?)\n} $testSCSI d scsi(rev)
@@ -284,7 +282,7 @@
# end and provide a fallback
set report {}
-set configList [glob -nocomplain $dbdir/$usb(idVendor):$usb(idProduct)*]
+#set configList [glob -nocomplain $settings(dbdir)/$usb(idVendor):$usb(idProduct)*]
foreach configuration [lsort -decreasing $configList] {
# skipping installer leftovers
@@ -292,24 +290,31 @@
Log "checking config: $configuration"
if [MatchDevice $configuration] {
- set switch_config $configuration
+ ParseDeviceConfig [ConfigGet config $configuration]
set devList1 [glob -nocomplain /dev/ttyUSB* /dev/ttyACM* /dev/ttyHS*]
- Log "! matched, now switching"
- set tc [open /tmp/gsmmodem_$dev_top w]
- close $tc
+ if {$config(waitBefore) == ""} {
+ Log "! matched, now switching"
+ } else {
+ Log "! matched, waiting time set to $config(waitBefore) seconds"
+ after [expr $config(waitBefore) * 1000]
+ Log " waiting is over, switching starts now"
+ }
# Now we are actually switching
if $logging {
- Log " (running command: $bindir/usb_modeswitch -I -W -c $configuration)"
- set report [exec $bindir/usb_modeswitch -I -W -D -c $configuration 2>@ stdout]
+ Log " (running command: $bindir/usb_modeswitch -I -W -c $settings(tmpConfig))"
+ set report [exec $bindir/usb_modeswitch -I -W -D -c $settings(tmpConfig) 2>@ stdout]
} else {
- set report [exec $bindir/usb_modeswitch -I -Q -D -c $configuration]
+ set report [exec $bindir/usb_modeswitch -I -Q -D -c $settings(tmpConfig) 2>/dev/null]
}
Log "\nverbose output of usb_modeswitch:"
Log "--------------------------------"
Log $report
Log "--------------------------------"
Log "(end of usb_modeswitch output)\n"
+ if [regexp {/tmp/} $settings(tmpConfig)] {
+ file delete $settings(tmpConfig)
+ }
break
} else {
Log "* no match, not switching with this config"
@@ -327,24 +332,15 @@
# For general driver loading; TODO: add respective device names.
# Presently only useful for HSO devices (which are recounted now)
- set driverModule ""
- set driverIDPath ""
- set rc [open $configuration r]
- set lineList [split [read $rc] \n]
- close $rc
- foreach line $lineList {
- regexp {DriverModule[[:blank:]]*=[[:blank:]]*"?(\w+)"?} $line d driverModule
- regexp {DriverIDPath[[:blank:]]*=[[:blank:]]*?"?([/\-\w]+)"?} $line d driverIDPath
- }
- if {$driverModule == ""} {
- set driverModule "option"
- set driverIDPath "/sys/bus/usb-serial/drivers/option1"
+ if {$config(driverModule) == ""} {
+ set config(driverModule) "option"
+ set config(driverIDPath) "/sys/bus/usb-serial/drivers/option1"
} else {
- if {$driverIDPath == ""} {
- set driverIDPath "/sys/bus/usb/drivers/$driverModule"
+ if {$config(driverIDPath) == ""} {
+ set config(driverIDPath) "/sys/bus/usb/drivers/$config(driverModule)"
}
}
- Log "Driver module is \"$driverModule\", ID path is $driverIDPath\n"
+ Log "Driver module is \"$config(driverModule)\", ID path is $config(driverIDPath)\n"
# some settling time in ms
after 500
@@ -371,28 +367,29 @@
}
set t "$usb(idVendor)$usb(idProduct)"
if {[string length $t] == 8 && [string trim $t 0] != ""} {
- set idfile $driverIDPath/new_id
+ set idfile $config(driverIDPath)/new_id
if {![file exists $idfile]} {
- Log "\nTrying to load driver \"$driverModule\""
+ Log "\nTrying to load driver \"$config(driverModule)\""
set loader /sbin/modprobe
Log " loader is: $loader"
if [file exists $loader] {
- if [catch {set result [exec $loader -v $driverModule]} err] {
- Log " Running \"$loader $driverModule\" gave an error:\n $err"
+ if [catch {set result [exec $loader -v $config(driverModule) 2>/dev/null]} err] {
+ Log " Running \"$loader $config(driverModule)\" gave an error:\n $err"
}
} else {
Log " /sbin/modprobe not found"
}
}
if [file exists $idfile] {
- Log "Trying to add ID to driver \"$driverModule\""
- catch {exec logger -p syslog.notice "usb_modeswitch: adding device ID $usb(idVendor):$usb(idProduct) to driver \"$driverModule\""}
- catch {exec echo "$usb(idVendor) $usb(idProduct)" >$idfile}
+ Log "Trying to add ID to driver \"$config(driverModule)\""
+ catch {exec logger -p syslog.notice "usb_modeswitch: adding device ID $usb(idVendor):$usb(idProduct) to driver \"$config(driverModule)\"" 2>/dev/null}
+ catch {exec echo "$usb(idVendor) $usb(idProduct)" >$idfile 2>/dev/null}
after 600
set devList2 [glob -nocomplain /dev/ttyUSB* /dev/ttyACM* /dev/ttyHS*]
if {[llength $devList1] >= [llength $devList2]} {
Log " still no new serial devices found"
} else {
+ AddLastSeen "$usb(idVendor):$usb(idProduct)"
Log " driver successfully bound"
}
} else {
@@ -416,7 +413,7 @@
if [regexp {ok:} $report] {
Log "Checking for AVOID_RESET_QUIRK attribute"
if [file exists $devdir/avoid_reset_quirk] {
- if [catch {exec echo "1" >$devdir/avoid_reset_quirk} err] {
+ if [catch {exec echo "1" >$devdir/avoid_reset_quirk 2>/dev/null} err] {
Log " Error setting the attribute: $err"
} else {
Log " AVOID_RESET_QUIRK activated"
@@ -503,7 +500,7 @@
# end of proc {MatchDevice}
-proc {ParseConfigFile} {} {
+proc {ParseGlobalConfig} {} {
global logging noswitching
@@ -536,74 +533,176 @@
Log "Using global config file: $configFile"
}
-# end of proc {ParseConfigFile}
+# end of proc {ParseGlobalConfig}
+
+
+proc ParseDeviceConfig {configFile} {
+
+global config
+set config(driverModule) ""
+set config(driverIDPath) ""
+set config(waitBefore) ""
+set rc [open $configFile r]
+set lineList [split [read $rc] \n]
+close $rc
+foreach line $lineList {
+ regexp {DriverModule[[:blank:]]*=[[:blank:]]*"?(\w+)"?} $line d config(driverModule)
+ regexp {DriverIDPath[[:blank:]]*=[[:blank:]]*?"?([/\-\w]+)"?} $line d config(driverIDPath)
+ regexp {WaitBefore[[:blank:]]*=[[:blank:]]*?(\d+)} $line d config(waitBefore)
+}
+set config(waitBefore) [string trimleft $config(waitBefore) 0]
+
+}
+# end of proc {ParseDeviceConfig}
+
+
+proc {ConfigGet} {command config} {
+
+global settings
+switch $command {
+
+ list {
+ if [file exists $settings(dbdir)/configPack.tar.gz] {
+ Log "Found packed config collection $settings(dbdir)/configPack.tar.gz"
+ if [catch {set configList [exec tar -tzf $settings(dbdir)/configPack.tar.gz 2>/dev/null]} err] {
+ Log "Error: problem opening config package; tar returned\n $err"
+ return {}
+ }
+ set configList [split $configList \n]
+ set configList [lsearch -all -inline $configList $config*]
+ } else {
+ set configList [glob -nocomplain $settings(dbdir)/$config*]
+ }
+
+ return $configList
+ }
+ config {
+ if [file exists $settings(dbdir)/configPack.tar.gz] {
+ set settings(tmpConfig) /tmp/usb_modeswitch.current_cfg
+ Log "Extracting config $config from collection $settings(dbdir)/configPack.tar.gz"
+ set wc [open $settings(tmpConfig) w]
+ puts -nonewline $wc [exec tar -xzOf $settings(dbdir)/configPack.tar.gz $config 2>/dev/null]
+ close $wc
+ } else {
+ set settings(tmpConfig) $config
+ }
+ return $settings(tmpConfig)
+ }
+}
+
+}
+# end of proc {ConfigGet}
proc {Log} {msg} {
global wc logging device
if {$logging == 0} {return}
if {![info exists wc]} {
- set wc [open /var/log/usb_modeswitch_$device a]
+ if [catch {set wc [open /var/log/usb_modeswitch_$device a]} err] {
+ set wc "error"
+ puts "Error: Can't write to log file, $err"
+ return
+ }
puts $wc "\n\nUSB_ModeSwitch log from [clock format [clock seconds]]\n"
}
+if {$wc == "error"} {return}
puts $wc $msg
}
# end of proc {Log}
+# Closing the log file if open and exit
+proc {SafeExit} {} {
-# Checking for interrupt endpoint in ttyUSB port; if found,
-# check for unused "gsmmodem[n]" name.
-# First link will be "gsmmodem", then "gsmmodem2" and up
-
-proc {SymLinkName} {path} {
-
-# HACK ... /tmp/gsmmodem_* was generated by a switching run before;
-# no way found to signal annother instance in the udev environment
+global wc
+if [info exists wc] {
+ catch {close $wc}
+}
+exit
-set idx -1
-set tmpNames [glob -nocomplain /tmp/gsmmodem_*]
-foreach tmpName $tmpNames {
- set dev_top [lindex [split $tmpName _] 1]
- set dirList [split $path /]
- set idx [lsearch $dirList $dev_top]
- if {$idx == -1} {
- continue
- } else {break}
}
-if {$idx == -1} {return ""}
+# end of proc {SafeExit}
-regexp {ttyUSB\d+?} $path myPort
-#Log "symlink: dev_top is $dev_top \npath is $path \nport is $myPort"
+# Checking for interrupt endpoint in ttyUSB port (lowest if there is
+# more than one); if found, check for unused "gsmmodem[n]" name.
+# Link for first modem will be "gsmmodem", then "gsmmodem2" and up
-# Unfortunately, there are devices with more than one interrupt
-# port. We have to check all ports and assume that the lowest
-# number denotes the working port
+proc {SymLinkName} {path} {
-set devDir /sys[join [lrange $dirList 0 $idx] /]
-set portList {}
-foreach ifDir [glob -nocomplain $devDir/$dev_top:\[0-9\].\[0-9\]] {
-# Log "ifDir is $ifDir"
- if {![regexp {ttyUSB\d+?} [glob -nocomplain $ifDir/*] port]} {continue}
+# Internal proc, used only here
+proc {hasInterrupt} {ifDir} {
+ if {[llength [glob -nocomplain $ifDir/ttyUSB*]] == 0} {return 0}
foreach epDir [glob -nocomplain $ifDir/ep_*] {
if [file exists $epDir/type] {
set rc [open $epDir/type r]
set type [read $rc]
close $rc
if [regexp {Interrupt} $type] {
- lappend portList $port
+ return 1
}
}
}
+ return 0
}
-set lowestPort [lindex [lsort -increasing $portList] 0]
-if {$lowestPort != $myPort} {
+
+# In case the device path is returned as /class/tty/ttyUSB,
+# we need to extract the USB device path from symlink "device"
+set linkpath /sys$path/device
+if [file exists $linkpath] {
+ if {[file type $linkpath] == "link"} {
+ set rawpath [file link $linkpath]
+ set trimpath [regsub -all {\.\./} $rawpath {}]
+ if [file isdirectory /sys/$trimpath] {
+ set path /$trimpath
+ }
+ }
+}
+
+if {![regexp {ttyUSB\d+?} $path myPort]} {
+ return ""
+}
+if {![regexp "\\d+\\.(\\d+)/$myPort" $path d myIf]} {
+ return ""
+}
+if {![regexp {usb\d*/(\d+-\d+)/} $path d dev_top]} {
+ return ""
+}
+
+set dirList [split $path /]
+set idx [lsearch $dirList $dev_top]
+set devDir /sys[join [lrange $dirList 0 $idx] /]
+
+if {![regexp "$devDir/$dev_top:\[0-9\]" /sys$path ifRoot]} {
return ""
}
-eval file delete dummy $tmpName
+set ifDir $ifRoot.$myIf
+
+set rightPort 0
+if [hasInterrupt $ifDir] {
+ set rightPort 1
+}
+
+# Unfortunately, there are devices with more than one interrupt
+# port. The assumption so far is that the lowest of these is
+# right. Check all lower interfaces for annother one (if interface)
+# is bigger than 0). If found, don't return any name.
+if { $rightPort && ($myIf > 0) } {
+ for {set i 0} {$i < $myIf} {incr i} {
+ set ifDir $ifRoot.$i
+ if [hasInterrupt $ifDir] {
+ set rightPort 0
+ break
+ }
+ }
+}
+if {$rightPort == 0} {
+ return ""
+}
+
+# Use first free "gsmmodem[n]" name
cd /dev
set idx 2
set symlinkName "gsmmodem"
@@ -614,22 +713,89 @@
set symlinkName gsmmodem$idx
incr idx
}
-
return $symlinkName
}
# end of proc {SymLinkName}
-proc {SafeExit} {} {
-global wc
-if [info exists wc] {
- catch {close $wc}
+# Add serial driver after warm boot
+proc {CheckDriverBind} {path vid pid prod} {
+
+if {$vid == ""} {set vid $prod}
+if [regexp {/} $vid] {
+ set id_list [split $vid /]
+ set vid [format %04s [lindex $id_list 0]]
+ set pid [format %04s [lindex $id_list 1]]
}
-exit
+set dirList [glob -nocomplain /sys$path/*]
+if [string match *ttyUSB* $dirList] {return}
+
+if {[WasLastSeen $vid:$pid] == 0} {return}
+
+set config(driverModule) "option"
+set config(driverIDPath) "/sys/bus/usb-serial/drivers/option1"
+set idfile $config(driverIDPath)/new_id
+if {![file exists $idfile]} {
+ set loader /sbin/modprobe
+ if {![file exists $loader]} {return}
+ if [catch {exec $loader $config(driverModule) 2>/dev/null}] {return}
+ set i 0
+ while {$i < 50} {
+ if [file exists $idfile] {
+ break
+ }
+ after 20
+ incr i
+ }
+ if {$i == 50} {return}
}
-# end of proc {SafeExit}
+catch {exec echo "$vid $pid" >$idfile 2>/dev/null}
+
+}
+# end of proc {CheckDriverBind}
+
+
+# Add USB ID to list of devices needing driver binding
+proc {AddLastSeen} {id} {
+
+set lastseen /etc/usb_modeswitch.d/last_seen
+if [file exists $lastseen] {
+ set rc [open $lastseen r]
+ set buffer [read $rc]
+ close $rc
+ if [string match *$id* $buffer] {
+ return
+ }
+ set idList [split [string trim $buffer] \n]
+}
+lappend idList $id
+set buffer [join $idList "\n"]
+if [catch {set wc [open $lastseen w]}] {return}
+puts -nonewline $wc $buffer
+close $wc
+
+}
+# end of proc {AddLastSeen}
+
+
+# Check if USB ID is listed as needing driver binding
+proc {WasLastSeen} {id} {
+
+set lastseen /etc/usb_modeswitch.d/last_seen
+if {![file exists $lastseen]} {return 0}
+set rc [open $lastseen r]
+set buffer [read $rc]
+close $rc
+if [string match *$id* $buffer] {
+ return 1
+} else {
+ return 0
+}
+
+}
+# end of proc {WasLastSeen}
# The actual entry point
diff -Nru usb-modeswitch-data-20100707/40-usb_modeswitch.rules usb-modeswitch-data-20100817/40-usb_modeswitch.rules
--- usb-modeswitch-data-20100707/40-usb_modeswitch.rules 2010-07-07 23:35:18.000000000 +0200
+++ usb-modeswitch-data-20100817/40-usb_modeswitch.rules 2010-08-17 23:39:05.000000000 +0200
@@ -1,17 +1,21 @@
-# Part of usb-modeswitch-data, version 20100707
+# Part of usb-modeswitch-data, version 20100817
#
-# This file is intended for USB_ModeSwitch version >= 1.1.2
+# This file is intended for USB_ModeSwitch version >= 1.1.4
# but will not break anything if used with versions >= 1.0.3
#
ACTION!="add", GOTO="modeswitch_rules_end"
-# This adds a symlink "gsmmodem[n]" to the right (interrupt) ttyUSB port;
-# will work only with wrapper 1.1.2 and above (otherwise ignored)
-KERNEL=="ttyUSB*", PROGRAM="/usr/bin/tclsh /lib/udev/usb_modeswitch symlink name %p", SYMLINK="%c"
+# This adds a symlink "gsmmodem[n]" to ttyUSB ports with interrupt transfer;
+# will work only with wrapper from 1.1.4 and above (otherwise ignored)
+KERNEL=="ttyUSB*", DRIVERS=="option1|usbserial", PROGRAM="/usr/bin/tclsh /usr/sbin/usb_modeswitch_dispatcher --symlink-name %p", SYMLINK="%c"
+
SUBSYSTEM!="usb", GOTO="modeswitch_rules_end"
+# This adds the device ID to the "option" driver after a warm boot
+# in cases when the device is yet unknown to the driver
+ATTR{bInterfaceClass}=="ff", ATTR{bInterfaceNumber}=="00", RUN+="usb_modeswitch --driver-bind %p %s{idVendor} %s{idProduct} %E{PRODUCT}"
# Most known install partitions are on interface 0, one on 5, one on 9
ATTRS{bInterfaceNumber}!="0[059]", GOTO="modeswitch_rules_end"
@@ -38,7 +42,10 @@
ATTRS{idVendor}=="0471", ATTRS{idProduct}=="1237", RUN+="usb_modeswitch '%b/%k'"
# Kyocera W06K CDMA modem
-ATTRS{idVendor}=="0482", ATTRS{idProduct}=="024d", RUN+="usb_modeswitch '%b/%k'"
+ATTRS{idVendor}=="0482", ATTRS{idProduct}=="024d", ATTRS{bConfigurationValue}=="1", RUN+="usb_modeswitch '%b/%k'"
+
+# Samsung GT-B3730
+ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="689a", RUN+="usb_modeswitch '%b/%k'"
# Samsung U209
ATTRS{idVendor}=="04e8", ATTRS{idProduct}=="f000", RUN+="usb_modeswitch '%b/%k'"
@@ -46,7 +53,7 @@
# AVM Fritz!Wlan USB Stick N
ATTRS{idVendor}=="057c", ATTRS{idProduct}=="84ff", RUN+="usb_modeswitch '%b/%k'"
-# Samsung SGH-Z810, older Option devices, Vertex Wireless 100 Series, AnyDATA devices
+# Samsung SGH-Z810, Older Option devices, Vertex Wireless 100 Series, AnyDATA devices
ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="1000", RUN+="usb_modeswitch '%b/%k'"
# D-Link DWM-162-U5, Micromax MMX 300c
@@ -271,6 +278,9 @@
# Huawei, newer modems
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="usb_modeswitch '%b/%k'"
+# Vodafone (Huawei) K3806
+ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14ad", RUN+="usb_modeswitch '%b/%k'"
+
# Vodafone (Huawei) K4605
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14c1", RUN+="usb_modeswitch '%b/%k'"
@@ -304,7 +314,7 @@
# Motorola 802.11 bg WLAN (TER/GUSB3-E)
ATTRS{idVendor}=="148f", ATTRS{idProduct}=="2578", RUN+="usb_modeswitch '%b/%k'"
-# C-motech D-50 (aka "CDU-680"), C-motech D-50 (aka "CDU-680") - Variant
+# C-motech D-50 (aka "CDU-680"), C-motech D-50 (aka "CDU-680")
ATTRS{idVendor}=="16d8", ATTRS{idProduct}=="6803", RUN+="usb_modeswitch '%b/%k'"
# C-motech CHU-629S
@@ -349,6 +359,9 @@
# Vodafone (ZTE) K3571-Z
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1009", RUN+="usb_modeswitch '%b/%k'"
+# Vodafone (ZTE) K3806-Z
+ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="1013", RUN+="usb_modeswitch '%b/%k'"
+
# ZTE devices
ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", RUN+="usb_modeswitch '%b/%k'"
@@ -376,7 +389,10 @@
# MyWave SW006 Sport Phone/Modem Combination
ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9200", RUN+="usb_modeswitch '%b/%k'"
-# MobiData MBD-200HU
+# BSNL Capitel
+ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="9e00", RUN+="usb_modeswitch '%b/%k'"
+
+# MobiData MBD-200HU and others
ATTRS{idVendor}=="1c9e", ATTRS{idProduct}=="f000", RUN+="usb_modeswitch '%b/%k'"
# Solomon S3Gm-660
diff -Nru usb-modeswitch-data-20100707/ChangeLog usb-modeswitch-data-20100817/ChangeLog
--- usb-modeswitch-data-20100707/ChangeLog 2010-07-07 23:57:20.000000000 +0200
+++ usb-modeswitch-data-20100817/ChangeLog 2010-08-17 23:55:40.000000000 +0200
@@ -1,3 +1,10 @@
+20100817:
+ added BSNL Capitel; added Samsung GT-B3730; added Vodafone/
+ ZTE K3806-Z; changed Vodafone/Huawei devices (added switching
+ command for cdc_ether mode): K4605, K3765 and K4505;
+ added rule for driver loading after reboot (wrapper 1.1.4)
+ change symlink rule in sync with changes in wrapper 1.1.4
+ final changes for ZTE 19d2:2000 ("...!")
20100707:
added Vodafone/Huawei K4605 and Huawei R201 (from Betavine),
added Atheros Wireless / Netgear WNDA3200, added Onda MW833UP,
@@ -27,4 +34,3 @@
of "eject" failure; even older ZTE devices seem to work with the former;
a conflict was exposed between two versions of 16d8:6803 (C-motech D50);
changed the default to the one which keeps the ID during switching
-
diff -Nru usb-modeswitch-data-20100707/debian/changelog usb-modeswitch-data-20100817/debian/changelog
--- usb-modeswitch-data-20100707/debian/changelog 2010-07-18 22:55:43.000000000 +0200
+++ usb-modeswitch-data-20100817/debian/changelog 2010-08-24 00:24:22.000000000 +0200
@@ -1,3 +1,22 @@
+usb-modeswitch-data (20100817-1~exp0) experimental; urgency=low
+
+ * New upstream release
+ + New devices
+ [04e8:689a] Samsung GT-B3730
+ [12d1:14ad] Vodafone (Huawei) K3806
+ [19d2:1013] Vodafone (ZTE) K3806-Z
+ [1c9e:9e00] BSNL Capitel
+ Ã? Devices updates (see ChangeLog for details)
+ [05c6:1000] AnyData devices
+ [19d2:2000] ZTE devices (Closes: #590902)
+ [1c9e:f000] MobiData MBD-200HU and others
+ - Update patches.
+ * Add 02_no_tclsh_overhead.patch to avoid hardcoding tclsh path.
+
+ * Bump usb-modeswitch recommend to 1.1.4.
+
+ -- Didier Raboud <didier@raboud.com> Tue, 24 Aug 2010 00:23:42 +0200
+
usb-modeswitch-data (20100707-1) unstable; urgency=low
* New upstream release
diff -Nru usb-modeswitch-data-20100707/debian/control usb-modeswitch-data-20100817/debian/control
--- usb-modeswitch-data-20100707/debian/control 2010-07-18 22:45:07.000000000 +0200
+++ usb-modeswitch-data-20100817/debian/control 2010-08-18 10:57:57.000000000 +0200
@@ -12,7 +12,7 @@
Package: usb-modeswitch-data
Architecture: all
Depends: ${misc:Depends}, udev (>= 0.140) | not+linux-gnu
-Recommends: usb-modeswitch (>= 1.1.2)
+Recommends: usb-modeswitch (>= 1.1.4)
Breaks: usb-modeswitch (<< 1.0.7-1)
Replaces: usb-modeswitch (<< 1.0.7-1)
Description: mode switching data for usb-modeswitch
diff -Nru usb-modeswitch-data-20100707/debian/patches/01_no_udev_reload.patch usb-modeswitch-data-20100817/debian/patches/01_no_udev_reload.patch
--- usb-modeswitch-data-20100707/debian/patches/01_no_udev_reload.patch 2010-07-18 22:45:07.000000000 +0200
+++ usb-modeswitch-data-20100817/debian/patches/01_no_udev_reload.patch 2010-08-18 10:48:48.000000000 +0200
@@ -2,21 +2,24 @@
Author: Didier Raboud <didier@raboud.com>
Origin: vendor
Forwarded: yes (private mail)
-Last-Update: 2010-07-18
-Index: usb-modeswitch-data.git/Makefile
+Last-Update: 2010-08-18
+Index: usb-modeswitch-data/Makefile
===================================================================
---- usb-modeswitch-data.git.orig/Makefile 2010-07-18 20:00:44.000000000 +0200
-+++ usb-modeswitch-data.git/Makefile 2010-07-18 20:07:48.000000000 +0200
-@@ -12,7 +12,7 @@
+--- usb-modeswitch-data.orig/Makefile 2010-08-18 10:35:32.000000000 +0200
++++ usb-modeswitch-data/Makefile 2010-08-18 10:46:53.000000000 +0200
+@@ -12,9 +12,9 @@
clean:
--install: files-install rules-reload
-+install: files-install
+-install: files-install db-install rules-reload
++install: files-install db-install
+
+-install-packed: files-install db-install-packed rules-reload
++install-packed: files-install db-install-packed
files-install:
install -d $(ETCDIR)/usb_modeswitch.d
-@@ -37,7 +37,7 @@
+@@ -47,7 +47,7 @@
fi \
fi
diff -Nru usb-modeswitch-data-20100707/debian/patches/02_no_tclsh_overhead.patch usb-modeswitch-data-20100817/debian/patches/02_no_tclsh_overhead.patch
--- usb-modeswitch-data-20100707/debian/patches/02_no_tclsh_overhead.patch 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-data-20100817/debian/patches/02_no_tclsh_overhead.patch 2010-08-18 10:51:22.000000000 +0200
@@ -0,0 +1,17 @@
+Description: Avoids explicit /usr/bin/tclsh call
+Author: Didier Raboud <didier@raboud.com>
+Origin: vendor
+Last-Update: 2010-08-18
+Index: usb-modeswitch-data/40-usb_modeswitch.rules
+===================================================================
+--- usb-modeswitch-data.orig/40-usb_modeswitch.rules 2010-08-18 10:49:50.000000000 +0200
++++ usb-modeswitch-data/40-usb_modeswitch.rules 2010-08-18 10:50:34.000000000 +0200
+@@ -8,7 +8,7 @@
+
+ # This adds a symlink "gsmmodem[n]" to ttyUSB ports with interrupt transfer;
+ # will work only with wrapper from 1.1.4 and above (otherwise ignored)
+-KERNEL=="ttyUSB*", DRIVERS=="option1|usbserial", PROGRAM="/usr/bin/tclsh /usr/sbin/usb_modeswitch_dispatcher --symlink-name %p", SYMLINK="%c"
++KERNEL=="ttyUSB*", DRIVERS=="option1|usbserial", PROGRAM="/usr/sbin/usb_modeswitch_dispatcher --symlink-name %p", SYMLINK="%c"
+
+
+ SUBSYSTEM!="usb", GOTO="modeswitch_rules_end"
diff -Nru usb-modeswitch-data-20100707/debian/patches/series usb-modeswitch-data-20100817/debian/patches/series
--- usb-modeswitch-data-20100707/debian/patches/series 2010-07-18 22:45:07.000000000 +0200
+++ usb-modeswitch-data-20100817/debian/patches/series 2010-08-18 11:00:14.000000000 +0200
@@ -1 +1,2 @@
01_no_udev_reload.patch
+02_no_tclsh_overhead.patch
diff -Nru usb-modeswitch-data-20100707/Makefile usb-modeswitch-data-20100817/Makefile
--- usb-modeswitch-data-20100707/Makefile 2010-07-07 23:55:04.000000000 +0200
+++ usb-modeswitch-data-20100817/Makefile 2010-08-17 23:16:58.000000000 +0200
@@ -1,5 +1,5 @@
PROG = usb-modeswitch-data
-VERS = 20100707
+VERS = 20100817
RM = /bin/rm -f
PREFIX = $(DESTDIR)/usr
ETCDIR = $(DESTDIR)/etc
@@ -12,13 +12,23 @@
clean:
-install: files-install rules-reload
+install: files-install db-install rules-reload
+
+install-packed: files-install db-install-packed rules-reload
files-install:
install -d $(ETCDIR)/usb_modeswitch.d
- install --mode=644 -t $(ETCDIR)/usb_modeswitch.d ./usb_modeswitch.d/*
install -D --mode=644 40-usb_modeswitch.rules $(RULESDIR)/40-usb_modeswitch.rules
+db-install:
+ install --mode=644 -t $(ETCDIR)/usb_modeswitch.d ./usb_modeswitch.d/*
+
+db-install-packed:
+ cd ./usb_modeswitch.d; tar -czf ../configPack.tar.gz *
+ install --mode=644 -t $(ETCDIR)/usb_modeswitch.d ./configPack.tar.gz
+ rm -f ./configPack.tar.gz
+
+
rules-reload:
if [ -f $(ETCDIR)/issue ]; then \
if [ -n `which udevadm 2>/dev/null` ]; then \
diff -Nru usb-modeswitch-data-20100707/README usb-modeswitch-data-20100817/README
--- usb-modeswitch-data-20100707/README 2010-06-21 20:28:00.000000000 +0200
+++ usb-modeswitch-data-20100817/README 2010-08-17 23:54:38.000000000 +0200
@@ -4,19 +4,34 @@
For up-to-date and detailed information (plus a friendly forum) visit
http://www.draisberghof.de/usb_modeswitch
-PLEASE REPORT NEW DEVICES
+PLEASE REPORT NEW DEVICES !
This is a data package to complement the full release package of
-USB_ModeSwitch, a tool to switch multi-mode (or composite) USB devices.
+USB_ModeSwitch, a tool to switch multi-mode USB devices.
It is used since usb-modeswitch version 1.0.3.
-Recommended version of usb-modeswitch package is 1.1.2 and above. Some
+Recommended version of usb-modeswitch package is 1.1.4 and above. Some
devices contained here may not be switched with older versions, even if
they will not cause any error.
+Tasks initiated by the rules file:
+==================================
+
+- call wrapper to initiate switching for known devices when plugged in
+ (starting from version 1.1.4 at boot time too)
+
+- adding symlink "gsmmodem" to appropriate connection port (out of 2-5
+ ports provided by some devices); this is only a help for handling and
+ NOT needed for switching to work
+
+- reloading the driver after warm boot when the device is still in modem
+ state and the device ID is not yet known to the driver; this is not
+ needed if the device is plugged during normal system operation
+
+
Explanation about config file names:
====================================
@@ -49,6 +64,22 @@
in such a case.
+Parameters used only in config files:
+=====================================
+
+These are not evaluated by the binary but by the wrapper.
+
+WaitBefore=<seconds> delay the switching process
+
+DriverModule=<module name> load a specific driver module after switch
+
+DriverIDPath=<path to attribute>
+ if the driver has the ability to add new device IDs
+ on-the-fly, this is the file node to use.
+ Example: "/sys/bus/usb-serial/drivers/option1/new_id"
+
+
+
Notes about specific devices:
=============================
@@ -82,5 +113,4 @@
-Last revised: 2010-06-21, Josua Dietze
-
+Last revised: 2010-08-17, Josua Dietze
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/04e8:689a usb-modeswitch-data-20100817/usb_modeswitch.d/04e8:689a
--- usb-modeswitch-data-20100707/usb_modeswitch.d/04e8:689a 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/04e8:689a 2010-08-17 23:33:26.000000000 +0200
@@ -0,0 +1,15 @@
+#######################################################
+# Samsung GT-B3730
+
+DefaultVendor= 0x04e8
+DefaultProduct=0x689a
+
+TargetVendor= 0x04e8
+TargetProduct= 0x6889
+
+MessageContent="55534243785634120100000080000601000000000000000000000000000000"
+
+CheckSuccess=20
+
+#NoDriverLoading=1
+
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/05c6:1000:uMa=AnyDATA usb-modeswitch-data-20100817/usb_modeswitch.d/05c6:1000:uMa=AnyDATA
--- usb-modeswitch-data-20100707/usb_modeswitch.d/05c6:1000:uMa=AnyDATA 2010-04-14 20:03:00.000000000 +0200
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/05c6:1000:uMa=AnyDATA 2010-08-17 23:38:02.000000000 +0200
@@ -1,5 +1,5 @@
########################################################
-# AnyDATA ADU-500A, ADU-510A, ADU-510L, ADU-520A
+# AnyDATA devices
DefaultVendor= 0x05c6
DefaultProduct= 0x1000
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:1446 usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:1446
--- usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:1446 2010-04-18 15:01:00.000000000 +0200
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:1446 2010-08-18 00:00:30.000000000 +0200
@@ -5,7 +5,7 @@
DefaultProduct=0x1446
TargetVendor= 0x12d1
-TargetProductList="1001,1406,140c,141b,14ac"
+TargetProductList="1001,1406,140b,140c,141b,14ac"
CheckSuccess=20
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:14ad usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:14ad
--- usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:14ad 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:14ad 2010-08-17 22:33:41.000000000 +0200
@@ -0,0 +1,12 @@
+########################################################
+# Vodafone (Huawei) K3806
+
+DefaultVendor= 0x12d1
+DefaultProduct=0x14ad
+
+TargetVendor= 0x12d1
+TargetProduct= 0x14ae
+
+CheckSuccess=20
+
+MessageContent="55534243123456780000000000000011060000000000000000000000000000"
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:14c1 usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:14c1
--- usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:14c1 2010-07-06 20:19:00.000000000 +0200
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:14c1 2010-08-17 23:34:29.000000000 +0200
@@ -9,4 +9,9 @@
CheckSuccess=20
+# Standard profile
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
+
+# CDC ether profile
+;MessageContent="55534243450100000002000080000611062000000100000000000000000000"
+;NoDriverLoading=1
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:1520 usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:1520
--- usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:1520 2010-04-14 20:03:00.000000000 +0200
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:1520 2010-08-17 23:34:57.000000000 +0200
@@ -9,4 +9,9 @@
CheckSuccess=20
+# Standard profile
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
+
+# CDC ether profile
+;MessageContent="55534243450100000002000080000611062000000100000000000000000000"
+;NoDriverLoading=1
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:1521 usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:1521
--- usb-modeswitch-data-20100707/usb_modeswitch.d/12d1:1521 2010-04-14 20:03:00.000000000 +0200
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/12d1:1521 2010-08-17 23:35:11.000000000 +0200
@@ -9,4 +9,9 @@
CheckSuccess=20
+# Standard profile
MessageContent="55534243123456780000000000000011060000000000000000000000000000"
+
+# CDC ether profile
+;MessageContent="55534243450100000002000080000611062000000100000000000000000000"
+;NoDriverLoading=1
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/19d2:1013 usb-modeswitch-data-20100817/usb_modeswitch.d/19d2:1013
--- usb-modeswitch-data-20100707/usb_modeswitch.d/19d2:1013 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/19d2:1013 2010-08-17 22:33:41.000000000 +0200
@@ -0,0 +1,20 @@
+########################################################
+# Vodafone (ZTE) K3806-Z
+#
+# Note:
+# This device has multiple USB profiles. Depending upon how it is flipped
+# from storage mode to modem mode determines its final PID and the packages
+# shown on its ISO CD image.
+
+DefaultVendor= 0x19d2
+DefaultProduct=0x1013
+
+TargetVendor= 0x19d2
+TargetProduct= 0x1015
+
+MessageContent="5553424312345678000000000000061b000000020000000000000000000000"
+
+NeedResponse=1
+
+CheckSuccess=20
+
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/19d2:2000 usb-modeswitch-data-20100817/usb_modeswitch.d/19d2:2000
--- usb-modeswitch-data-20100707/usb_modeswitch.d/19d2:2000 2010-07-07 20:26:20.000000000 +0200
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/19d2:2000 2010-08-14 14:54:39.000000000 +0200
@@ -9,6 +9,7 @@
MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
MessageContent2="5553424312345679000000000000061b000000020000000000000000000000"
+MessageContent3="55534243123456702000000080000c85010101180101010101000000000000"
NeedResponse=1
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/1c9e:9e00 usb-modeswitch-data-20100817/usb_modeswitch.d/1c9e:9e00
--- usb-modeswitch-data-20100707/usb_modeswitch.d/1c9e:9e00 1970-01-01 01:00:00.000000000 +0100
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/1c9e:9e00 2010-08-17 23:31:53.000000000 +0200
@@ -0,0 +1,12 @@
+########################################################
+# BSNL Capitel
+
+DefaultVendor= 0x1c9e
+DefaultProduct=0x9e00
+
+TargetClass=0xff
+
+MessageContent="55534243123456780000000000000606f50402527000000000000000000000"
+
+CheckSuccess=20
+
diff -Nru usb-modeswitch-data-20100707/usb_modeswitch.d/1c9e:f000 usb-modeswitch-data-20100817/usb_modeswitch.d/1c9e:f000
--- usb-modeswitch-data-20100707/usb_modeswitch.d/1c9e:f000 2010-04-14 20:03:00.000000000 +0200
+++ usb-modeswitch-data-20100817/usb_modeswitch.d/1c9e:f000 2010-08-17 23:24:31.000000000 +0200
@@ -1,11 +1,11 @@
########################################################
-# MobiData MBD-200HU
+# MobiData MBD-200HU and others
DefaultVendor= 0x1c9e
DefaultProduct=0xf000
TargetVendor= 0x1c9e
-TargetProductList="9063,9603,9000"
+TargetProductList="9000,9603,9605"
CheckSuccess=20
Reply to: