Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a26f47661 | ||
|
|
7c2c5f8d87 |
9 changed files with 472 additions and 277 deletions
334
0001-Bring-back-the-module-binding.patch
Normal file
334
0001-Bring-back-the-module-binding.patch
Normal file
|
|
@ -0,0 +1,334 @@
|
|||
From cf2afa734597ef88b8f5871bf18cf849b105e51d Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
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 <<EOF
|
||||
$1
|
||||
EOF
|
||||
diff --git a/usb_modeswitch.tcl b/usb_modeswitch.tcl
|
||||
index 3e590fd..b74d46c 100755
|
||||
--- a/usb_modeswitch.tcl
|
||||
+++ b/usb_modeswitch.tcl
|
||||
@@ -276,6 +276,7 @@ foreach mconfig $configList {
|
||||
set cfgno [string trim $cfgno]
|
||||
if {$cfgno > 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
|
||||
|
||||
29
0001-Fix-crash-on-early-fail.patch
Normal file
29
0001-Fix-crash-on-early-fail.patch
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
From 73001792b29f080fcabc57f30d6030bedb2a24b0 Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
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
|
||||
|
||||
34
0001-usb_modeswitch-don-t-return-a-value-from-stack.patch
Normal file
34
0001-usb_modeswitch-don-t-return-a-value-from-stack.patch
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
From 93686f8ba8c1ed6bf559dbfda53f9c7d702c76b5 Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
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
|
||||
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
--- device_reference.txt 2014-05-29 22:18:46.000000000 +0200
|
||||
+++ device_reference_utf8.txt 2014-11-24 20:51:17.647221466 +0100
|
||||
@@ -60,7 +60,7 @@
|
||||
########################################################
|
||||
# Option GlobeTrotter GT MAX 3.6 (aka "T-Mobile Web'n'walk Card Compact II")
|
||||
#
|
||||
-# Contributor: Bernd Holzmüller
|
||||
+# Contributor: Bernd Holzmüller
|
||||
|
||||
DefaultVendor= 0x05c6
|
||||
DefaultProduct= 0x1000
|
||||
@@ -279,7 +279,7 @@
|
||||
#
|
||||
# Probably works with DetachStorageOnly too
|
||||
#
|
||||
-# Contributor: Flávio Moringa and others
|
||||
+# Contributor: Flávio Moringa and others
|
||||
|
||||
DefaultVendor= 0x19d2
|
||||
DefaultProduct= 0x2000
|
||||
@@ -777,7 +777,7 @@
|
||||
#
|
||||
# Recommended init command: ATE0V1&D2&C1S0=0
|
||||
#
|
||||
-# Contributor: Jérôme Oufella
|
||||
+# Contributor: Jérôme Oufella
|
||||
|
||||
DefaultVendor= 0x1004
|
||||
DefaultProduct= 0x1000
|
||||
@@ -1336,7 +1336,7 @@
|
||||
########################################################
|
||||
# LG HDM-2100 (EVDO Rev.A USB modem)
|
||||
#
|
||||
-# Contributor: Jérôme Oufella
|
||||
+# Contributor: Jérôme Oufella
|
||||
|
||||
DefaultVendor= 0x1004
|
||||
DefaultProduct=0x607f
|
||||
@@ -1641,7 +1641,7 @@
|
||||
########################################################
|
||||
# Huawei U8110 / U8300 / Joy, Vodafone 845 (Android smartphone)
|
||||
#
|
||||
-# Contributor: David Erosa GarcÃÂa
|
||||
+# Contributor: David Erosa García
|
||||
|
||||
DefaultVendor= 0x12d1
|
||||
DefaultProduct=0x1031
|
||||
@@ -1658,7 +1658,7 @@
|
||||
########################################################
|
||||
# Nokia CS-10
|
||||
#
|
||||
-# Contributor: Wacław Sierek
|
||||
+# Contributor: Wacław Sierek
|
||||
|
||||
DefaultVendor= 0x0421
|
||||
DefaultProduct=0x060c
|
||||
@@ -1700,7 +1700,7 @@
|
||||
#######################################################
|
||||
# Samsung GT-B3730
|
||||
#
|
||||
-# Contributor: Per Øyvind Karlsen
|
||||
+# Contributor: Per Øyvind Karlsen
|
||||
|
||||
DefaultVendor= 0x04e8
|
||||
DefaultProduct=0x689a
|
||||
@@ -1771,7 +1771,7 @@
|
||||
#######################################################
|
||||
# Huawei EC168C (from Zantel)
|
||||
#
|
||||
-# Contributor: Ã…smund Hjulstad
|
||||
+# Contributor: Åsmund Hjulstad
|
||||
|
||||
DefaultVendor= 0x12d1
|
||||
DefaultProduct=0x1446
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
#
|
||||
# Device Reference (UTF-8 encoding used)
|
||||
#
|
||||
# Last modified: 2017-02-05
|
||||
# Last modified: 2014-05-29
|
||||
#
|
||||
# Collection of configurations for usb_modeswitch, a mode switching
|
||||
# tool for controlling flip flop (multiple mode) USB devices
|
||||
#
|
||||
# Detailed instructions and a friendly forum on the homepage:
|
||||
# http://www.draisberghof.de/usb_modeswitch
|
||||
#
|
||||
# Note that new devices are no longer added to this file. See the
|
||||
# config files included with the data package for these
|
||||
#
|
||||
# You may want to check for a newer version of this file at:
|
||||
# http://www.draisberghof.de/usb_modeswitch/device_reference.txt
|
||||
|
||||
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
|
@ -21,10 +21,9 @@
|
|||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
|
||||
# For a parameter reference see file REFERENCE in the data package or
|
||||
# http://www.draisberghof.de/usb_modeswitch/parameter_reference.txt
|
||||
# For a parameter reference see file REFERENCE in the data package
|
||||
#
|
||||
# If you find new working codes and configurations, please report
|
||||
# If you find working codes and configurations, please contribute
|
||||
# them!
|
||||
|
||||
|
||||
|
|
@ -32,7 +31,6 @@
|
|||
|
||||
#######################################################
|
||||
# Option GlobeSurfer Icon (aka "Vodafone EasyBox")
|
||||
# This is the thing that started it all ...
|
||||
#
|
||||
# The MessageContent is identical for all Option devices
|
||||
|
||||
|
|
|
|||
23
rhbz948451-fix-manual-pages.patch
Normal file
23
rhbz948451-fix-manual-pages.patch
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
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 <msg> message to send (hex number as string)\n"
|
||||
- " -2 <msg>, -3 <msg> additional messages to send (-n recommended)\n"
|
||||
+ " -2, --message-content2 <msg> additional messages to send (-n recommended)\n"
|
||||
+ " -3, --message-content3 <msg> additional messages to send (-n recommended)\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"
|
||||
@@ -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 <seconds> switching result check with timeout\n"
|
||||
+ " -s, --check-success <seconds> switching result check with timeout\n"
|
||||
" -I, --inquire obsolete, no effect\n\n"
|
||||
" -c, --config-file <filename> load long configuration from file\n\n"
|
||||
" -t, --stdinput read long configuration from stdin\n\n"
|
||||
2
sources
2
sources
|
|
@ -1 +1 @@
|
|||
SHA512 (usb-modeswitch-2.6.2.tar.bz2) = adaedf89de3c5f9dc55da7bb5bb3fe8165c0424cffacb00f83876094b7abdc386ced9959e5dbdf46ab06aa1d03fbfca13df539421489ef4d2dd0f72742057f3d
|
||||
6e1640db47768bb9012f91b7593116ef usb-modeswitch-2.4.0.tar.bz2
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
From e3cf80c95a1c67d05dded68ec171bfde4686003f Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Date: Thu, 14 Aug 2025 16:35:56 +0200
|
||||
Subject: [PATCH] service: Do not ever send SIGTERM to the unit
|
||||
|
||||
Following happens when modem 03f0:a31d (HP lt4132 LTE/HSPA+ 4G Module) is
|
||||
plugged:
|
||||
|
||||
- systemd-udevd emits "add" action
|
||||
- The "add" action triggers restart of usb_modeswitch@<port>.service
|
||||
- usb_modeswitch@<port>.service starts usb_modeswitch
|
||||
- Another udev rule renames the network interface from usb0 to enp0...
|
||||
- Above causes systemd-udevd emit "change" action for the device
|
||||
- The "change" action triggers another restart of usb_modeswitch@<port>.service
|
||||
- usb_modeswitch run initially gets terminated mid-air
|
||||
- Device drops off the bus
|
||||
- Infinite sadness
|
||||
|
||||
Possible solutions:
|
||||
|
||||
- The udev rule could just emit the "change" action. I have no idea why
|
||||
it handles "change" actions, but it looks intentional -> No touchy
|
||||
from me.
|
||||
- usb_modeswitch could just trap TERM and shut down gracefully. This
|
||||
involves Tcl -> No touchy.
|
||||
- The systemd unit could just send an innocent signal instead of TERM
|
||||
and just let usb_modeswitch end its life journey naturally.
|
||||
Let's do this, because it involves least brain.
|
||||
|
||||
Anybody please feel free to send this upstream.
|
||||
---
|
||||
usb_modeswitch@.service | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/usb_modeswitch@.service b/usb_modeswitch@.service
|
||||
index 22d2ea7..23d4ed0 100644
|
||||
--- a/usb_modeswitch@.service
|
||||
+++ b/usb_modeswitch@.service
|
||||
@@ -7,3 +7,7 @@ ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-mode %i
|
||||
# Testing
|
||||
#ExecStart=/bin/echo "usb_modeswitch.service: device name is %i"
|
||||
|
||||
+# Do not ever terminate violently on restart -- interrupting the switching
|
||||
+# transaction will crash some modems! We'll terminate shortly anyways.
|
||||
+# If we hang, FinalKillSignal (defaults to SIGKILL) will take care of that.
|
||||
+KillSignal=SIGCONT
|
||||
--
|
||||
2.50.1
|
||||
|
||||
|
|
@ -1,29 +1,34 @@
|
|||
%define source_name usb-modeswitch
|
||||
%define source_name usb-modeswitch
|
||||
|
||||
Name: usb_modeswitch
|
||||
Version: 2.6.2
|
||||
Release: 6%{?dist}
|
||||
Summary: USB Modeswitch gets mobile broadband cards in operational mode
|
||||
Summary(de): USB Modeswitch aktiviert UMTS-Karten
|
||||
License: GPL-2.0-or-later
|
||||
URL: http://www.draisberghof.de/usb_modeswitch/
|
||||
Name: usb_modeswitch
|
||||
Version: 2.4.0
|
||||
Release: 4%{?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
|
||||
Source0: http://www.draisberghof.de/%{name}/%{source_name}-%{version}.tar.bz2
|
||||
Source1: http://www.draisberghof.de/usb_modeswitch/device_reference.txt
|
||||
|
||||
# Submitted upstream (2014-11-24)
|
||||
Patch0: device_reference-utf8.patch
|
||||
# Not submitted upstream due to lack of courage
|
||||
Patch1: usb_modeswitch-2.6.2-SIGTERM.patch
|
||||
# http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2546
|
||||
Patch0: rhbz948451-fix-manual-pages.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
BuildRequires: libusbx-devel
|
||||
# "tcl" or "jimsh"), use the light-weight installation:
|
||||
#BuildRequires: jimtcl-devel
|
||||
BuildRequires: systemd
|
||||
Requires: usb_modeswitch-data >= 20121109
|
||||
Requires: systemd
|
||||
# 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: jimtcl-devel
|
||||
BuildRequires: systemd
|
||||
Requires: usb_modeswitch-data >= 20121109
|
||||
Requires: systemd
|
||||
|
||||
%description
|
||||
USB Modeswitch brings up your datacard into operational mode. When plugged
|
||||
|
|
@ -32,7 +37,7 @@ 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.
|
||||
|
||||
%description -l de
|
||||
%description -l de
|
||||
USB Modeswitch deaktiviert die CDROM-Emulation einiger UMTS-Karten.
|
||||
Dadurch erkennt Linux die Datenkarte und kann damit Internet-
|
||||
Verbindungen aufbauen. Die gängigen Karten von Huawei, T-Mobile,
|
||||
|
|
@ -43,23 +48,22 @@ Vodafone, Option, ZTE und Novatell werden unterstützt.
|
|||
%setup -q -n %{source_name}-%{version}
|
||||
cp -f %{SOURCE1} device_reference.txt
|
||||
|
||||
%patch 0 -p0
|
||||
%patch 1 -p1
|
||||
%patch0 -p1 -b .manpage
|
||||
%patch1 -p1 -b .libusb_exit
|
||||
%patch2 -p1 -b .stack
|
||||
%patch3 -p1 -b .binding
|
||||
|
||||
|
||||
%build
|
||||
%{set_build_flags}
|
||||
# this will require jimtcl-devel
|
||||
#make_build all-with-dynlink-dispatcher
|
||||
%make_build
|
||||
CFLAGS="$RPM_OPT_FLAGS" make %{?_smp_mflags}
|
||||
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{_unitdir}
|
||||
%make_install \
|
||||
SYSDIR=%{buildroot}%{_unitdir} \
|
||||
SBINDIR=%{buildroot}%{_sbindir} \
|
||||
UDEVDIR=%{buildroot}%{_prefix}/lib/udev
|
||||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
|
||||
make install \
|
||||
DESTDIR=$RPM_BUILD_ROOT \
|
||||
SYSDIR=$RPM_BUILD_ROOT%{_unitdir} \
|
||||
UDEVDIR=$RPM_BUILD_ROOT%{_prefix}/lib/udev
|
||||
|
||||
|
||||
%files
|
||||
|
|
@ -70,116 +74,12 @@ mkdir -p %{buildroot}%{_unitdir}
|
|||
%{_prefix}/lib/udev/usb_modeswitch
|
||||
%{_unitdir}/usb_modeswitch@.service
|
||||
%config(noreplace) %{_sysconfdir}/usb_modeswitch.conf
|
||||
%doc README ChangeLog device_reference.txt
|
||||
%license COPYING
|
||||
%doc COPYING README ChangeLog device_reference.txt
|
||||
|
||||
|
||||
%changelog
|
||||
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
|
||||
|
||||
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
|
||||
|
||||
* Thu Aug 14 2025 Lubomir Rintel <lkundrak@v3.sk> - 2.6.2-4
|
||||
- Do not let the unit send SIGTERM to usb_modeswitch mid-switch.
|
||||
|
||||
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
|
||||
|
||||
* Thu Feb 27 2025 Sérgio Basto <sergio@serjux.com> - 2.6.2-2
|
||||
- Revert the move of usb_modeswitch to /usr/lib/udev/rules.d, usb_modeswitch is
|
||||
not an rule
|
||||
|
||||
* Thu Feb 20 2025 Sérgio Basto <sergio@serjux.com> - 2.6.2-1
|
||||
- Update usb_modeswitch to 2.6.2
|
||||
- Resolves: rhbz#2346392
|
||||
- Fix build related to /usr/sbin move
|
||||
|
||||
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
|
||||
|
||||
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
|
||||
|
||||
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Thu Nov 2 2023 Íñigo Huguet <ihuguet@redhat.com> - 2.6.1-9
|
||||
- Really use SPDX license specifier
|
||||
|
||||
* Thu Aug 24 2023 Till Maas <opensource@till.name> - 2.6.1-8
|
||||
- Cleanup spec: use %%license, use %%patch 0
|
||||
- Use spdx license specifier
|
||||
|
||||
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Wed Nov 18 2020 Sérgio Basto <sergio@serjux.com> - 2.6.1-1
|
||||
- Update usb_modeswitch to 2.6.1
|
||||
- Drop patch1, http://www.draisberghof.de/usb_modeswitch/bb/viewtopic.php?f=2&t=2733
|
||||
- Drop BR jimtcl-devel, if we don't install dynlink-dispatcher
|
||||
|
||||
* Tue Sep 29 2020 Sérgio Basto <sergio@serjux.com> - 2.6.0-3
|
||||
- Use make macros (https://src.fedoraproject.org/rpms/usb_modeswitch/pull-request/1)
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.6.0-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Tue Mar 24 2020 Lubomir Rintel <lkundrak@v3.sk> - 2.6.0-1
|
||||
- New 2.6.0 release
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.2-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.2-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.2-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Wed Feb 28 2018 Lubomir Rintel <lkundrak@v3.sk> - 2.5.2-1
|
||||
- New 2.5.2 release
|
||||
|
||||
* Fri Feb 23 2018 Florian Weimer <fweimer@redhat.com> - 2.5.1-3
|
||||
- Use LDFLAGS from redhat-rpm-config
|
||||
|
||||
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Fri Aug 18 2017 Lubomir Rintel <lkundrak@v3.sk> - 2.5.1-1
|
||||
- New 2.5.1 release
|
||||
|
||||
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Fri Jul 29 2016 Lubomir Rintel <lkundrak@v3.sk> - 2.4.0-5
|
||||
- Bump the release number to be higher than in Fedora 24
|
||||
* Tue Jul 26 2016 Lubomir Rintel <lkundrak@v3.sk> - 2.4.0-4
|
||||
- Bring back the module binding
|
||||
|
||||
* Thu Jul 21 2016 Lubomir Rintel <lkundrak@v3.sk> - 2.4.0-3
|
||||
- Fix undefined behavior in config parser (rh #1352055)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue