Hello community, here is the log from the commit of package usb_modeswitch for openSUSE:Factory checked in at 2014-11-05 15:54:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/usb_modeswitch (Old) and /work/SRC/openSUSE:Factory/.usb_modeswitch.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "usb_modeswitch" Changes: -------- --- /work/SRC/openSUSE:Factory/usb_modeswitch/usb_modeswitch.changes 2014-10-14 13:24:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.usb_modeswitch.new/usb_modeswitch.changes 2014-11-05 15:54:56.000000000 +0100 @@ -1,0 +2,16 @@ +Tue Nov 4 19:07:40 UTC 2014 - [email protected] + +- removed patch obsolete huawei-timing.patch to fix boo#903753 + +------------------------------------------------------------------- +Mon Nov 3 21:46:05 UTC 2014 - [email protected] + +- new upstream version 2.2.0 + * Introduction of parameter "HuaweiNewMode", wrapping the standard bulk + message for all newer Huawei devices; support for generic fall-back + config files, combined with OS switch (per vendor ID), implementation + to use a specific switching command on Android for all Huawei devices + (see README of data package for details); this change was suggested + by Huawei + +------------------------------------------------------------------- Old: ---- huawei-timing.patch usb-modeswitch-2.1.1.tar.bz2 New: ---- usb-modeswitch-2.2.0.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ usb_modeswitch.spec ++++++ --- /var/tmp/diff_new_pack.8RM86N/_old 2014-11-05 15:54:59.000000000 +0100 +++ /var/tmp/diff_new_pack.8RM86N/_new 2014-11-05 15:54:59.000000000 +0100 @@ -23,7 +23,7 @@ %endif Name: usb_modeswitch -Version: 2.1.1 +Version: 2.2.0 Release: 0 Summary: A mode switching tool for controlling multiple-device USB gear License: GPL-2.0+ @@ -35,7 +35,6 @@ Source1: http://www.draisberghof.de/usb_modeswitch/%{source_name}-data-%{date}.tar.bz2 Source2: http://www.draisberghof.de/usb_modeswitch/device_reference.txt Source1000: %{name}-data.rpmlintrc -Patch1: huawei-timing.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: fdupes BuildRequires: libusb-devel @@ -63,7 +62,6 @@ %prep %setup -q -a1 -n %{source_name}-%{version} -%patch1 -p1 -d %{source_name}-data-%{date} cp %{SOURCE2} . ++++++ usb-modeswitch-2.1.1.tar.bz2 -> usb-modeswitch-2.2.0.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.1.1/ChangeLog new/usb-modeswitch-2.2.0/ChangeLog --- old/usb-modeswitch-2.1.1/ChangeLog 2014-03-27 20:14:42.000000000 +0100 +++ new/usb-modeswitch-2.2.0/ChangeLog 2014-05-29 20:13:12.000000000 +0200 @@ -2,6 +2,13 @@ History of USB_ModeSwitch ========================= +Version 2.2.0, 2014/05/29 + Introduction of parameter "HuaweiNewMode", wrapping the standard bulk + message for all newer Huawei devices; support for generic fall-back + config files, combined with OS switch (per vendor ID), implementation + to use a specific switching command on Android for all Huawei devices + (see README of data package for details); this change was suggested + by Huawei Version 2.1.1, 2014/03/27 Code cleanup, better use of libusb1; this also fixes problems with determination of the active USB configuration (Samsung, Option modems); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.1.1/Makefile new/usb-modeswitch-2.2.0/Makefile --- old/usb-modeswitch-2.1.1/Makefile 2014-02-22 08:54:41.000000000 +0100 +++ new/usb-modeswitch-2.2.0/Makefile 2014-05-29 20:35:46.000000000 +0200 @@ -1,5 +1,5 @@ PROG = usb_modeswitch -VERS = 2.1.1 +VERS = 2.2.0 CC ?= gcc CFLAGS += -Wall LIBS = `pkg-config --libs --cflags libusb-1.0` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.1.1/usb_modeswitch.1 new/usb-modeswitch-2.2.0/usb_modeswitch.1 --- old/usb-modeswitch-2.1.1/usb_modeswitch.1 2014-03-27 21:33:30.000000000 +0100 +++ new/usb-modeswitch-2.2.0/usb_modeswitch.1 2014-05-29 21:44:16.000000000 +0200 @@ -97,6 +97,8 @@ driver from individual interfaces .IP "\fB-H\fP \fB\-\-huawei-mode\fP " 10 Send a special control message used by older Huawei devices +.IP "\fB-J\fP \fB\-\-huawei-new-mode\fP " 10 +Send a specific bulk message used by all newer Huawei devices .IP "\fB-S\fP \fB\-\-sierra-mode\fP " 10 Send a special control message used by Sierra devices .IP "\fB-G\fP \fB\-\-gct-mode\fP " 10 @@ -171,4 +173,4 @@ The complete text of the current GNU General Public License can be found in http://www.gnu.org/licenses/gpl.txt -.\" last edited 2014-03-27 for version 2.1.1 +.\" last edited 2014-05-29 for version 2.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.1.1/usb_modeswitch.c new/usb-modeswitch-2.2.0/usb_modeswitch.c --- old/usb-modeswitch-2.1.1/usb_modeswitch.c 2014-03-27 21:31:55.000000000 +0100 +++ new/usb-modeswitch-2.2.0/usb_modeswitch.c 2014-05-29 14:27:57.000000000 +0200 @@ -1,8 +1,8 @@ /* Mode switching tool for controlling mode of 'multi-state' USB devices - Version 2.1.1, 2014/03/27 + Version 2.2.0, 2014/05/29 - Copyright (C) 2007 - 2014 Josua Dietze (mail to "usb_admin" at the domain + Copyright (C) 2007 - 2014 Josua Dietze (mail to "digidietze" 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.1.1" +#define VERSION "2.2.0" #include <stdio.h> #include <stdlib.h> @@ -136,6 +136,7 @@ #define QUANTA_MODE 0x00000400 #define BLACKBERRY_MODE 0x00000800 #define PANTECH_MODE 0x00001000 +#define HUAWEINEW_MODE 0x00002000 char verbose=0, show_progress=1, ResetUSB=0, CheckSuccess=0, config_read=0; char NeedResponse=0, NoDriverLoading=0, InquireDevice=0, sysmode=0, mbim=0; @@ -216,6 +217,7 @@ ParseParamHex(configFilename, DefaultProduct); ParseParamBoolMap(configFilename, DetachStorageOnly, ModeMap, DETACHONLY_MODE); ParseParamBoolMap(configFilename, HuaweiMode, ModeMap, HUAWEI_MODE); + ParseParamBoolMap(configFilename, HuaweiNewMode, ModeMap, HUAWEINEW_MODE); ParseParamBoolMap(configFilename, SierraMode, ModeMap, SIERRA_MODE); ParseParamBoolMap(configFilename, SonyMode, ModeMap, SONY_MODE); ParseParamBoolMap(configFilename, GCTMode, ModeMap, GCT_MODE); @@ -273,6 +275,8 @@ fprintf (output,"\nDetachStorageOnly=1\n"); if (ModeMap & HUAWEI_MODE) fprintf (output,"HuaweiMode=1\n"); + if (ModeMap & HUAWEINEW_MODE) + fprintf (output,"HuaweiNewMode=1\n"); if (ModeMap & SIERRA_MODE) fprintf (output,"SierraMode=1\n"); if (ModeMap & SONY_MODE) @@ -334,8 +338,8 @@ while (1) { - c = getopt_long (argc, argv, "hejWQDndKHSOBEGTNALZFRItv:p:V:P:C:m:M:2:3:w:r:c:i:u:a:s:f:b:g:", - long_options, &option_index); + c = getopt_long (argc, argv, "hejWQDndKHJSOBEGTNALZFRItv:p:V:P:C:m:M:2:3:w:r:c:i:u:a:s:f:b:g:", + long_options, &option_index); /* Detect the end of the options. */ if (c == -1) @@ -359,6 +363,7 @@ case 'K': StandardEject = 1; break; case 'd': ModeMap = ModeMap + DETACHONLY_MODE; break; case 'H': ModeMap = ModeMap + HUAWEI_MODE; break; + case 'J': ModeMap = ModeMap + HUAWEINEW_MODE; break; case 'S': ModeMap = ModeMap + SIERRA_MODE; break; case 'O': ModeMap = ModeMap + SONY_MODE; break;; break; case 'B': ModeMap = ModeMap + QISDA_MODE; break; @@ -552,7 +557,7 @@ interfaceClass = get_interface_class(); /* Check or get endpoints */ - if (strlen(MessageContent) || StandardEject || InquireDevice || ModeMap & CISCO_MODE) { + if (strlen(MessageContent) || StandardEject || InquireDevice || ModeMap & CISCO_MODE || ModeMap & HUAWEINEW_MODE) { if (!MessageEndpoint) MessageEndpoint = find_first_bulk_endpoint(LIBUSB_ENDPOINT_OUT); if (!ResponseEndpoint) @@ -709,6 +714,12 @@ strcpy(MessageContent2,"5553424312345679000000000000061b000000020000000000000000000000"); NeedResponse = 1; switchSendMessage(); + } else if (ModeMap & HUAWEINEW_MODE) { + SHOW_PROGRESS(output,"Using standard Huawei switching message\n"); + detachDriver(); + strcpy(MessageContent,"55534243123456780000000000000011062000000101000100000000000000"); + NeedResponse = 0; + switchSendMessage(); } else if (strlen(MessageContent)) { if (InquireDevice != 2) detachDriver(); @@ -1989,6 +2000,7 @@ " -K, --std-eject send standard EJECT sequence\n" " -d, --detach-only detach the active driver, no further action\n" " -H, --huawei-mode apply a special procedure\n" + " -J, --huawei-new-mode apply a special procedure\n" " -S, --sierra-mode apply a special procedure\n" " -O, --sony-mode apply a special procedure\n" " -G, --gct-mode apply a special procedure\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.1.1/usb_modeswitch.h new/usb-modeswitch-2.2.0/usb_modeswitch.h --- old/usb-modeswitch-2.1.1/usb_modeswitch.h 2014-03-27 21:32:26.000000000 +0100 +++ new/usb-modeswitch-2.2.0/usb_modeswitch.h 2014-05-29 21:43:28.000000000 +0200 @@ -2,7 +2,7 @@ This file is part of usb_modeswitch, a mode switching tool for controlling the mode of 'multi-state' USB devices - Version 2.1.1, 2014/03/27 + Version 2.2.0, 2014/05/29 Copyright (C) 2007 - 2014 Josua Dietze Config file parsing stuff borrowed from Guillaume Dargaud diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.1.1/usb_modeswitch.sh new/usb-modeswitch-2.2.0/usb_modeswitch.sh --- old/usb-modeswitch-2.1.1/usb_modeswitch.sh 2014-02-22 08:54:13.000000000 +0100 +++ new/usb-modeswitch-2.2.0/usb_modeswitch.sh 2014-05-29 21:43:41.000000000 +0200 @@ -1,5 +1,5 @@ #!/bin/sh -# part of usb_modeswitch 2.1.1 +# part of usb_modeswitch 2.2.0 device_in() { if [ ! -e /var/lib/usb_modeswitch/$1 ]; then diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.1.1/usb_modeswitch.tcl new/usb-modeswitch-2.2.0/usb_modeswitch.tcl --- old/usb-modeswitch-2.1.1/usb_modeswitch.tcl 2014-03-27 21:35:40.000000000 +0100 +++ new/usb-modeswitch-2.2.0/usb_modeswitch.tcl 2014-05-29 20:34:17.000000000 +0200 @@ -9,7 +9,7 @@ # the mode switching program with the matching parameter # file from /usr/share/usb_modeswitch # -# Part of usb-modeswitch-2.1.1 package +# Part of usb-modeswitch-2.2.0 package # (C) Josua Dietze 2009-2014 set arg0 [lindex $argv 0] @@ -34,6 +34,7 @@ global scsi usb config match device flags setup devdir loginit +set flags(config) "" set flags(logwrite) 0 Log "[ParseGlobalConfig]" @@ -134,13 +135,13 @@ set iface 0 if $ifChk { Log "Check class of first interface ..." - set iclass [IfClass 0] + set config(class) [IfClass 0] if {$iface < 0} { Log " No access to interface 0. Exit" SafeExit } - Log " Interface class is $iclass." - if {$iclass == 8 || $iclass == 3} { + Log " Interface class is $config(class)." + if {$config(class) == "08" || $config(class) == "03"} { } else { Log "No install mode found. Aborting" exit @@ -169,6 +170,9 @@ Log "USB attributes not found in sysfs tree. Exit" SafeExit } +set config(vendor) $usb(idVendor) +set config(product) $usb(idProduct) + if $flags(logging) { Log "\n----------------\nUSB values from sysfs:" @@ -191,16 +195,27 @@ set configParam "" } -# Check if there is more than one config file for this USB ID, -# which would make an attribute test necessary. If so, check if -# SCSI values are needed +# Check (and switch) for operating system if Huawei device present -set configList [ConfigGet conflist $usb(idVendor):$usb(idProduct)] +set flags(os) "linux" +if {$usb(idVendor) == "12d1" && [regexp -nocase {android} [exec cat /proc/version]]} { + set flags(os) "android" +} +if {$flags(os) == "android"} { + set configList [ConfigGet conflist $usb(idVendor):#android] +} else { + set configList [ConfigGet conflist $usb(idVendor):$usb(idProduct)] +} if {[llength $configList] == 0} { Log "Aargh! Config file missing for $usb(idVendor):$usb(idProduct)! Exit" SafeExit } +Log "ConfigList: $configList" + +# Check if there is more than one config file for this USB ID, +# which would make an attribute test necessary. If so, check if +# SCSI values are needed set scsiNeeded 0 if {[llength $configList] > 1} { @@ -229,14 +244,15 @@ # by MatchDevice set report {} -foreach configuration $configList { +foreach mconfig $configList { - # skipping installer leftovers - if [regexp {\.(dpkg|rpm)} $configuration] {continue} + # skipping installer leftovers like "*.rpmnew" + if [regexp {\.(dpkg|rpm)} $mconfig] {continue} - Log "Check config: $configuration" - if [MatchDevice $configuration] { + Log "Check config: $mconfig" + if [MatchDevice $mconfig] { Log "! matched. Read config data" + set flags(config) $mconfig if [string length $usb(busnum)] { set busParam "-b [string trimleft $usb(busnum) 0]" set devParam "-g [string trimleft $usb(devnum) 0]" @@ -244,10 +260,12 @@ set busParam "" set devParam "" } - set configBuffer [ConfigGet conffile $configuration] + set configBuffer [ConfigGet conffile $mconfig] ParseDeviceConfig $configBuffer - if {$config(waitBefore) == ""} { - } else { + if [regexp -nocase {/[0-9a-f]+:#} $flags(config)] { + Log "Note: Using generic manufacturer configuration for \"$flags(os)\"" + } + if {$config(waitBefore) != ""} { Log "Delay time of $config(waitBefore) seconds" append config(waitBefore) "000" after $config(waitBefore) @@ -290,7 +308,7 @@ } break } else { - Log "* no match, not switching with this config" + Log "* no match, don't use this config" } } @@ -304,10 +322,7 @@ SysLog "usb_modeswitch: switched to $usb(idVendor):$usb(idProduct) on [format %03d $usb(busnum)]/[format %03d $usb(devnum)]" } else { Log "\nTarget config not matching - current values are" - set attrList {idVendor idProduct bConfigurationValue manufacturer product serial} - foreach attr [lsort [array names usb]] { - Log " [format %-26s $attr:] $usb($attr)" - } + LogAttributes Log "\nMode switching may have failed. Exit" SafeExit } @@ -640,7 +655,7 @@ proc ConfigGet {command config} { -global setup +global setup usb flags switch $command { @@ -648,6 +663,7 @@ # Unpackaged configs first; sorting is essential for priority set configList [lsort -decreasing [glob -nocomplain $setup(dbdir_etc)/$config*]] set configList [concat $configList [lsort -decreasing [glob -nocomplain $setup(dbdir)/$config*]]] + eval lappend configList [glob -nocomplain $setup(dbdir)/$usb(idVendor):#$flags(os)] if [file exists $setup(dbdir)/configPack.tar.gz] { Log "Found packed config collection $setup(dbdir)/configPack.tar.gz" if [catch {set packedList [exec tar -tzf $setup(dbdir)/configPack.tar.gz 2>/dev/null]} err] { @@ -656,12 +672,12 @@ } set packedList [split $packedList \n] set packedConfigList [lsort -decreasing [lsearch -glob -all -inline $packedList $config*]] + lappend packedConfigList [lsearch -inline $packedList $usb(idVendor):#$flags(os)] # Now add packaged configs with a mark, again sorted for priority foreach packedConfig $packedConfigList { lappend configList "pack/$packedConfig" } } - return $configList } conffile { @@ -981,7 +997,7 @@ proc {CheckSuccess} {devdir} { -global config usb +global config usb flags set ifdir [file tail [IfDir 0]] if {[string length $config(targetClass)] || [string length $config(Configuration)]} { @@ -990,6 +1006,7 @@ } Log "Check success of mode switch for max. $config(checkSuccess) seconds ..." +set expected 1 for {set i 1} {$i <= $config(checkSuccess)} {incr i} { after 1000 if {![file isdirectory $devdir]} { @@ -1005,15 +1022,36 @@ Log " Essential attributes are missing, continue wait ..." continue } - if [string length $config(targetClass)] { - if {![regexp $usb($ifdir/bInterfaceClass) $config(targetClass)]} {continue} - } if [string length $config(Configuration)] { if {$usb(bConfigurationValue) != $config(Configuration)} {continue} } - if {![regexp $usb(idVendor) $config(targetVendor)]} {continue} - if {![regexp $usb(idProduct) $config(targetProduct)]} {continue} - Log " All attributes matched" + if [string length $config(targetClass)] { + if {![regexp $usb($ifdir/bInterfaceClass) $config(targetClass)]} { + if {$config(class) != $usb($ifdir/bInterfaceClass} { + set expected 0 + } else {continue} + } + } + if {![regexp $usb(idVendor) $config(targetVendor)]} { + if {![regexp $usb(idVendor) $config(vendor)]} { + set expected 0 + } else {continue} + } + if {![regexp $usb(idProduct) $config(targetProduct)]} { + if {![regexp $usb(idProduct) $config(product)]} { + set expected 0 + } else {continue} + } + if $expected { + Log " All attributes matched" + } else { + if [regexp -nocase {/[0-9a-f]+:#} $flags(config)] { + Log " idProduct has changed after generic mode-switch, assume success" + } else { + Log " Attributes are different but target values are unexpected:" + LogAttributes + } + } break } if {$i > 20} { @@ -1052,7 +1090,7 @@ set rc [open $ifdir/bInterfaceClass r] set c [read $rc] close $rc -return [string trimleft [string trim $c] 0] +return [string trim $c] } # end of proc {IfClass} @@ -1112,6 +1150,17 @@ } +proc {LogAttributes} {} { + +global flags usb +if $flags(logging) { + set attrList {idVendor idProduct bConfigurationValue manufacturer product serial} + foreach attr [lsort [array names usb]] { + Log " [format %-26s $attr:] $usb($attr)" + } +} + +} # The actual entry point Main $argv $argc -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
