Hello community,

here is the log from the commit of package usb_modeswitch for openSUSE:Factory 
checked in at 2020-10-03 18:53:36
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/usb_modeswitch (Old)
 and      /work/SRC/openSUSE:Factory/.usb_modeswitch.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "usb_modeswitch"

Sat Oct  3 18:53:36 2020 rev:46 rq:838596 version:2.6.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/usb_modeswitch/usb_modeswitch.changes    
2020-01-05 15:20:47.569550001 +0100
+++ /work/SRC/openSUSE:Factory/.usb_modeswitch.new.4249/usb_modeswitch.changes  
2020-10-03 18:53:43.709362259 +0200
@@ -1,0 +2,10 @@
+Thu Sep 17 06:17:44 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 2.6.1:
+  Wrapper now handles devices with non-continuous interface numbering:
+  www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2915&p=19605
+  (thanks to Jakub Vaněk); catch error with retrieving the active confi-
+  guration, exit gracefully
+- use https for downloads, spec-cleaner run
+
+-------------------------------------------------------------------

Old:
----
  usb-modeswitch-2.6.0.tar.bz2

New:
----
  usb-modeswitch-2.6.1.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ usb_modeswitch.spec ++++++
--- /var/tmp/diff_new_pack.YNydhN/_old  2020-10-03 18:53:46.749366208 +0200
+++ /var/tmp/diff_new_pack.YNydhN/_new  2020-10-03 18:53:46.749366208 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package usb_modeswitch
 #
-# Copyright (c) 2019 SUSE LLC
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -20,26 +20,25 @@
 %define date           20191128
 %define _udevdir %(pkg-config --variable=udevdir udev)
 Name:           usb_modeswitch
-Version:        2.6.0
+Version:        2.6.1
 Release:        0
 Summary:        A mode switching tool for controlling multiple-device USB gear
-License:        GPL-2.0+
+License:        GPL-2.0-or-later
 Group:          Hardware/Mobile
-Url:            http://www.draisberghof.de/usb_modeswitch
-Source0:        
http://www.draisberghof.de/usb_modeswitch/%{source_name}-%{version}.tar.bz2
-Source1:        
http://www.draisberghof.de/usb_modeswitch/%{source_name}-data-%{date}.tar.bz2
-Source2:        http://www.draisberghof.de/usb_modeswitch/device_reference.txt
-Source3:        
http://www.draisberghof.de/usb_modeswitch/parameter_reference.txt
+URL:            https://www.draisberghof.de/usb_modeswitch/
+Source0:        
https://www.draisberghof.de/usb_modeswitch/%{source_name}-%{version}.tar.bz2
+Source1:        
https://www.draisberghof.de/usb_modeswitch/%{source_name}-data-%{date}.tar.bz2
+Source2:        https://www.draisberghof.de/usb_modeswitch/device_reference.txt
+Source3:        
https://www.draisberghof.de/usb_modeswitch/parameter_reference.txt
 Patch1:         usb_modeswitch-fix_fsf_address.patch
 BuildRequires:  fdupes
-BuildRequires:  pkg-config
+BuildRequires:  pkgconfig
 BuildRequires:  pkgconfig(libusb-1.0)
-BuildRequires:  pkgconfig(udev)
 BuildRequires:  pkgconfig(systemd)
-%{?systemd_requires}
+BuildRequires:  pkgconfig(udev)
 Requires:       tcl >= 8.4
 Requires:       usb_modeswitch-data = %{version}
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+%{?systemd_requires}
 
 %description
 USB_ModeSwitch is a mode switching tool for controlling "flip flop"
@@ -91,19 +90,18 @@
 %service_del_postun [email protected]
 
 %files
-%defattr(-,root,root,-)
-%doc README COPYING device_reference.txt parameter_reference.txt
+%license COPYING
+%doc README device_reference.txt parameter_reference.txt
 %{_sbindir}/usb_modeswitch
 %{_sbindir}/usb_modeswitch_dispatcher
 %{_udevdir}/usb_modeswitch
 %{_unitdir}/[email protected]
 %{_localstatedir}/lib/usb_modeswitch
 %config %{_sysconfdir}/usb_modeswitch.conf
-%{_mandir}/man1/usb_modeswitch.1.gz
-%{_mandir}/man1/usb_modeswitch_dispatcher.1.gz
+%{_mandir}/man1/usb_modeswitch.1%{?ext_man}
+%{_mandir}/man1/usb_modeswitch_dispatcher.1%{?ext_man}
 
 %files data
-%defattr(-,root,root,-)
 %{_datadir}/usb_modeswitch/
 %{_udevdir}/rules.d/40-usb_modeswitch.rules
 

++++++ usb-modeswitch-2.6.0.tar.bz2 -> usb-modeswitch-2.6.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/ChangeLog 
new/usb-modeswitch-2.6.1/ChangeLog
--- old/usb-modeswitch-2.6.0/ChangeLog  2019-11-28 22:06:03.000000000 +0100
+++ new/usb-modeswitch-2.6.1/ChangeLog  2020-07-10 17:56:59.000000000 +0200
@@ -2,6 +2,11 @@
 History of USB_ModeSwitch
 =========================
 
+Version 2.6.1, 2020/07/10
+    Wrapper now handles devices with non-continuous interface numbering:
+    www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2915&p=19605
+    (thanks to Jakub Vaněk); catch error with retrieving the active confi-
+    guration, exit gracefully: https://bugs.launchpad.net/bugs/1880191
 Version 2.6.0, 2019/11/28
     Removed included libjim source alltogether; rewrote parts of the
     dispatcher script to make location of global config file into a
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/Makefile 
new/usb-modeswitch-2.6.1/Makefile
--- old/usb-modeswitch-2.6.0/Makefile   2019-11-11 21:45:13.000000000 +0100
+++ new/usb-modeswitch-2.6.1/Makefile   2020-07-05 15:53:24.000000000 +0200
@@ -1,5 +1,5 @@
 PROG        = usb_modeswitch
-VERS        = 2.6.0
+VERS        = 2.6.1
 CC          ?= gcc
 CFLAGS      += -Wall -Wno-deprecated-declarations
 LIBS        = `pkg-config --libs --cflags libusb-1.0`
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/dispatcher.c 
new/usb-modeswitch-2.6.1/dispatcher.c
--- old/usb-modeswitch-2.6.0/dispatcher.c       2019-10-10 20:59:15.000000000 
+0200
+++ new/usb-modeswitch-2.6.1/dispatcher.c       2020-05-26 21:07:10.000000000 
+0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2019 Josua Dietze, usb_modeswitch version 2.6.0
+ * Copyright (c) 2011-2020 Josua Dietze, usb_modeswitch version 2.6.1
  * Contains code under
  * Copyright (c) 2010 Wojciech A. Koszek <[email protected]>
  * All rights reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/make_string.sh 
new/usb-modeswitch-2.6.1/make_string.sh
--- old/usb-modeswitch-2.6.0/make_string.sh     2019-11-28 22:06:48.000000000 
+0100
+++ new/usb-modeswitch-2.6.1/make_string.sh     2020-07-09 17:36:30.000000000 
+0200
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-# (c) Josua Dietze 2019
+# (c) Josua Dietze 2019-2020
 #
 # Usage: make_string.sh source.tcl > [condensed tcl]
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/usb_modeswitch.c 
new/usb-modeswitch-2.6.1/usb_modeswitch.c
--- old/usb-modeswitch-2.6.0/usb_modeswitch.c   2019-11-27 21:00:01.000000000 
+0100
+++ new/usb-modeswitch-2.6.1/usb_modeswitch.c   2020-07-10 17:48:03.000000000 
+0200
@@ -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/10
 
-  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 @@
        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 @@
                        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 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 @@
                /* 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 @@
 {
        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 @@
                                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 @@
 }
 
 
-/* Parameter parsing */
+/* Config file parameter parsing */
 
 char* ReadParseParam(const char* FileName, char *VariableName)
 {
@@ -1985,11 +2003,11 @@
 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/usb_modeswitch.h 
new/usb-modeswitch-2.6.1/usb_modeswitch.h
--- old/usb-modeswitch-2.6.0/usb_modeswitch.h   2019-11-27 21:00:34.000000000 
+0100
+++ new/usb-modeswitch-2.6.1/usb_modeswitch.h   2020-07-10 17:48:12.000000000 
+0200
@@ -2,8 +2,8 @@
   This file is part of usb_modeswitch, a mode switching tool for controlling
   the mode of 'multi-state' USB devices
 
-  Version 2.6.0, 2019/11/28
-  Copyright (C) 2007 - 2019  Josua Dietze
+  Version 2.6.1, 2020/07/10
+  Copyright (C) 2007-2020  Josua Dietze
 
   Config file parsing stuff borrowed from Guillaume Dargaud
   (http://www.gdargaud.net/Hack/SourceCode.html)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/usb_modeswitch.sh 
new/usb-modeswitch-2.6.1/usb_modeswitch.sh
--- old/usb-modeswitch-2.6.0/usb_modeswitch.sh  2019-11-27 21:04:55.000000000 
+0100
+++ new/usb-modeswitch-2.6.1/usb_modeswitch.sh  2020-07-05 15:54:19.000000000 
+0200
@@ -1,5 +1,5 @@
 #!/bin/sh
-# part of usb_modeswitch 2.6.0
+# part of usb_modeswitch 2.6.1
 device_in()
 {
        if [ ! -e /var/lib/usb_modeswitch/$1 ]; then
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/[email protected] 
new/usb-modeswitch-2.6.1/[email protected]
--- old/usb-modeswitch-2.6.0/[email protected]    2019-11-28 
21:59:35.000000000 +0100
+++ new/usb-modeswitch-2.6.1/[email protected]    2020-05-26 
20:57:21.000000000 +0200
@@ -4,5 +4,6 @@
 [Service]
 Type=oneshot
 ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-mode %i
-#ExecStart=/bin/echo %i
+# Testing
+#ExecStart=/bin/echo "usb_modeswitch.service: device name is %i"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/usb-modeswitch-2.6.0/usb_modeswitch_dispatcher.tcl 
new/usb-modeswitch-2.6.1/usb_modeswitch_dispatcher.tcl
--- old/usb-modeswitch-2.6.0/usb_modeswitch_dispatcher.tcl      2019-11-28 
21:14:34.000000000 +0100
+++ new/usb-modeswitch-2.6.1/usb_modeswitch_dispatcher.tcl      2020-07-10 
17:57:39.000000000 +0200
@@ -9,8 +9,20 @@
 # the mode switching program with the matching parameter
 # file from /usr/share/usb_modeswitch
 #
-# Part of usb-modeswitch-2.6.0 package
-# (C) Josua Dietze 2009-2019
+# Part of usb-modeswitch-2.6.1 package, 2020/07/10
+# (C) Josua Dietze 2009 - 2020
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details:
+#
+# http://www.gnu.org/licenses/gpl.txt
 
 set arg0 [lindex $argv 0]
 if [regexp {\.tcl$} $arg0] {
@@ -138,10 +150,10 @@
 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 +893,14 @@
 
 proc {IfDir} {iface devdir} {
 
-set allfiles [glob -nocomplain $devdir/*]
-set files [glob -nocomplain $devdir/*.$iface]
-if {[llength $files] == 0} {
+set files [glob -nocomplain $devdir/*]
+set iffiles [lsort [lsearch -all -inline -regexp $files 
{^.*/[^/]*[0-9]+\.[0-9]$}]]
+set sorted [concat $iffiles [lsort [lsearch -all -inline -regexp $files 
{^.*/[^/]*[0-9]+\.[0-9][0-9]$}]]]
+if {[llength $sorted] == 0} {
        return ""
 }
-set ifdir [lindex $files 0]
-if {![file isdirectory $ifdir]} {
+set ifdir [lindex $sorted $iface]
+if {![string length $ifdir] || ![file isdirectory $ifdir]} {
        return ""
 }
 return $ifdir
@@ -895,6 +908,7 @@
 }
 # end of proc {IfDir}
 
+
 proc {IfClass} {iface devdir} {
 
 set ifdir [IfDir $iface $devdir]
@@ -940,6 +954,7 @@
 }
 # end of proc {SysLog}
 
+
 proc {SetStorageDelay} {secs} {
 
 Log "Adjust delay for USB storage devices ..."
@@ -964,6 +979,7 @@
 }
 # end of proc {SetStorageDelay}
 
+
 proc {CheckMBIM} {} {
 
 set kversion [exec uname -r]
@@ -972,6 +988,8 @@
 return 0
 
 }
+# end of proc {CheckMBIM}
+
 
 proc {CheckQMI} {} {
 
@@ -981,6 +999,8 @@
 return 0
 
 }
+# end of proc {CheckQMI}
+
 
 proc {PantechAutoSwitch} {} {
 
@@ -1001,6 +1021,8 @@
 } else {return 0}
 
 }
+# end of proc {PantechAutoSwitch}
+
 
 proc {LogAttributes} {} {
 
@@ -1013,6 +1035,8 @@
 }
 
 }
+# end of proc {LogAttributes}
+
 
 proc {HasFF} {devdir} {
 
@@ -1025,6 +1049,7 @@
 return 0
 
 }
+# end of proc {HasFF}
 
 
 # The actual entry point


Reply via email to