diff options
author | Didier Raboud <odyx@debian.org> | 2020-07-05 22:00:46 +0200 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2020-07-05 22:00:46 +0200 |
commit | d57b72c358a8294de555ea11a0ca422c79bb6691 (patch) | |
tree | ad3f3c3dacee9176f723680f6369d5c2afb1b83f | |
parent | 94e5c1e4ea14b1d17be216d1397ef3b84c4fcca2 (diff) |
Commit patch queue (exported by git-debrebase)
[git-debrebase make-patches: export and commit patches]
7 files changed, 325 insertions, 0 deletions
diff --git a/debian/patches/0001-Fix-official-l-y-typo.patch b/debian/patches/0001-Fix-official-l-y-typo.patch new file mode 100644 index 0000000..58e85d9 --- /dev/null +++ b/debian/patches/0001-Fix-official-l-y-typo.patch @@ -0,0 +1,21 @@ +From: Didier Raboud <odyx@debian.org> +Date: Tue, 30 Aug 2016 14:24:03 +0200 +Subject: Fix official{,l}y typo + +--- + usb_modeswitch.1 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usb_modeswitch.1 b/usb_modeswitch.1 +index 1b201cf..38f715e 100644 +--- a/usb_modeswitch.1 ++++ b/usb_modeswitch.1 +@@ -41,7 +41,7 @@ Print version information and exit + .IP "\fB-v\fP \fB\-\-default-vendor NUM\fP " 10 + Vendor ID to look for (mandatory), usually given as hex number (example: 0x12d1). + Each USB device is identified by a number +-officialy assigned to the vendor by the USB association and a number for the ++officially assigned to the vendor by the USB association and a number for the + respective model (product ID) chosen by the vendor + .IP "\fB-p\fP \fB\-\-default-product NUM\fP " 10 + Product ID to look for (mandatory) diff --git a/debian/patches/0002-Detect-if-systemd-is-running-not-only-if-its-corresp.patch b/debian/patches/0002-Detect-if-systemd-is-running-not-only-if-its-corresp.patch new file mode 100644 index 0000000..271ecf4 --- /dev/null +++ b/debian/patches/0002-Detect-if-systemd-is-running-not-only-if-its-corresp.patch @@ -0,0 +1,26 @@ +From: Didier Raboud <odyx@debian.org> +Date: Tue, 30 Aug 2016 14:24:05 +0200 +Subject: Detect if systemd is running, + not only if its corresponding configfiles is installed + + Also change the systemctl path to fit Debian's + +Origin: vendor +Bug-Debian: https://bugs.debian.org/725394 +--- + usb_modeswitch.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usb_modeswitch.sh b/usb_modeswitch.sh +index 57c2dfe..9b17145 100755 +--- a/usb_modeswitch.sh ++++ b/usb_modeswitch.sh +@@ -63,7 +63,7 @@ fi + + PATH=/bin:/sbin:/usr/bin:/usr/sbin + init_path=`readlink -f /sbin/init` +-if [ `basename $init_path` = "systemd" ]; then ++if [ `basename $init_path` = "systemd" ] && [ -d "/run/systemd/system/" ]; then # Test if systemd is running + systemctl --no-block restart usb_modeswitch@$p2.service + elif [ -e "/etc/init/usb-modeswitch-upstart.conf" ]; then + initctl emit --no-wait usb-modeswitch-upstart UMS_PARAM=$p2 diff --git a/debian/patches/0003-Set-TMPDIR-run-for-usb_modeswitch_dispatcher.patch b/debian/patches/0003-Set-TMPDIR-run-for-usb_modeswitch_dispatcher.patch new file mode 100644 index 0000000..1e9e7bc --- /dev/null +++ b/debian/patches/0003-Set-TMPDIR-run-for-usb_modeswitch_dispatcher.patch @@ -0,0 +1,44 @@ +From: Didier Raboud <odyx@debian.org> +Date: Tue, 30 Aug 2016 14:24:06 +0200 +Subject: Set TMPDIR=/run for usb_modeswitch_dispatcher + +It might be run before /tmp/ is available. +--- + usb-modeswitch-upstart.conf | 1 + + usb_modeswitch.sh | 1 + + usb_modeswitch@.service | 1 + + 3 files changed, 3 insertions(+) + +diff --git a/usb-modeswitch-upstart.conf b/usb-modeswitch-upstart.conf +index 0d82b69..1fda4ba 100644 +--- a/usb-modeswitch-upstart.conf ++++ b/usb-modeswitch-upstart.conf +@@ -1,5 +1,6 @@ + start on usb-modeswitch-upstart + task ++env TMPDIR=/run + script + exec /usr/sbin/usb_modeswitch_dispatcher --switch-mode $UMS_PARAM + end script +diff --git a/usb_modeswitch.sh b/usb_modeswitch.sh +index 9b17145..8fa895c 100755 +--- a/usb_modeswitch.sh ++++ b/usb_modeswitch.sh +@@ -47,6 +47,7 @@ case "$1" in + device_in "link_list" $v_id $p_id + if [ "$?" = "1" ]; then + if [ -e "/usr/sbin/usb_modeswitch_dispatcher" ]; then ++ export TMPDIR=/run + exec usb_modeswitch_dispatcher $1 $2 2>>/dev/null + fi + fi +diff --git a/usb_modeswitch@.service b/usb_modeswitch@.service +index f74a8bf..182604a 100644 +--- a/usb_modeswitch@.service ++++ b/usb_modeswitch@.service +@@ -5,4 +5,5 @@ Description=USB_ModeSwitch_%i + Type=oneshot + ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-mode %i + #ExecStart=/bin/echo %i ++Environment="TMPDIR=/run" + diff --git a/debian/patches/0004-Allow-replacing-pkg-config-with-triplet-pkg-config.patch b/debian/patches/0004-Allow-replacing-pkg-config-with-triplet-pkg-config.patch new file mode 100644 index 0000000..291b302 --- /dev/null +++ b/debian/patches/0004-Allow-replacing-pkg-config-with-triplet-pkg-config.patch @@ -0,0 +1,23 @@ +From: Helmut Grohne <helmut@subdivi.de> +Date: Tue, 30 Aug 2016 14:27:55 +0200 +Subject: Allow replacing pkg-config with <triplet>-pkg-config + +Bug-Debian: https://bugs.debian.org/836018 +--- + Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 9aa7356..c5f2a87 100644 +--- a/Makefile ++++ b/Makefile +@@ -2,7 +2,8 @@ PROG = usb_modeswitch + VERS = 2.6.0 + CC ?= gcc + CFLAGS += -Wall -Wno-deprecated-declarations +-LIBS = `pkg-config --libs --cflags libusb-1.0` ++PKG_CONFIG ?= pkg-config ++LIBS = `$(PKG_CONFIG) --libs --cflags libusb-1.0` + RM = /bin/rm -f + OBJS = usb_modeswitch.c + PREFIX = $(DESTDIR)/usr diff --git a/debian/patches/0005-Add-Documentation-pointer-in-systemd-service-unit.patch b/debian/patches/0005-Add-Documentation-pointer-in-systemd-service-unit.patch new file mode 100644 index 0000000..16f477a --- /dev/null +++ b/debian/patches/0005-Add-Documentation-pointer-in-systemd-service-unit.patch @@ -0,0 +1,19 @@ +From: Didier Raboud <odyx@debian.org> +Date: Fri, 25 Aug 2017 09:24:12 +0200 +Subject: Add Documentation pointer in systemd service unit + +--- + usb_modeswitch@.service | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/usb_modeswitch@.service b/usb_modeswitch@.service +index 182604a..be430b0 100644 +--- a/usb_modeswitch@.service ++++ b/usb_modeswitch@.service +@@ -1,5 +1,6 @@ + [Unit] + Description=USB_ModeSwitch_%i ++Documentation=man:usb_modeswitch_dispatcher(1) + + [Service] + Type=oneshot diff --git a/debian/patches/0006-Changed-the-wrapper-script-to-look-for-interfaces-ac.patch b/debian/patches/0006-Changed-the-wrapper-script-to-look-for-interfaces-ac.patch new file mode 100644 index 0000000..e91d02d --- /dev/null +++ b/debian/patches/0006-Changed-the-wrapper-script-to-look-for-interfaces-ac.patch @@ -0,0 +1,186 @@ +From: Josua Dietze <usb_admin at the domain of the home page> +Date: Sun, 5 Jul 2020 21:56:25 +0200 +Subject: Changed the wrapper script to look for interfaces according to + availability instead of fixed numbers + +This is the pre-2.6.1 patches from https://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?p=19605#p19605 + +LP: #1676763 +--- + usb_modeswitch.c | 50 +++++++++++++++++++++++++++++-------------- + usb_modeswitch_dispatcher.tcl | 11 +++++----- + 2 files changed, 39 insertions(+), 22 deletions(-) + +diff --git a/usb_modeswitch.c b/usb_modeswitch.c +index d0ce0e6..8741a26 100644 +--- a/usb_modeswitch.c ++++ b/usb_modeswitch.c +@@ -1,8 +1,8 @@ + /* + Mode switching tool for controlling mode of 'multi-state' USB devices +- Version 2.6.0, 2019/11/28 ++ Version 2.6.1, 2020/07/04 + +- Copyright (C) 2007 - 2019 Josua Dietze (mail to "usb_admin" at the domain ++ Copyright (C) 2007 - 2020 Josua Dietze (mail to "usb_admin" at the domain + of the home page; or write a personal message through the forum to "Josh". + NO SUPPORT VIA E-MAIL - please use the forum for that) + +@@ -45,7 +45,7 @@ + + /* Recommended tab size: 4 */ + +-#define VERSION "2.6.0" ++#define VERSION "2.6.1" + + #include <stdio.h> + #include <stdlib.h> +@@ -1474,19 +1474,31 @@ int detachDrivers() + if (ret == LIBUSB_ERROR_NOT_SUPPORTED) { + fprintf(output," Can't do driver detection on this platform.\n"); + return 2; ++ } else if (ret < 0) { ++ fprintf(output," Can't determine active driver (error %d)\n", ret); ++ return 2; + } + + struct libusb_config_descriptor *config; +- libusb_get_active_config_descriptor(dev, &config); ++ ret = libusb_get_active_config_descriptor(dev, &config); ++ if (ret < 0) { ++ if (ret == LIBUSB_ERROR_NOT_FOUND) ++ fprintf(output," Device is gone or wasn't configured properly.\n"); ++ else ++ fprintf(output," Can't determine active configuration. Something is wrong with the device (error %d)\n", ret); ++ return 2; ++ } + + for (i=0; i<config->bNumInterfaces; i++) { +- ret = libusb_kernel_driver_active(devh, i); ++ // There are devices without an interface number 0 !! So get the proper iface number ... ++ int ifIdx = config->interface[i].altsetting[0].bInterfaceNumber; ++ ret = libusb_kernel_driver_active(devh, ifIdx); + if (ret < 0) { +- SHOW_PROGRESS(output," Failed to check driver status for interface %d (error %d)\n Try to continue\n",i,ret); ++ SHOW_PROGRESS(output," Failed to check driver status for interface %d (error %d)\n Try to continue\n",ifIdx,ret); + continue; + } + if (ret) { +- ret = libusb_detach_kernel_driver(devh, i); ++ ret = libusb_detach_kernel_driver(devh, ifIdx); + if (ret == LIBUSB_ERROR_NOT_SUPPORTED) { + fprintf(output," Can't do driver detaching on this platform.\n"); + return 2; +@@ -1494,7 +1506,7 @@ int detachDrivers() + if (ret == 0) { + SHOW_PROGRESS(output," OK, driver detached\n"); + } else { +- SHOW_PROGRESS(output," Driver detach failed for interface %d (error %d).\n Try to continue\n",i,ret); ++ SHOW_PROGRESS(output," Driver detach failed for interface %d (error %d).\n Try to continue\n",ifIdx,ret); + continue; + } + } +@@ -1531,7 +1543,7 @@ int sendMessage(char* message, int count) + + int checkSuccess() + { +- int ret, i; ++ int ret, i=0; + int newTargetCount, success=0; + + SHOW_PROGRESS(output,"\nCheck for mode switch (max. %d times, once per second) ...\n", CheckSuccess); +@@ -1584,8 +1596,10 @@ int checkSuccess() + /* 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 ++ * ++ * Note: Wait counter i (seconds) passed on from previous loop; adds up to max ++ * CheckSuccess (parameter) for BOTH loops together + */ +- // Wait counter passed on from previous loop + for (i=i; i < CheckSuccess; i++) { + SHOW_PROGRESS(output," Search for target devices ...\n"); + dev = search_devices(&newTargetCount, TargetVendor, TargetProductList, +@@ -1691,7 +1705,7 @@ struct libusb_device* search_devices( int *numFound, int vendor, char* productLi + { + char *listcopy=NULL, *token; + unsigned char buffer[2]; +- int devClass, product; ++ int devClass, product, ret; + struct libusb_device* right_dev = NULL; + struct libusb_device **devs; + int i=0; +@@ -1760,10 +1774,14 @@ struct libusb_device* search_devices( int *numFound, int vendor, char* productLi + if (targetClass != 0) { + /* TargetClass is set, check class of first interface */ + struct libusb_device_descriptor descriptor; +- libusb_get_device_descriptor(dev, &descriptor); ++ ret = libusb_get_device_descriptor(dev, &descriptor); ++ if (ret < 0) ++ {fprintf(stderr,"Error when retrieving device descriptor: %d\n", ret); return NULL;} + devClass = descriptor.bDeviceClass; + struct libusb_config_descriptor *config; + libusb_get_config_descriptor(dev, 0, &config); ++ if (ret < 0) ++ {fprintf(stderr,"Error when retrieving first config descriptor: %d\n", ret); return NULL;} + int ifaceClass = config->interface[0].altsetting[0].bInterfaceClass; + libusb_free_config_descriptor(config); + if (devClass == 0) +@@ -1864,7 +1882,7 @@ int get_interface_class() + } + + +-/* Parameter parsing */ ++/* Config file parameter parsing */ + + char* ReadParseParam(const char* FileName, char *VariableName) + { +@@ -1985,11 +2003,11 @@ char* ReadParseParam(const char* FileName, char *VariableName) + int hex2num(char c) + { + if (c >= '0' && c <= '9') +- return c - '0'; ++ return c - '0'; + if (c >= 'a' && c <= 'f') +- return c - 'a' + 10; ++ return c - 'a' + 10; + if (c >= 'A' && c <= 'F') +- return c - 'A' + 10; ++ return c - 'A' + 10; + return -1; + } + +diff --git a/usb_modeswitch_dispatcher.tcl b/usb_modeswitch_dispatcher.tcl +index ee9da9e..d60bb62 100755 +--- a/usb_modeswitch_dispatcher.tcl ++++ b/usb_modeswitch_dispatcher.tcl +@@ -138,10 +138,10 @@ set iface 0 + Log "Check class of first interface ..." + set config(class) [IfClass 0 $devdir] + if {$config(class) < 0} { +- Log " No access to interface 0. Exit" ++ Log " No access to first interface. Exit" + SafeExit + } +-Log " Interface 0 class is $config(class)." ++Log " Interface class is $config(class)." + + set ifdir [file tail [IfDir $iface $devdir]] + regexp {:([0-9]+\.[0-9]+)$} $ifdir d iface +@@ -881,13 +881,12 @@ if {$i > 20} {return 0} else {return 1} + + proc {IfDir} {iface devdir} { + +-set allfiles [glob -nocomplain $devdir/*] +-set files [glob -nocomplain $devdir/*.$iface] ++set files [glob -nocomplain $devdir/*\[0-9\].\[0-9\]] + if {[llength $files] == 0} { + return "" + } +-set ifdir [lindex $files 0] +-if {![file isdirectory $ifdir]} { ++set ifdir [lindex [lsort $files] $iface] ++if {![string length $ifdir] || ![file isdirectory $ifdir]} { + return "" + } + return $ifdir diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..af869e4 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,6 @@ +0001-Fix-official-l-y-typo.patch +0002-Detect-if-systemd-is-running-not-only-if-its-corresp.patch +0003-Set-TMPDIR-run-for-usb_modeswitch_dispatcher.patch +0004-Allow-replacing-pkg-config-with-triplet-pkg-config.patch +0005-Add-Documentation-pointer-in-systemd-service-unit.patch +0006-Changed-the-wrapper-script-to-look-for-interfaces-ac.patch |