From 50f24fe734549610d653c8dab0bbdabf5a056ee7 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 03 2016 06:22:47 +0000 Subject: import usb_modeswitch-2.4.0-5.el7 --- diff --git a/.gitignore b/.gitignore index e657006..791871c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/usb-modeswitch-1.2.7.tar.bz2 +SOURCES/usb-modeswitch-2.4.0.tar.bz2 diff --git a/.usb_modeswitch.metadata b/.usb_modeswitch.metadata index a3f79dc..2363ce6 100644 --- a/.usb_modeswitch.metadata +++ b/.usb_modeswitch.metadata @@ -1 +1 @@ -2fb5fa8341afb71c88edfb0abaa8dffec3796644 SOURCES/usb-modeswitch-1.2.7.tar.bz2 +12fc5f398e2f1290f3e5f2f1610a1ad2332edf79 SOURCES/usb-modeswitch-2.4.0.tar.bz2 diff --git a/SOURCES/0001-Bring-back-the-module-binding.patch b/SOURCES/0001-Bring-back-the-module-binding.patch new file mode 100644 index 0000000..8228f95 --- /dev/null +++ b/SOURCES/0001-Bring-back-the-module-binding.patch @@ -0,0 +1,334 @@ +From cf2afa734597ef88b8f5871bf18cf849b105e51d Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Mon, 25 Jul 2016 12:03:22 +0200 +Subject: [PATCH] Bring back the module binding + +We still need it for some devices. + +http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2560 +--- + usb_modeswitch.sh | 23 +++++- + usb_modeswitch.tcl | 214 +++++++++++++++++++++++++++++++++++++++++++++++++---- + 2 files changed, 221 insertions(+), 16 deletions(-) + +diff --git a/usb_modeswitch.sh b/usb_modeswitch.sh +index b126ec3..f4b76dd 100755 +--- a/usb_modeswitch.sh ++++ b/usb_modeswitch.sh +@@ -40,7 +40,27 @@ fi + PATH=/sbin:/usr/sbin:$PATH + case "$1" in + --driver-bind) +- # driver binding code removed ++ ( ++ dir=$(ls -d /sys$2/ttyUSB* 2>/dev/null) ++ sleep 1 ++ if [ ! -z "$dir" ]; then ++ exit 0 ++ fi ++ set +e ++ device_in "bind_list" $v_id $p_id ++ if [ "$?" = "1" ]; then ++ id_attr="/sys/bus/usb-serial/drivers/option1/new_id" ++ if [ ! -e "$id_attr" ]; then ++ modprobe option 2>/dev/null || true ++ fi ++ if [ -e "$id_attr" ]; then ++ echo "$v_id $p_id ff" > $id_attr ++ else ++ modprobe -r usbserial 2>/dev/null ++ modprobe usbserial "vendor=0x$v_id" "product=0x$p_id" 2>/dev/null ++ fi ++ fi ++ ) & + exit 0 + ;; + --symlink-name) +@@ -53,7 +73,6 @@ case "$1" in + exit 0 + ;; + esac +- + IFS='/' read -r p1 p2 < 0} { + set config(Configuration) $cfgno ++ set config(DriverModule) "" + set flags(config) "Configuration=$cfgno" + } else { + Log " No MBIM configuration found, switch to legacy modem mode" +@@ -290,10 +291,6 @@ foreach mconfig $configList { + set report "ok:busdev" + break + } +- if {$config(Configuration) == 0} { +- Log "Config file contains dummy method, do nothing. Exit" +- SafeExit +- } + UnbindDriver $devdir $ifdir + # Now we are actually switching + if $flags(logging) { +@@ -348,19 +345,68 @@ if [regexp {ok:busdev} $report] { + ReadUSBAttrs $devdir $ifdir + } + +-# driver binding removed !! ++# Checking for bound drivers if there is an interface with class 0xff + +-if {[string length "$usb(idVendor)$usb(idProduct)"] < 8} { +- if {![regexp {ok:(\w{4}):(\w{4})} $report d usb(idVendor) usb(idProduct)]} { +- Log "No target vendor/product ID found or given, can't continue. Abort" +- SafeExit ++if {$config(DriverModule) != "" && [regexp {ok:} $report]} { ++ if [HasFF $devdir] { ++ AddToList link_list $usb(idVendor):$usb(idProduct) ++ } else { ++ set config(DriverModule) "" ++ Log " No vendor-specific class found, skip driver check" + } + } +-# wait for drivers to bind +-after 500 +-if {[llength [glob -nocomplain $devdir/$ifdir/ttyUSB*]] > 0} { +- Log "Serial USB driver bound to interface 0\n will try to guess and symlink modem port on next connect" +- AddToList link_list $usb(idVendor):$usb(idProduct) ++ ++# If module is set (it is by default), driver shall be loaded. ++# If not, then NoDriverLoading is active ++ ++if {$config(DriverModule) != ""} { ++ if {[string length "$usb(idVendor)$usb(idProduct)"] < 8} { ++ if {![regexp {ok:(\w{4}):(\w{4})} $report d usb(idVendor) usb(idProduct)]} { ++ Log "No target vendor/product ID found or given, can't continue. Abort" ++ SafeExit ++ } ++ } ++ # wait for any drivers to bind automatically ++ after 1500 ++ Log "Now check for bound driver ..." ++ if {![file exists $devdir/$ifdir/driver]} { ++ Log " no driver has bound to interface 0 yet" ++ ++ # If device is known, the sh wrapper will take care, else: ++ if {[InBindList $usb(idVendor):$usb(idProduct)] == 0} { ++ Log "Device is not in \"bind_list\" yet, bind it now" ++ ++ # Load driver ++ CheckDriverBind $usb(idVendor) $usb(idProduct) ++ ++ # Old/slow systems may take a while to create the devices ++ set counter 0 ++ while {![file exists $devdir/$ifdir/driver]} { ++ if {$counter == 14} {break} ++ after 500 ++ incr counter ++ } ++ if {$counter == 14} { ++ Log " driver binding failed" ++ } else { ++ Log " driver was bound to the device" ++ AddToList bind_list $usb(idVendor):$usb(idProduct) ++ } ++ } ++ } else { ++ Log " driver has bound, device is known" ++ if {[llength [glob -nocomplain $devdir/$ifdir/ttyUSB*]] > 0} { ++ AddToList link_list $usb(idVendor):$usb(idProduct) ++ } ++ } ++} else { ++ # Just in case "NoDriverLoading" was added after the first bind ++ RemoveFromBindList $usb(idVendor):$usb(idProduct) ++} ++ ++if [regexp {ok:$} $report] { ++ # "NoDriverLoading" was set ++ Log "No driver check or bind for this device" + } + + # In newer kernels there is a switch to avoid the use of a device +@@ -553,6 +599,8 @@ return "Use global config file: $configFile" + proc ParseDeviceConfig {cfg} { + + global config ++set config(DriverModule) "" ++set config(DriverIDPath) "" + set config(WaitBefore) "" + set config(TargetVendor) "" + set config(TargetProduct) "" +@@ -561,6 +609,7 @@ set config(Configuration) "" + set config(NoMBIMCheck) 0 + set config(PantechMode) 0 + set config(CheckSuccess) 20 ++set loadDriver 1 + + foreach pname [lsort [array names config]] { + if [regexp -line "^\[^# \]*?$pname.*?= *(0x(\\w+)|\"(\[0-9a-fA-F,\]+)\"|(\[0-9\]+)) *\$" $cfg d config($pname)] { +@@ -568,6 +617,26 @@ foreach pname [lsort [array names config]] { + } + } + ++if [regexp -line {^[^#]*?NoDriverLoading.*?=.*?(1|yes|true).*?$} $cfg] { ++ set loadDriver 0 ++ Log "config: NoDriverLoading is set to active" ++} ++ ++# For general driver loading; TODO: add respective device names. ++# Presently only useful for HSO devices (which are recounted now) ++if $loadDriver { ++ if {$config(DriverModule) == ""} { ++ set config(DriverModule) "option" ++ set config(DriverIDPath) "/sys/bus/usb-serial/drivers/option1" ++ } else { ++ if {$config(DriverIDPath) == ""} { ++ set config(DriverIDPath) "/sys/bus/usb/drivers/$config(DriverModule)" ++ } ++ } ++ Log "Driver module is \"$config(DriverModule)\", ID path is $config(DriverIDPath)\n" ++} else { ++ Log "Driver will not be handled by usb_modeswitch" ++} + set config(WaitBefore) [string trimleft $config(WaitBefore) 0] + + } +@@ -768,6 +837,92 @@ return $symlinkName + # end of proc {SymLinkName} + + ++# Load and bind driver (default "option") ++# ++proc {CheckDriverBind} {vid pid} { ++global config ++ ++foreach fn {/sbin/modprobe /usr/sbin/modprobe} { ++ if [file exists $fn] { ++ set loader $fn ++ } ++} ++Log "Module loader is $loader" ++ ++set idfile $config(DriverIDPath)/new_id ++if {![file exists $idfile]} { ++ if {$loader == ""} { ++ Log "Can't do anymore without module loader; get \"modtools\"!" ++ return ++ } ++ Log "\nTry to load module \"$config(DriverModule)\"" ++ if [catch {set result [exec $loader -v $config(DriverModule)]} err] { ++ Log " Running \"$loader $config(DriverModule)\" gave an error:\n $err" ++ } else { ++ Log " Module was loaded successfully:\n$result" ++ } ++} else { ++ Log "Module is active already" ++} ++set i 0 ++while {$i < 50} { ++ if [file exists $idfile] { ++ break ++ } ++ after 20 ++ incr i ++} ++if {$i < 50} { ++ Log "Try to add ID to driver \"$config(DriverModule)\"" ++ SysLog "usb_modeswitch: add device ID $vid:$pid to driver \"$config(DriverModule)\"" ++ SysLog "usb_modeswitch: please report the device ID to the Linux USB developers!" ++ if [catch {exec echo "$vid $pid ff" >$idfile} err] { ++ Log " Error adding ID to driver:\n $err" ++ } else { ++ Log " ID added to driver; check for new devices in /dev" ++ } ++} else { ++ Log " \"$idfile\" not found, check if kernel version is at least 2.6.27" ++ Log "Fall back to \"usbserial\"" ++ set config(DriverModule) usbserial ++ Log "\nTry to unload driver \"usbserial\"" ++ if [catch {exec $loader -r usbserial} err] { ++ Log " Running \"$loader -r usbserial\" gave an error:\n $err" ++ Log "No more fallbacks" ++ return ++ } ++ after 50 ++ Log "\nTry to load driver \"usbserial\" with device IDs" ++ if [catch {set result [exec $loader -v usbserial vendor=0x$vid product=0x$pid]} err] { ++ Log " Running \"$loader usbserial\" gave an error:\n $err" ++ } else { ++ Log " Driver was loaded successfully:\n$result" ++ } ++} ++ ++} ++# end of proc {CheckDriverBind} ++ ++ ++# Check if USB ID is listed as needing driver binding ++proc {InBindList} {id} { ++ ++set listfile /var/lib/usb_modeswitch/bind_list ++if {![file exists $listfile]} {return 0} ++set rc [open $listfile r] ++set buffer [read $rc] ++close $rc ++if [string match *$id* $buffer] { ++Log "Found $id in bind_list" ++ return 1 ++} else { ++Log "No $id in bind_list" ++ return 0 ++} ++ ++} ++# end of proc {InBindList} ++ + # Add USB ID to list of devices needing later treatment + proc {AddToList} {name id} { + +@@ -791,6 +946,37 @@ close $lc + # end of proc {AddToList} + + ++# Remove USB ID from bind list (NoDriverLoading is set) ++proc {RemoveFromBindList} {id} { ++ ++set listfile /var/lib/usb_modeswitch/bind_list ++if [file exists $listfile] { ++ set rc [open $listfile r] ++ set buffer [read $rc] ++ close $rc ++ set idList [split [string trim $buffer] \n] ++} else { ++ return ++} ++set idx [lsearch $idList $id] ++if {$idx > -1} { ++ set idList [lreplace $idList $idx $idx] ++} else { ++ return ++} ++if {[llength $idList] == 0} { ++ file delete $listfile ++ return ++} ++set buffer [join $idList "\n"] ++if [catch {set lc [open $listfile w]}] {return} ++puts $lc $buffer ++close $lc ++ ++} ++# end of proc {RemoveFromBindList} ++ ++ + proc {CheckSuccess} {devdir} { + + global config usb flags +-- +2.7.4 + diff --git a/SOURCES/0001-Fix-crash-on-early-fail.patch b/SOURCES/0001-Fix-crash-on-early-fail.patch new file mode 100644 index 0000000..bab74dc --- /dev/null +++ b/SOURCES/0001-Fix-crash-on-early-fail.patch @@ -0,0 +1,29 @@ +From 73001792b29f080fcabc57f30d6030bedb2a24b0 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Wed, 20 Jul 2016 21:14:10 +0200 +Subject: [PATCH] Fix crash on early fail + +Don't uninitialize libusb if it has not been initialized yet. + +https://bugzilla.redhat.com/show_bug.cgi?id=1358472 +--- + usb_modeswitch.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/usb_modeswitch.c b/usb_modeswitch.c +index cbb8c28..f9c8b2e 100644 +--- a/usb_modeswitch.c ++++ b/usb_modeswitch.c +@@ -2021,7 +2021,8 @@ void close_all() + libusb_close(devh); + // libusb_exit will crash on Raspbian 7, crude protection + #ifndef __ARMEL__ +- libusb_exit(NULL); ++ if (ctx) ++ libusb_exit(NULL); + #endif + if (sysmode) + closelog(); +-- +2.7.4 + diff --git a/SOURCES/0001-usb_modeswitch-don-t-return-a-value-from-stack.patch b/SOURCES/0001-usb_modeswitch-don-t-return-a-value-from-stack.patch new file mode 100644 index 0000000..afe92a4 --- /dev/null +++ b/SOURCES/0001-usb_modeswitch-don-t-return-a-value-from-stack.patch @@ -0,0 +1,34 @@ +From 93686f8ba8c1ed6bf559dbfda53f9c7d702c76b5 Mon Sep 17 00:00:00 2001 +From: Lubomir Rintel +Date: Thu, 21 Jul 2016 18:13:58 +0200 +Subject: [PATCH] usb_modeswitch: don't return a value from stack + +The memory is not allocated anymore when the function returns and that +causes no end of mayhem and undefined behavior. + +Let's make it static so that it's perserved after the return. It wastes +LINE_DIM bytes of memory and requires the caller to consume the value +before another call, but that's no problem. + +http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2557 +--- + usb_modeswitch.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/usb_modeswitch.c b/usb_modeswitch.c +index f9c8b2e..3373ccf 100644 +--- a/usb_modeswitch.c ++++ b/usb_modeswitch.c +@@ -1855,7 +1855,8 @@ char* ReadParseParam(const char* FileName, char *VariableName) + char *FirstQuote, *LastQuote, *P1, *P2; + int Line=0; + unsigned Len=0, Pos=0; +- char Str[LINE_DIM], *token, *configPos; ++ static char Str[LINE_DIM]; ++ char *token, *configPos; + FILE *file = NULL; + + // Reading and storing input during the first call +-- +2.7.4 + diff --git a/SOURCES/rhbz948451-fix-manual-pages.patch b/SOURCES/rhbz948451-fix-manual-pages.patch index 0ebae61..32238b9 100644 --- a/SOURCES/rhbz948451-fix-manual-pages.patch +++ b/SOURCES/rhbz948451-fix-manual-pages.patch @@ -1,99 +1,23 @@ -diff -up usb-modeswitch-1.2.7/usb_modeswitch.1.fix-manual-pages usb-modeswitch-1.2.7/usb_modeswitch.1 ---- usb-modeswitch-1.2.7/usb_modeswitch.1.fix-manual-pages 2013-08-20 12:07:24.292188457 +0200 -+++ usb-modeswitch-1.2.7/usb_modeswitch.1 2013-08-20 12:30:41.606556395 +0200 -@@ -48,10 +48,12 @@ Product ID to look for (mandatory) - Target vendor ID. When given will be searched for and detected initially - for information purposes. If success checking (option \-s) is active, - providing target IDs (vendor/product) or target class is recommended -+.IP "\fB-j\fP \fB\-\-find-mbim\fP " 10 -+Return configuration number with MBIM interface and exit. - .IP "\fB-P\fP \fB\-\-target-product NUM\fP " 10 - Target product ID --.IP "\fB-b\fP \fB\-\-busnum NUM\fP " 10 --.IP "\fB-g\fP \fB\-\-devnum NUM\fP " 10 -+.IP "\fB-b\fP \fB\-\-bus-num NUM\fP " 10 -+.IP "\fB-g\fP \fB\-\-device-num NUM\fP " 10 - If bus and device number are provided, the handling of a specific device on - a specific USB port is guaranteed, in contrast to using only the USB ID. This - is important if there are multiple similar devices on a system -@@ -110,7 +112,7 @@ Send a special control message used by P - .IP "\fB-Z\fP \fB\-\-blackberry-mode\fP " 10 - Send a special control message used by Blackberry devices - .IP "\fB-O\fP \fB\-\-sony-mode\fP " 10 --Apply a special sequence used by Sony Ericsson devices. Implies option \--success -+Apply a special sequence used by Sony Ericsson devices. Implies option \--check-success - .IP "\fB-L\fP \fB\-\-cisco-mode\fP " 10 - Send a sequence of bulk messages used by Cisco devices - .IP "\fB-R\fP \fB\-\-reset-usb\fP " 10 -@@ -119,7 +121,7 @@ method or stand alone. It is always done - interactions. - Few devices need it to complete the switching; apart from that it may be - useful during testing --.IP "\fB-c\fP \fB\-\-config FILENAME\fP " 10 -+.IP "\fB-c\fP \fB\-\-config-file FILENAME\fP " 10 - Use a specific config file. If any ID or switching options are given as - command line parameters, this option is ignored. - In that case all mandatory parameters have to be provided on -@@ -138,7 +140,7 @@ Print all settings before running and sh - Changes the behaviour of the program slightly. A success message including the - effective target device ID is put out and a syslog notice is issued. Mainly for - integration with a wrapper script --.IP "\fB-s\fP \fB\-\-success NUM\fP " 10 -+.IP "\fB-s\fP \fB\-\-check-success NUM\fP " 10 - After switching, keep checking for the result up to max. NUM seconds. If target IDs - or target class were provided, their appearance indicates certain success. Otherwise - the disconnection of the original device is rated as likely proof -diff -up usb-modeswitch-1.2.7/usb_modeswitch.c.fix-manual-pages usb-modeswitch-1.2.7/usb_modeswitch.c ---- usb-modeswitch-1.2.7/usb_modeswitch.c.fix-manual-pages 2013-08-20 12:12:10.752953754 +0200 -+++ usb-modeswitch-1.2.7/usb_modeswitch.c 2013-08-20 12:37:27.415242925 +0200 -@@ -1968,11 +1968,12 @@ void printHelp() - " -V, --target-vendor NUM target mode vendor ID (optional)\n" - " -P, --target-product NUM target mode product ID (optional)\n" - " -C, --target-class NUM target mode device class (optional)\n" -- " -b, --busnum NUM system bus number of device (for hard ID)\n" -- " -g, --devnum NUM system device number (for hard ID)\n" -+ " -b, --bus-num NUM system bus number of device (for hard ID)\n" -+ " -g, --device-num NUM system device number (for hard ID)\n" +diff --git a/usb_modeswitch.c b/usb_modeswitch.c +index 52598f7..cbb8c28 100644 +--- a/usb_modeswitch.c ++++ b/usb_modeswitch.c +@@ -2060,7 +2060,8 @@ void printHelp() + " -g, --device-num NUM system device number (for hard ID)\n" " -m, --message-endpoint NUM direct the message transfer there (optional)\n" " -M, --message-content message to send (hex number as string)\n" - " -2 , -3 additional messages to send (-n recommended)\n" + " -2, --message-content2 additional messages to send (-n recommended)\n" + " -3, --message-content3 additional messages to send (-n recommended)\n" - " -n, --need-response read response to the message transfer (CSW)\n" + " -w, --release-delay NUM wait NUM ms before releasing the interface\n" + " -n, --need-response obsolete, no effect (always on)\n" " -r, --response-endpoint NUM read response from there (optional)\n" - " -d, --detach-only detach the active driver, no further action\n" -@@ -1989,10 +1990,11 @@ void printHelp() - " -Z, --blackberry-mode apply a special procedure\n" - " -F, --pantech-mode apply a special procedure\n" - " -R, --reset-usb reset the device after all other actions\n" -+ " -w, --release-delay delay releasing the interface\n" +@@ -2084,7 +2085,7 @@ void printHelp() " -Q, --quiet don't show progress or error messages\n" " -W, --verbose print all settings and debug output\n" " -D, --sysmode specific result and syslog message\n" - " -s, --success switching result check with timeout\n" + " -s, --check-success switching result check with timeout\n" - " -I, --no-inquire do not get SCSI attributes (default on)\n\n" + " -I, --inquire obsolete, no effect\n\n" " -c, --config-file load long configuration from file\n\n" " -t, --stdinput read long configuration from stdin\n\n" -diff -up usb-modeswitch-1.2.7/usb_modeswitch_dispatcher.1.fix-manual-pages usb-modeswitch-1.2.7/usb_modeswitch_dispatcher.1 ---- usb-modeswitch-1.2.7/usb_modeswitch_dispatcher.1.fix-manual-pages 2013-08-20 11:59:15.467713141 +0200 -+++ usb-modeswitch-1.2.7/usb_modeswitch_dispatcher.1 2013-08-20 12:57:51.913947292 +0200 -@@ -0,0 +1,18 @@ -+.TH "USB_MODESWITCH_DISPATCHER" "1" -+.SH "NAME" -+usb_modeswitch_dispatcher - dispatcher not intended for direct invocation. -+.SH "SYNOPSIS" -+.PP -+\fBusb_modeswitch_dispatcher\fR -+.SH "DESCRIPTION" -+.PP -+usb_modeswitch_dispatcher is doing additional device checking and -+using the usb_modeswitch binary to switch with the selected device config file. -+If no drivers are taking care of the device after the mode switch, the dispatcher -+will try to load and bind the "option" serial driver, in order to make the device -+usable. -+.PP -+This program is called by udev and is not supposed to be called directly -+by the user. -+.SH SEE ALSO -+.BR usb_modeswitch(1). diff --git a/SPECS/usb_modeswitch.spec b/SPECS/usb_modeswitch.spec index 3d68656..f8b28ca 100644 --- a/SPECS/usb_modeswitch.spec +++ b/SPECS/usb_modeswitch.spec @@ -1,23 +1,38 @@ %define source_name usb-modeswitch Name: usb_modeswitch -Version: 1.2.7 -Release: 6%{?dist} +Version: 2.4.0 +Release: 5%{?dist} Summary: USB Modeswitch gets mobile broadband cards in operational mode Summary(de): USB Modeswitch aktiviert UMTS-Karten Group: Applications/System License: GPLv2+ URL: http://www.draisberghof.de/usb_modeswitch/ + Source0: http://www.draisberghof.de/%{name}/%{source_name}-%{version}.tar.bz2 Source1: http://www.draisberghof.de/usb_modeswitch/device_reference.txt -Patch0: rhbz948451-fix-manual-pages.patch + +# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2546 +Patch0: rhbz948451-fix-manual-pages.patch + +# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2556 +Patch1: 0001-Fix-crash-on-early-fail.patch + +# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2557 +Patch2: 0001-usb_modeswitch-don-t-return-a-value-from-stack.patch + +# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2560 +Patch3: 0001-Bring-back-the-module-binding.patch + +BuildRequires: libusbx-devel +BuildRequires: systemd Requires: usb_modeswitch-data >= 20121109 -BuildRequires: libusb-devel +Requires: systemd %description USB Modeswitch brings up your datacard into operational mode. When plugged in they identify themselves as cdrom and present some non-Linux compatible -installation files. This tool deactivates this cdrom-devices and enables +installation files. This tool deactivates this cdrom-device and enables the real communication device. It supports most devices built and sold by Huawei, T-Mobile, Vodafone, Option, ZTE, Novatel. @@ -30,51 +45,60 @@ Vodafone, Option, ZTE und Novatell werden unterstützt. %prep %setup -q -n %{source_name}-%{version} -cp -f %{SOURCE1} device_reference.txt -%patch0 -p1 -b .fix-manual-pages - -# update config.guess for aarch64 support -cp /usr/lib/rpm/redhat/config.{guess,sub} . -cp /usr/lib/rpm/redhat/config.{guess,sub} jim/autosetup/ +%patch0 -p1 -b .manpage +%patch1 -p1 -b .libusb_exit +%patch2 -p1 -b .stack +%patch3 -p1 -b .binding # convert device_reference.txt encoding to UTF-8 -iconv --from=ISO-8859-1 --to=UTF-8 device_reference.txt > device_reference.txt.new && \ -touch -r device_reference.txt device_reference.txt.new && \ -chmod 644 device_reference.txt && \ -mv device_reference.txt.new device_reference.txt +iconv --from=ISO-8859-1 --to=UTF-8 %{SOURCE1} >device_reference.txt +touch -r %{SOURCE1} device_reference.txt + +# Fix the ppc64le build +cp -f /usr/lib/rpm/redhat/config.guess jim/autosetup/config.guess +cp -f /usr/lib/rpm/redhat/config.sub jim/autosetup/config.sub + %build CFLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags} static %install -rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/udev -mkdir -p $RPM_BUILD_ROOT%{_sbindir} -mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1 -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir} - -install -p -m 755 usb_modeswitch $RPM_BUILD_ROOT%{_sbindir}/ -install -p -m 755 usb_modeswitch_dispatcher $RPM_BUILD_ROOT%{_sbindir}/usb_modeswitch_dispatcher -install -p -m 644 usb_modeswitch.conf $RPM_BUILD_ROOT%{_sysconfdir}/ -gzip -9c usb_modeswitch.1 > usb_modeswitch.1.gz && install -m 644 usb_modeswitch.1.gz $RPM_BUILD_ROOT%{_datadir}/man/man1 -gzip -9c usb_modeswitch_dispatcher.1 > usb_modeswitch_dispatcher.1.gz && install -m 644 usb_modeswitch_dispatcher.1.gz $RPM_BUILD_ROOT%{_datadir}/man/man1 -install -p -m 755 usb_modeswitch.sh $RPM_BUILD_ROOT%{_prefix}/lib/udev/usb_modeswitch - +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +make install-static \ + DESTDIR=$RPM_BUILD_ROOT \ + SYSDIR=$RPM_BUILD_ROOT%{_unitdir} \ + UDEVDIR=$RPM_BUILD_ROOT%{_prefix}/lib/udev %files -%defattr(-,root,root,-) %{_sbindir}/usb_modeswitch %{_sbindir}/usb_modeswitch_dispatcher %{_mandir}/man1/usb_modeswitch.1.gz %{_mandir}/man1/usb_modeswitch_dispatcher.1.gz %{_prefix}/lib/udev/usb_modeswitch +%{_unitdir}/usb_modeswitch@.service %config(noreplace) %{_sysconfdir}/usb_modeswitch.conf %doc COPYING README ChangeLog device_reference.txt %changelog +* Thu Jul 21 2016 Lubomir Rintel - 2.4.0-5 +- Bring back the module binding + +* Thu Jul 21 2016 Lubomir Rintel - 2.4.0-4 +- Actually apply the patch for previous issue + +* Thu Jul 21 2016 Lubomir Rintel - 2.4.0-3 +- Fix undefined behavior in config parser (rh #1352055) + +* Wed Jul 20 2016 Lubomir Rintel - 2.4.0-2 +- Add the previously omitted systemd service file (rh #1352055) +- Fix crash with invalid arguments (rh #1358472) + +* Wed Jun 22 2016 Lubomir Rintel - 2.4.0-1 +- New 2.4.0 release + * Fri Jul 11 2014 Dan Winship - 1.2.7-6 - Fix build on aarch64 (#1061556)