Hello community,
here is the log from the commit of package usb_modeswitch for openSUSE:Factory checked in at 2015-08-05 06:49:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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 2015-04-27 12:59:32.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.usb_modeswitch.new/usb_modeswitch.changes 2015-08-05 06:49:03.000000000 +0200
@@ -1,0 +2,40 @@
+Fri Jul 24 09:34:00 UTC 2015 - jweberhofer@weberhofer.at
+
+- Removed unused usb_modeswitch-data.rpmlintrc
+
+- Removed changelog from documentation
+
+- Cleaned up specfile
+
+- Update to version 2.2.5
+ * Fixed bug in configuration check, possibly leading to segfault (thanks,
+ Leonid Lisovskiy);
+ * fixed Pantech commandline parameter evaluation (was not working at all);
+ * added driver unbind step via sysfs in wrapper, getting rid of the
+ USB subsystem complaint "interface 0 claimed by usb-storage while
+ 'usb_modeswitch' <does this and that>"
+- Update to version 2.2.4
+ * Fixed buggy check of USB configuration selection (possibly leading
+ to segfault), tested with Alcatel X602D;
+ * removed call to 'libusb_strerror'
+ from libusb initialization - not available in earlier libusb1 versions
+- Update to version 2.2.3
+ * Fixed problem arising with systemd version 221 (220 untested), which
+ affects starting the usb_modeswitch systemd unit from the sh script
+ (reported by Archlinux users)
+- Update to version 2.2.2, 2015/06/27
+ * Added catch for libusb init error (thanks, Henrik Gustafsson);
+ * removed global function result variable; added catch for USB configuration
+ read error (both thanks to "otila");
+ * fixed wrapper script where port search for symlinking modem port was
+ broken ("/dev/gsmmodem");
+ * changed PantechMode parameter to represent different targets;
+ * added global config option to disable MBIM checking and setting
+ alltogether (request from "kai");
+ * changed udev sh script so that systemd processing takes precedence over
+ upstart;
+ * changed systemd template unit parameter to avoid escaping problems
+
+- Update the data package to version 20150627
+
+-------------------------------------------------------------------
Old:
----
usb-modeswitch-2.2.1.tar.bz2
usb-modeswitch-data-20150115.tar.bz2
usb_modeswitch-data.rpmlintrc
New:
----
usb-modeswitch-2.2.5.tar.bz2
usb-modeswitch-data-20150627.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ usb_modeswitch.spec ++++++
--- /var/tmp/diff_new_pack.ZoquVU/_old 2015-08-05 06:49:04.000000000 +0200
+++ /var/tmp/diff_new_pack.ZoquVU/_new 2015-08-05 06:49:04.000000000 +0200
@@ -1,7 +1,7 @@
#
# spec file for package usb_modeswitch
#
-# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -15,30 +15,29 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
+
+%define source_name usb-modeswitch
+%define date 20150627
+%define _udevdir %(pkg-config --variable=udevdir udev)
Name: usb_modeswitch
-Version: 2.2.1
+Version: 2.2.5
Release: 0
Summary: A mode switching tool for controlling multiple-device USB gear
License: GPL-2.0+
Group: Hardware/Mobile
Url: http://www.draisberghof.de/usb_modeswitch
-%define source_name usb-modeswitch
-%define date 20150115
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
-Source1000: %{name}-data.rpmlintrc
Patch1: usb_modeswitch-fix_fsf_address.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: fdupes
BuildRequires: pkg-config
BuildRequires: tcl
-BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(libusb-1.0)
+BuildRequires: pkgconfig(udev)
Requires: tcl >= 8.4
-Requires: usb_modeswitch-data = %version
-
-%define _udevdir %(pkg-config --variable=udevdir udev)
+Requires: usb_modeswitch-data = %{version}
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
USB_ModeSwitch is a mode switching tool for controlling "flip flop"
@@ -66,9 +65,9 @@
CFLAGS="%{optflags}" make
%install
-%makeinstall UDEVDIR=$RPM_BUILD_ROOT%{_udevdir}
+make DESTDIR=%{buildroot} install %{?_smp_mflags} UDEVDIR=%{buildroot}%{_udevdir}
cd %{source_name}-data-%{date}
-%makeinstall RULESDIR=$RPM_BUILD_ROOT%{_udevdir}/rules.d
+make DESTDIR=%{buildroot} install %{?_smp_mflags} RULESDIR=%{buildroot}%{_udevdir}/rules.d
### TO REMOVE ONCE IN UPSTREAM DATA PACKAGE, FIX BNC 899013 ###
@@ -92,15 +91,15 @@
### END SECTION TO REMOVE ###
-%fdupes -s $RPM_BUILD_ROOT
+%fdupes -s %{buildroot}
%files
%defattr(-,root,root,-)
-%doc README COPYING ChangeLog device_reference.txt
+%doc README COPYING device_reference.txt
%{_sbindir}/usb_modeswitch
%{_sbindir}/usb_modeswitch_dispatcher
%{_udevdir}/usb_modeswitch
-/var/lib/usb_modeswitch
+%{_localstatedir}/lib/usb_modeswitch
%config %{_sysconfdir}/usb_modeswitch.conf
%{_mandir}/man1/usb_modeswitch.1.gz
%{_mandir}/man1/usb_modeswitch_dispatcher.1.gz
++++++ usb-modeswitch-2.2.1.tar.bz2 -> usb-modeswitch-2.2.5.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/ChangeLog new/usb-modeswitch-2.2.5/ChangeLog
--- old/usb-modeswitch-2.2.1/ChangeLog 2015-01-14 21:17:44.000000000 +0100
+++ new/usb-modeswitch-2.2.5/ChangeLog 2015-07-16 22:07:59.000000000 +0200
@@ -2,6 +2,30 @@
History of USB_ModeSwitch
=========================
+Version 2.2.5, 2015/07/16
+ Fixed bug in configuration check, possibly leading to segfault (thanks,
+ Leonid Lisovskiy); fixed Pantech commandline parameter evaluation (was
+ not working at all); added driver unbind step via sysfs in wrapper,
+ getting rid of the USB subsystem complaint "interface 0 claimed by
+ usb-storage while 'usb_modeswitch' <does this and that>"
+Version 2.2.4, 2015/07/14
+ Fixed buggy check of USB configuration selection (possibly leading
+ to segfault), tested with Alcatel X602D; removed call to 'libusb_strerror'
+ from libusb initialization - not available in earlier libusb1 versions
+Version 2.2.3, 2015/06/29
+ Fixed problem arising with systemd version 221 (220 untested), which
+ affects starting the usb_modeswitch systemd unit from the sh script
+ (reported by Archlinux users)
+Version 2.2.2, 2015/06/27
+ Added catch for libusb init error (thanks, Henrik Gustafsson); removed
+ global function result variable; added catch for USB configuration
+ read error (both thanks to "otila"); fixed wrapper script where port
+ search for symlinking modem port was broken ("/dev/gsmmodem"); changed
+ PantechMode parameter to represent different targets; added global
+ config option to disable MBIM checking and setting alltogether (request
+ from "kai"); changed udev sh script so that systemd processing takes
+ precedence over upstart; changed systemd template unit parameter to
+ avoid escaping problems
Version 2.2.1, 2015/01/15
Fixed unreliable switching function for Cisco AM10
Version 2.2.0, 2014/05/29
@@ -43,7 +67,7 @@
install the matching service file; you may want to adapt it better to
your respective system, possibly adding dependencies/targets to the
services. Note that the udev starter script usb_modeswitch.sh also
- checks for the existence of the service files
+ checks for the existence of the service/unit files
Version 1.2.7, 2013/08/07
Two new dedicated control message functions to support Pantech LTE
(thanks to Adam Goode) and Blackberry Q10/Z10 (thanks to Daniel Mende)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/Makefile new/usb-modeswitch-2.2.5/Makefile
--- old/usb-modeswitch-2.2.1/Makefile 2015-01-14 21:18:01.000000000 +0100
+++ new/usb-modeswitch-2.2.5/Makefile 2015-07-16 21:45:28.000000000 +0200
@@ -1,5 +1,5 @@
PROG = usb_modeswitch
-VERS = 2.2.1
+VERS = 2.2.5
CC ?= gcc
CFLAGS += -Wall
LIBS = `pkg-config --libs --cflags libusb-1.0`
@@ -85,7 +85,7 @@
install -D --mode=755 usb_modeswitch_dispatcher $(SBINDIR)/usb_modeswitch_dispatcher
install -d $(DESTDIR)/var/lib/usb_modeswitch
test -d $(UPSDIR) -a -e /sbin/initctl && install --mode=644 usb-modeswitch-upstart.conf $(UPSDIR) || test 1
- test -d $(SYSDIR) -a -e /usr/bin/systemctl && install --mode=644 usb_modeswitch@.service $(SYSDIR) || test 1
+ test -d $(SYSDIR) -a \( -e /usr/bin/systemctl -o -e /bin/systemctl \) && install --mode=644 usb_modeswitch@.service $(SYSDIR) || test 1
install: install-script
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/README new/usb-modeswitch-2.2.5/README
--- old/usb-modeswitch-2.2.1/README 2014-01-28 00:17:14.000000000 +0100
+++ new/usb-modeswitch-2.2.5/README 2015-06-27 22:00:55.000000000 +0200
@@ -7,18 +7,19 @@
What it is
==========
-USB_ModeSwitch is (surprise!) a small mode switching tool for controlling
-"flip flop" (multiple mode) USB devices.
+USB_ModeSwitch is - hardly surprising - a mode switching tool for controlling
+USB devices with multiple "modes". Now, what does THAT mean?
More and more USB devices have their MS Windows drivers onboard; when plugged
in for the first time they act like a flash storage and offer their driver
installation from there.
After installation (and on every consecutive plugging) the driver switches the
-mode internally, the storage device vanishes (in most cases), and a new device
-(like an USB modem) shows up.
+mode internally by sending a certain command sequence; the storage device
+vanishes (in most cases) and a different device - like a USB modem - shows up.
+To the host, this is like unplugging one device and then plugging annother.
At first this feature appeared on devices with cell phone chipsets, presumably
-because some of them were able to change the mode of their USB port anyway
+because some of them were already able to change the mode of their USB port
from storage to communication - so why not make use of this in a modem stick?
Modem maker "Option" calls that feature "ZeroCD (TM)" since it eliminates the
need for shipping a separate driver carrier.
@@ -26,27 +27,33 @@
In the beginning, nothing of this was documented in any form and there was
hardly any Linux/Unix support available.
On the good side, most of the known devices are working out of the box in all
-modes with the available Linux modules like "usb-storage" or serial USB drivers.
+modes with available Linux modules like "usb-storage" or serial USB drivers.
That leaves only the problem of the mode-switching from storage to whatever
the thing is supposed to do.
-Fortunately there are things like human intelligence, USB sniffing programs and
-"libusb". It is possible to eavesdrop the communication of the MS Windows
-driver, to isolate the command or action that does the switching, and to replay
-the same sequence in the Unix system.
-
-USB_ModeSwitch makes this process easy to handle by taking the relevant para-
-meters from a configuration file and doing all the initialization and communi-
-cation stuff, with heavy help from "libusb".
+Fortunately there are things like human smartness, USB sniffing programs and
+LibUSB. The obvious way is to eavesdrop on the communication of the MS Windows
+driver, to isolate the command or action that does the switching, and then re-
+play the same sequence in a non-Windows system.
+
+In theory, this task could also be handled on the kernel driver level, but a
+userspace program is much more flexible and can easily be disabled if access
+to the initial mode of those devices should be desired. There has been a
+principle decision by kernel developers to keep mode-switching outside of the
+kernel.
+
+So USB_ModeSwitch has evolved to make this process easy to handle by taking the
+relevant parameters from configuration files and handling all initialization
+and communication business, with essential help from "libusb".
-In Linux and friends it is intended to be used automatically - via udev events
+In Linux and friends it is intended to work automatically - via udev events
and rules - and doing the mode switch without any user interaction.
-However, the core program should be as portable als libusb itself; it does not
+However, the core C program should be as portable als libusb itself; it does not
rely on specific Linux features.
-It can be run as an interactive command line tool, particularly useful when trying
-to manage hitherto unknown devices.
+It can also be run as an interactive command line tool, particularly useful when
+trying to tinker with hitherto unknown devices.
-We have already collected a wide range of information on how to switch all
+We have already collected a wide range of information on how to mode-switch all
sorts of devices. If you run into a new one that is unknown yet, don't despair:
we can find out what you need to do!
@@ -54,6 +61,10 @@
How to install
==============
+If you only need the core C program, just run "make". All further steps de-
+scribed below are referring to a common, fairly current Linux system where
+USB_ModeSwitch is expected to do its work automatically.
+
!! You need the usb-modeswitch-data package from the same source as this !!
If you have an earlier version installed, de-installation is recommended ("make
@@ -62,8 +73,9 @@
The main prerequisite for installing from source is the development package for
"libusb". It may be called "libusb-dev" or similar in your distribution. From
-usb_modeswitch 2.0.0 it should have an "1.x" in the name to reflect the change
-to libusb-1.
+usb_modeswitch 2.0.0 on, it should have an "1.x" in the name to reflect the change
+to libusb-1. There are also variants around called "libusbx" if libusb-1 is not
+available on your distribution.
To install the tool set, unpack and run the install command (see below) in the
newly created directory.
@@ -143,7 +155,8 @@
##########
-Important: libusb programs - like this tool - want to be run as root!
+Important: libusb programs - like this tool - want to be run with administrative
+privileges (as root or with sudo)!
##########
@@ -151,8 +164,8 @@
Known working hardware, Troubleshooting
=======================================
-Please see the homepage. Read carefully.
-For support questions use ONLY the forum.
+Please go to the homepage (see link at the top). Read carefully.
+For support questions use ONLY public posts in the forum.
@@ -175,8 +188,8 @@
Whodunit
========
-Copyright 2007 - 2014 Josua Dietze (mail to "usb_admin" at the domain
-"draisberghof.de" or write a personal message through the forum to "Josh")
+Copyright 2007 - 2015 Josua Dietze (for non-support notifications write a personal
+message through the forum to "Josh"; everything else only in a forum thread)
!!! NO SUPPORT QUESTIONS VIA E-MAIL, use the forum !!!
@@ -198,6 +211,9 @@
Hexstr2bin function borrowed from:
Jouni Malinen (http://hostap.epitest.fi/wpa_supplicant, from "common.c")
+Indispensable help with device research and compilation:
+ Lars Melin
+
Code, fixes and ideas contributed by:
Aki Makkonen
Denis Sutter
@@ -251,4 +267,4 @@
-Last revised: 2014-01-28, Josua Dietze
+Last revised: 2015-06-27, Josua Dietze
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/dispatcher.c new/usb-modeswitch-2.2.5/dispatcher.c
--- old/usb-modeswitch-2.2.1/dispatcher.c 2015-01-14 21:16:21.000000000 +0100
+++ new/usb-modeswitch-2.2.5/dispatcher.c 2015-06-20 15:19:19.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 Josua Dietze, usb_modeswitch version 2.2.1
+ * Copyright (c) 2011-2015 Josua Dietze, usb_modeswitch version 2.2.2
* Contains code under
* Copyright (c) 2010 Wojciech A. Koszek
* All rights reserved.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/usb_modeswitch.1 new/usb-modeswitch-2.2.5/usb_modeswitch.1
--- old/usb-modeswitch-2.2.1/usb_modeswitch.1 2014-05-29 21:44:16.000000000 +0200
+++ new/usb-modeswitch-2.2.5/usb_modeswitch.1 2015-06-27 00:12:45.000000000 +0200
@@ -113,8 +113,9 @@
Send a special control message used by Qisda devices
.IP "\fB-E\fP \fB\-\-quanta-mode\fP " 10
Send a special control message used by Quanta devices
-.IP "\fB-F\fP \fB\-\-pantech-mode\fP " 10
-Send a special control message used by Pantech devices
+.IP "\fB-F\fP \fB\-\-pantech-mode NUM\fP " 10
+Send a special control message used by Pantech devices.
+Value NUM will be used in control message as 'wValue'
.IP "\fB-Z\fP \fB\-\-blackberry-mode\fP " 10
Send a special control message used by some newer Blackberry devices
.IP "\fB-O\fP \fB\-\-sony-mode\fP " 10
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/usb_modeswitch.c new/usb-modeswitch-2.2.5/usb_modeswitch.c
--- old/usb-modeswitch-2.2.1/usb_modeswitch.c 2015-01-14 21:13:59.000000000 +0100
+++ new/usb-modeswitch-2.2.5/usb_modeswitch.c 2015-07-16 23:31:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Mode switching tool for controlling mode of 'multi-state' USB devices
- Version 2.2.1, 2015/01/15
+ Version 2.2.5, 2015/07/16
Copyright (C) 2007 - 2015 Josua Dietze (mail to "digidietze" at the domain
of the home page; or write a personal message through the forum to "Josh".
@@ -45,7 +45,7 @@
/* Recommended tab size: 4 */
-#define VERSION "2.2.0"
+#define VERSION "2.2.5"
#include
#include
@@ -112,15 +112,14 @@
char *TempPP=NULL;
static struct libusb_context *ctx = NULL;
-static struct libusb_device *dev;
-static struct libusb_device_handle *devh;
+static struct libusb_device *dev = NULL;
+static struct libusb_device_handle *devh = NULL;
static struct libusb_config_descriptor *active_config = NULL;
int DefaultVendor=0, DefaultProduct=0, TargetVendor=0, TargetProduct=-1, TargetClass=0;
int MessageEndpoint=0, ResponseEndpoint=0, ReleaseDelay=0;
int targetDeviceCount=0, searchMode;
int devnum=-1, busnum=-1;
-int ret;
unsigned int ModeMap = 0;
#define DETACHONLY_MODE 0x00000001
@@ -138,6 +137,7 @@
#define PANTECH_MODE 0x00001000
#define HUAWEINEW_MODE 0x00002000
+int PantechMode=0;
char verbose=0, show_progress=1, ResetUSB=0, CheckSuccess=0, config_read=0;
char NeedResponse=0, NoDriverLoading=0, InquireDevice=0, sysmode=0, mbim=0;
char StandardEject=0;
@@ -187,7 +187,7 @@
{"mobileaction-mode", no_argument, 0, 'A'},
{"cisco-mode", no_argument, 0, 'L'},
{"blackberry-mode", no_argument, 0, 'Z'},
- {"pantech-mode", no_argument, 0, 'F'},
+ {"pantech-mode", required_argument, 0, 'F'},
{"std-eject", no_argument, 0, 'K'},
{"need-response", no_argument, 0, 'n'},
{"reset-usb", no_argument, 0, 'R'},
@@ -228,7 +228,9 @@
ParseParamBoolMap(configFilename, QisdaMode, ModeMap, QISDA_MODE);
ParseParamBoolMap(configFilename, QuantaMode, ModeMap, QUANTA_MODE);
ParseParamBoolMap(configFilename, BlackberryMode, ModeMap, BLACKBERRY_MODE);
- ParseParamBoolMap(configFilename, PantechMode, ModeMap, PANTECH_MODE);
+ ParseParamInt(configFilename, PantechMode);
+ if (PantechMode)
+ ModeMap |= PANTECH_MODE;
ParseParamBool(configFilename, StandardEject);
ParseParamBool(configFilename, NoDriverLoading);
ParseParamHex(configFilename, MessageEndpoint);
@@ -338,7 +340,7 @@
while (1)
{
- c = getopt_long (argc, argv, "hejWQDndKHJSOBEGTNALZFRItv:p:V:P:C:m:M:2:3:w:r:c:i:u:a:s:f:b:g:",
+ c = getopt_long (argc, argv, "hejWQDndKHJSOBEGTNALZF:RItv: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. */
@@ -374,7 +376,8 @@
case 'A': ModeMap = ModeMap + MOBILEACTION_MODE; break;
case 'L': ModeMap = ModeMap + CISCO_MODE; break;
case 'Z': ModeMap = ModeMap + BLACKBERRY_MODE; break;
- case 'F': ModeMap = ModeMap + PANTECH_MODE; break;
+ case 'F': ModeMap = ModeMap + PANTECH_MODE;
+ PantechMode = strtol(optarg, NULL, 10); break;
case 'c': readConfigFile(optarg); break;
case 't': readConfigFile("stdin"); break;
case 'W': verbose = 1; show_progress = 1; count--; break;
@@ -422,9 +425,10 @@
int main(int argc, char **argv)
{
- int numDefaults=0, sonySuccess=0;
+ int ret=0, numDefaults=0, sonySuccess=0;
int currentConfig=0, defaultClass=0, interfaceClass=0;
struct libusb_device_descriptor descriptor;
+ enum libusb_error libusbError;
/* Make sure we have empty strings even if not set by config */
TargetProductList[0] = '\0';
@@ -492,7 +496,10 @@
}
/* libusb initialization */
- libusb_init(&ctx);
+ if ((libusbError = libusb_init(&ctx)) != LIBUSB_SUCCESS) {
+ fprintf(stderr, "Error: Failed to initialize libusb. %s (%d)\n\n", libusb_error_name(libusbError), libusbError);
+ exit(1);
+ }
if (verbose)
libusb_set_debug(ctx, 3);
@@ -521,10 +528,12 @@
SHOW_PROGRESS(output," Found devices in default mode (%d)\n", numDefaults);
} else {
SHOW_PROGRESS(output," No devices in default mode found. Nothing to do. Bye!\n\n");
+ close_all();
exit(0);
}
if (dev == NULL) {
SHOW_PROGRESS(output," No bus/device match. Is device connected? Abort\n\n");
+ close_all();
exit(0);
} else {
if (devnum == -1) {
@@ -535,12 +544,13 @@
libusb_open(dev, &devh);
if (devh == NULL) {
SHOW_PROGRESS(output,"Error opening the device. Abort\n\n");
- exit(1);
+ abort();
}
}
- libusb_get_active_config_descriptor(dev, &active_config);
+
/* Get current configuration of default device if parameter is set */
+ libusb_get_active_config_descriptor(dev, &active_config);
if (Configuration > -1) {
currentConfig = active_config->bConfigurationValue;
SHOW_PROGRESS(output,"Current configuration number is %d\n", currentConfig);
@@ -562,30 +572,28 @@
MessageEndpoint = find_first_bulk_endpoint(LIBUSB_ENDPOINT_OUT);
if (!ResponseEndpoint)
ResponseEndpoint = find_first_bulk_endpoint(LIBUSB_ENDPOINT_IN);
- libusb_free_config_descriptor(active_config);
if (!MessageEndpoint) {
fprintf(stderr,"Error: message endpoint not given or found. Abort\n\n");
- exit(1);
+ abort();
}
if (!ResponseEndpoint) {
fprintf(stderr,"Error: response endpoint not given or found. Abort\n\n");
- exit(1);
+ abort();
}
SHOW_PROGRESS(output,"Use endpoints 0x%02x (out) and 0x%02x (in)\n", MessageEndpoint, ResponseEndpoint);
- } else
- libusb_free_config_descriptor(active_config);
+ }
if (interfaceClass == -1) {
fprintf(stderr, "Error: Could not get class of interface %d. Does it exist? Abort\n\n",Interface);
- exit(1);
+ abort();
}
if (defaultClass == 0)
defaultClass = interfaceClass;
else
- if (interfaceClass == 8 && defaultClass != 8) {
- /* Weird device with default class other than 0 and differing interface class */
- SHOW_PROGRESS(output,"Ambiguous Class/InterfaceClass: 0x%02x/0x08\n", defaultClass);
+ if (interfaceClass == 8 && defaultClass != 8 && defaultClass != 0xef && defaultClass != 0xff) {
+ /* Unexpected default class combined with differing interface class */
+ SHOW_PROGRESS(output,"Bogus Class/InterfaceClass: 0x%02x/0x08\n", defaultClass);
defaultClass = 8;
}
@@ -593,7 +601,7 @@
if (defaultClass != 8) {
fprintf(stderr, "Error: can't use storage command in MessageContent with interface %d;\n"
" interface class is %d, expected 8. Abort\n\n", Interface, defaultClass);
- exit(1);
+ abort();
}
if (InquireDevice && show_progress) {
@@ -621,7 +629,7 @@
*/
if ( ModeMap & (ModeMap-1) ) {
fprintf(output,"Multiple special modes selected; check configuration. Abort\n\n");
- exit(1);
+ abort();
}
if ((strlen(MessageContent) || StandardEject) && ModeMap ) {
@@ -693,7 +701,10 @@
}
if(ModeMap & PANTECH_MODE) {
detachDriver();
- switchPantechMode();
+ if (PantechMode > 1)
+ switchPantechMode();
+ else
+ SHOW_PROGRESS(output,"Waiting for auto-switch of Pantech modem ...\n");
}
if(ModeMap & SONY_MODE) {
if (CheckSuccess)
@@ -710,8 +721,8 @@
else
MessageContent3[0] = '\0';
- strcpy(MessageContent,"5553424312345678000000000000061e000000000000000000000000000000");
- strcpy(MessageContent2,"5553424312345679000000000000061b000000020000000000000000000000");
+ strcpy(MessageContent,"5553424387654321000000000000061e000000000000000000000000000000");
+ strcpy(MessageContent2,"5553424397654321000000000000061b000000020000000000000000000000");
NeedResponse = 1;
switchSendMessage();
} else if (ModeMap & HUAWEINEW_MODE) {
@@ -748,20 +759,21 @@
/* No "removal" check if these are set */
if ((Configuration > 0 || AltSetting > -1) && !ResetUSB) {
libusb_close(devh);
- devh = 0;
+ devh = NULL;
}
if (ResetUSB) {
resetUSB();
- devh = 0;
+ devh = NULL;
+ }
+
+ if (searchMode == SEARCH_BUSDEV && sysmode) {
+ printf("ok:busdev\n");
+ close_all();
+ exit(0);
}
if (CheckSuccess) {
- if (searchMode == SEARCH_BUSDEV && sysmode) {
- SHOW_PROGRESS(output,"Bus/dev search active, refer success check to wrapper. Bye!\n\n");
- printf("ok:busdev\n");
- goto CLOSING;
- }
if (checkSuccess()) {
if (sysmode) {
if (NoDriverLoading)
@@ -791,11 +803,7 @@
else
SHOW_PROGRESS(output,"-> Run lsusb to note any changes. Bye!\n\n");
}
-CLOSING:
- if (sysmode)
- closelog();
- if (devh)
- libusb_close(devh);
+ close_all();
exit(0);
}
@@ -803,6 +811,7 @@
/* Get descriptor strings if available (identification details) */
void deviceDescription ()
{
+ int ret=0;
char* c;
memset (imanufact, ' ', DESCR_MAX);
memset (iproduct, ' ', DESCR_MAX);
@@ -858,7 +867,7 @@
};
char *command;
char data[36];
- int i;
+ int i, ret=0;
command = malloc(31);
if (command == NULL) {
@@ -1072,14 +1081,14 @@
skip:
SHOW_PROGRESS(output," Device is gone, skip any further commands\n");
libusb_close(devh);
- devh = 0;
+ devh = NULL;
return 2;
}
int switchConfiguration ()
{
- int count = SWITCH_CONFIG_MAXTRIES;
+ int ret, count = SWITCH_CONFIG_MAXTRIES;
SHOW_PROGRESS(output,"Change configuration to %i ...\n", Configuration);
while (((ret = libusb_set_configuration(devh, Configuration)) < 0) && --count) {
@@ -1097,9 +1106,13 @@
int switchAltSetting ()
{
-
+ int ret;
SHOW_PROGRESS(output,"Change to alt setting %i ...\n", AltSetting);
ret = libusb_claim_interface(devh, Interface);
+ if (ret < 0) {
+ SHOW_PROGRESS(output," Could not claim interface (error %d). Skip AltSetting\n", ret);
+ return 0;
+ }
ret = libusb_set_interface_alt_setting(devh, Interface, AltSetting);
libusb_release_interface(devh, Interface);
if (ret < 0) {
@@ -1112,19 +1125,20 @@
void switchHuaweiMode ()
{
-
+ int ret;
SHOW_PROGRESS(output,"Send old Huawei control message ...\n");
ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, \
LIBUSB_REQUEST_SET_FEATURE, 00000001, 0, (unsigned char *)buffer, 0, 1000);
if (ret != 0) {
fprintf(stderr, "Error: Huawei control message failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
void switchSierraMode ()
{
+ int ret;
SHOW_PROGRESS(output,"Send Sierra control message\n");
ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR, 0x0b, 00000001, 0, (unsigned char *)buffer, 0, 1000);
if (ret == LIBUSB_ERROR_PIPE) {
@@ -1133,13 +1147,14 @@
}
if (ret < 0) {
fprintf(stderr, "Error: Sierra control message failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
void switchGCTMode ()
{
+ int ret;
ret = libusb_claim_interface(devh, Interface);
if (ret != 0) {
SHOW_PROGRESS(output," Could not claim interface (error %d). Skip GCT sequence\n", ret);
@@ -1157,45 +1172,49 @@
}
libusb_release_interface(devh, Interface);
if (ret < 0)
- exit(1);
+ exit(0);
}
void switchKobilMode() {
+ int ret;
SHOW_PROGRESS(output,"Send Kobil control message ...\n");
ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN,
0x88, 0, 0, (unsigned char *)buffer, 8, 1000);
if (ret < 0) {
fprintf(stderr, "Error: Kobil control message failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
void switchQisdaMode () {
+ int ret;
SHOW_PROGRESS(output,"Sending Qisda control message ...\n");
memcpy(buffer, "\x05\x8c\x04\x08\xa0\xee\x20\x00\x5c\x01\x04\x08\x98\xcd\xea\xbf", 16);
ret = libusb_control_transfer(devh, 0x40, 0x04, 0, 0, (unsigned char *)buffer, 16, 1000);
if (ret < 0) {
fprintf(stderr, "Error: Qisda control message failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
void switchQuantaMode() {
+ int ret;
SHOW_PROGRESS(output,"Send Quanta control message ...\n");
ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN,
0xff, 0, 0, (unsigned char *)buffer, 0, 1000);
if (ret < 0) {
SHOW_PROGRESS(output,"Error: Quanta control message failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
void switchBlackberryMode ()
{
+ int ret;
SHOW_PROGRESS(output,"Send Blackberry control message 1 ...\n");
ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN,
0xb1, 0x0000, 0, (unsigned char *)buffer, 8, 1000);
@@ -1207,18 +1226,19 @@
0xa9, 0x000e, 0, (unsigned char *)buffer, 2, 1000);
if (ret != 2) {
fprintf(stderr, "Error: Blackberry control message 2 failed (result %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
void switchPantechMode()
{
- SHOW_PROGRESS(output,"Send Pantech control message ...\n");
- ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, 0x70, 2, 0, (unsigned char *)buffer, 0, 1000);
+ int ret;
+ SHOW_PROGRESS(output,"Send Pantech control message, wValue %d ...\n", PantechMode);
+ ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, 0x70, PantechMode, 0, (unsigned char *)buffer, 0, 1000);
if (ret < 0) {
SHOW_PROGRESS(output," Error: Pantech control message failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
@@ -1237,7 +1257,7 @@
void switchActionMode ()
{
- int i;
+ int ret, i;
SHOW_PROGRESS(output,"Send MobileAction control sequence ...\n");
memcpy(buffer, "\xb0\x04\x00\x00\x02\x90\x26\x86", SIZE);
libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_CLASS + LIBUSB_RECIPIENT_INTERFACE, 0x09, 0x0300, 0, (unsigned char *)buffer, SIZE, 1000);
@@ -1290,16 +1310,17 @@
void switchSequansMode() {
+ int ret;
SHOW_PROGRESS(output,"Send Sequans control message\n");
ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE, SQN_SET_DEVICE_MODE_REQUEST, SQN_CUSTOM_DEVICE_MODE, 0, (unsigned char *)buffer, 0, 1000);
if (ret < 0) {
fprintf(stderr, "Error: Sequans request failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
}
}
void switchCiscoMode() {
- int i;
+ int ret, i;
char* msg[11];
msg[0] = "55534243f83bcd810002000080000afd000000030000000100000000000000";
@@ -1318,7 +1339,7 @@
ret = libusb_claim_interface(devh, Interface);
if (ret < 0) {
SHOW_PROGRESS(output," Could not claim interface (error %d). Abort\n", ret);
- exit(1);
+ abort();
}
// libusb_clear_halt(devh, MessageEndpoint);
if (show_progress)
@@ -1357,13 +1378,13 @@
skip:
SHOW_PROGRESS(output,"Device returned error %d, skip further commands\n", ret);
libusb_close(devh);
- devh = 0;
+ devh = NULL;
}
int switchSonyMode ()
{
- int i, found;
+ int ret, i, found;
detachDriver();
if (CheckSuccess) {
@@ -1374,12 +1395,12 @@
ret = libusb_control_transfer(devh, 0xc0, 0x11, 2, 0, (unsigned char *)buffer, 3, 100);
if (ret < 0) {
fprintf(stderr, "Error: Sony control message failed (error %d). Abort\n\n", ret);
- exit(1);
+ exit(0);
} else
SHOW_PROGRESS(output," OK, control message sent, wait for device to return ...\n");
libusb_close(devh);
- devh = 0;
+ devh = NULL;
/* Now waiting for the device to reappear */
devnum=-1;
@@ -1429,6 +1450,7 @@
int detachDriver()
{
+ int ret;
// Driver already detached during SCSI inquiry ?
if (InquireDevice == 2)
return 1;
@@ -1462,7 +1484,7 @@
int sendMessage(char* message, int count)
{
- int message_length;
+ int ret, message_length;
if (strlen(message) % 2 != 0) {
fprintf(stderr, "Error: MessageContent %d hex string has uneven length. Skipping ...\n", count);
@@ -1485,7 +1507,7 @@
int checkSuccess()
{
- int i=0;
+ int ret, i;
int newTargetCount, success=0;
SHOW_PROGRESS(output,"\nCheck for mode switch (max. %d times, once per second) ...\n", CheckSuccess);
@@ -1497,7 +1519,7 @@
*/
if ((TargetVendor || TargetClass) && devh) {
libusb_close(devh);
- devh = 0;
+ devh = NULL;
}
/* if target ID is not given but target class is, assign default as target;
@@ -1523,7 +1545,7 @@
if (ret < 0) {
SHOW_PROGRESS(output," Original device can't be accessed anymore. Good.\n");
libusb_close(devh);
- devh = 0;
+ devh = NULL;
break;
}
if (i == CheckSuccess-1) {
@@ -1546,7 +1568,7 @@
libusb_open(dev, &devh);
deviceDescription();
libusb_close(devh);
- devh = 0;
+ devh = NULL;
if (verbose) {
fprintf(output,"\nFound target device %03d on bus %03d\n", \
libusb_get_device_address(dev), libusb_get_bus_number(dev));
@@ -1602,7 +1624,7 @@
int write_bulk(int endpoint, char *message, int length)
{
- ret = usb_bulk_io(devh, endpoint, message, length, 3000);
+ int ret = usb_bulk_io(devh, endpoint, message, length, 3000);
if (ret >= 0 ) {
SHOW_PROGRESS(output," OK, message successfully sent\n");
} else
@@ -1616,7 +1638,7 @@
int read_bulk(int endpoint, char *buffer, int length)
{
- ret = usb_bulk_io(devh, endpoint, buffer, length, 3000);
+ int ret = usb_bulk_io(devh, endpoint, buffer, length, 3000);
if (ret >= 0 ) {
SHOW_PROGRESS(output," Response successfully read (%d bytes).\n", ret);
} else
@@ -1630,12 +1652,9 @@
void release_usb_device(int __attribute__((unused)) dummy) {
SHOW_PROGRESS(output,"Program cancelled by system. Bye!\n\n");
- if (devh) {
+ if (devh)
libusb_release_interface(devh, Interface);
- libusb_close(devh);
- }
- if (sysmode)
- closelog();
+ close_all();
exit(0);
}
@@ -1805,17 +1824,17 @@
int get_current_configuration()
{
- int cfg;
SHOW_PROGRESS(output,"Get the current device configuration ...\n");
- if (active_config == NULL)
- libusb_get_active_config_descriptor(dev, &active_config);
-
- cfg = active_config->bConfigurationValue;
- libusb_free_config_descriptor(active_config);
- if (ret < 0)
- exit(1);
- else
- return cfg;
+ if (active_config != NULL) {
+ libusb_free_config_descriptor(active_config);
+ active_config = NULL;
+ }
+ int ret = libusb_get_active_config_descriptor(dev, &active_config);
+ if (ret < 0) {
+ SHOW_PROGRESS(output," Determining the active configuration failed (error %d). Abort\n", ret);
+ abort();
+ }
+ return active_config->bConfigurationValue;
}
int get_interface_class()
@@ -1859,7 +1878,7 @@
}
if (file==NULL) {
fprintf(stderr, "Error: Could not find file %s. Abort\n\n", FileName);
- exit(1);
+ abort();
} else {
token = fgets(Str, LINE_DIM-1, file);
}
@@ -1981,11 +2000,32 @@
return 0;
}
+void close_all()
+{
+ if (active_config)
+ libusb_free_config_descriptor(active_config);
+ if (devh)
+ libusb_close(devh);
+ // libusb_exit will crash on Raspbian 7, crude protection
+#ifndef __ARMEL__
+ libusb_exit(NULL);
+#endif
+ if (sysmode)
+ closelog();
+}
+
+void abort()
+{
+ close_all();
+ exit(1);
+}
+
+
void printVersion()
{
char* version = VERSION;
fprintf(output,"\n * usb_modeswitch: handle USB devices with multiple modes\n"
- " * Version %s (C) Josua Dietze 2014\n"
+ " * Version %s (C) Josua Dietze 2015\n"
" * Based on libusb1/libusbx\n\n"
" ! PLEASE REPORT NEW CONFIGURATIONS !\n\n", version);
}
@@ -2021,6 +2061,7 @@
" -L, --cisco-mode apply a special procedure\n"
" -B, --qisda-mode apply a special procedure\n"
" -E, --quanta-mode apply a special procedure\n"
+ " -F, --pantech-mode NUM apply a special procedure, pass NUM through\n"
" -R, --reset-usb reset the device after all other actions\n"
" -Q, --quiet don't show progress or error messages\n"
" -W, --verbose print all settings and debug output\n"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/usb_modeswitch.conf new/usb-modeswitch-2.2.5/usb_modeswitch.conf
--- old/usb-modeswitch-2.2.1/usb_modeswitch.conf 2015-01-14 21:18:55.000000000 +0100
+++ new/usb-modeswitch-2.2.5/usb_modeswitch.conf 2015-07-16 23:36:39.000000000 +0200
@@ -12,6 +12,10 @@
DisableSwitching=0
+# Disable check for MBIM module presence and configuration globally (to aid
+# special embedded environments)
+
+DisableMBIMGlobal=0
# Enable logging (results in a extensive report file in /var/log, named
# "usb_modeswitch_<interface-name>" and probably others
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/usb_modeswitch.h new/usb-modeswitch-2.2.5/usb_modeswitch.h
--- old/usb-modeswitch-2.2.1/usb_modeswitch.h 2015-01-14 21:14:40.000000000 +0100
+++ new/usb-modeswitch-2.2.5/usb_modeswitch.h 2015-07-16 21:45:54.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.2.1, 2015/05/15
+ Version 2.2.5, 2015/07/16
Copyright (C) 2007 - 2015 Josua Dietze
Config file parsing stuff borrowed from Guillaume Dargaud
@@ -60,6 +60,8 @@
int hexstr2bin(const char *hex, char *buffer, int len);
void printVersion();
void printHelp();
+void close_all();
+void abort();
int readArguments(int argc, char **argv);
void deviceDescription();
int deviceInquire();
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/usb_modeswitch.sh new/usb-modeswitch-2.2.5/usb_modeswitch.sh
--- old/usb-modeswitch-2.2.1/usb_modeswitch.sh 2015-01-14 21:14:51.000000000 +0100
+++ new/usb-modeswitch-2.2.5/usb_modeswitch.sh 2015-07-16 21:46:06.000000000 +0200
@@ -1,5 +1,5 @@
#!/bin/sh
-# part of usb_modeswitch 2.2.1
+# part of usb_modeswitch 2.2.5
device_in()
{
if [ ! -e /var/lib/usb_modeswitch/$1 ]; then
@@ -73,20 +73,23 @@
exit 0
;;
esac
-exec 1<&- 2<&- 5<&- 7<&-
(
+IFS='/' read -r p1 p2 < 0} {
SetStorageDelay $flags(stordelay)
@@ -260,18 +258,21 @@
set busParam ""
set devParam ""
}
- set configBuffer [ConfigGet conffile $mconfig]
- ParseDeviceConfig $configBuffer
+ set flags(config) [ConfigGet conffile $mconfig]
+ ParseDeviceConfig $flags(config)
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)
+ if $flags(nombim) {
+ set config(NoMBIMCheck) 1
+ }
+ if {$config(WaitBefore) != ""} {
+ Log "Delay time of $config(WaitBefore) seconds"
+ append config(WaitBefore) "000"
+ after $config(WaitBefore)
Log " wait is over, start mode switch"
}
- if {$config(noMBIMCheck)==0 && $usb(bNumConfigurations) > 1} {
+ if {$config(NoMBIMCheck)==0 && $usb(bNumConfigurations) > 1} {
Log "Device may have an MBIM configuration, check driver ..."
if [CheckMBIM] {
Log " driver for MBIM devices is available"
@@ -282,8 +283,8 @@
set cfgno [string trim $cfgno]
if {$cfgno > 0} {
set config(Configuration) $cfgno
- set config(driverModule) ""
- set configBuffer "Configuration=$cfgno"
+ set config(DriverModule) ""
+ set flags(config) "Configuration=$cfgno"
} else {
Log " No MBIM configuration found, switch to legacy modem mode"
}
@@ -292,11 +293,16 @@
Log " no MBIM driver found, switch to legacy modem mode"
}
}
-
+ if [PantechAutoSwitch] {
+ Log "Waiting for Pantech auto-modeswitch"
+ set report "ok:busdev"
+ break
+ }
+ UnbindDriver $devdir $ifdir
# Now we are actually switching
if $flags(logging) {
- Log "Command to be run:\nusb_modeswitch -W -D -s 20 $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f \$configBuffer"
- set report [exec /usr/sbin/usb_modeswitch -W -D -s 20 $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$configBuffer" 2>@1]
+ Log "Command to be run:\nusb_modeswitch -W -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f \$flags(config)"
+ set report [exec /usr/sbin/usb_modeswitch -W -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$flags(config)" 2>@1]
Log "\nVerbose debug output of usb_modeswitch and libusb follows"
Log "(Note that some USB errors are to be expected in the process)"
Log "--------------------------------"
@@ -304,7 +310,7 @@
Log "--------------------------------"
Log "(end of usb_modeswitch output)\n"
} else {
- set report [exec /usr/sbin/usb_modeswitch -Q -D -s 20 $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$configBuffer" 2>@1]
+ set report [exec /usr/sbin/usb_modeswitch -Q -D $configParam $busParam $devParam -v $usb(idVendor) -p $usb(idProduct) -f "$flags(config)" 2>@1]
}
break
} else {
@@ -316,6 +322,10 @@
# done by usb_modeswitch and logged via syslog OR bus/dev
# parameter were used; then we do check for success HERE
+if {$config(Configuration) != ""} {
+ set ifdir [regsub {(\d):\d+\.0} $ifdir "\\1:$config(Configuration).0"]
+}
+
if [regexp {ok:busdev} $report] {
if [CheckSuccess $devdir] {
Log "Mode switching was successful, found $usb(idVendor):$usb(idProduct) ($usb(manufacturer): $usb(product))"
@@ -342,11 +352,13 @@
ReadUSBAttrs $devdir $ifdir
}
-# Now checking for bound drivers (only for class 0xff)
+# Checking for bound drivers if there is an interface with class 0xff
-if {$config(driverModule) != "" && $usb($ifdir/bInterfaceClass) != "" && [regexp {ok:} $report]} {
- if {$usb($ifdir/bInterfaceClass) != "ff"} {
- set config(driverModule) ""
+if {$config(DriverModule) != "" && [regexp {ok:} $report]} {
+ if [HasFF] {
+ AddToList link_list $usb(idVendor):$usb(idProduct)
+ } else {
+ set config(DriverModule) ""
Log " No vendor-specific class found, skip driver check"
}
}
@@ -354,7 +366,7 @@
# If module is set (it is by default), driver shall be loaded.
# If not, then NoDriverLoading is active
-if {$config(driverModule) != ""} {
+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"
@@ -362,11 +374,10 @@
}
}
# wait for any drivers to bind automatically
- after 1000
+ after 1500
Log "Now check for bound driver ..."
if {![file exists $devdir/$ifdir/driver]} {
Log " no driver has bound to interface 0 yet"
- AddToList link_list $usb(idVendor):$usb(idProduct)
# If device is known, the sh wrapper will take care, else:
if {[InBindList $usb(idVendor):$usb(idProduct)] == 0} {
@@ -560,6 +571,13 @@
while {![eof $rc]} {
gets $rc line
if [regexp {^#} [string trim $line]] {continue}
+ if [regexp {DisableMBIMGlobal\s*=\s*([^\s]+)} $line d val] {
+ if [regexp -nocase {1|yes|true} $val] {
+ set flags(nombim) 1
+ } else {
+ set flags(nombim) 0
+ }
+ }
if [regexp {DisableSwitching\s*=\s*([^\s]+)} $line d val] {
if [regexp -nocase {1|yes|true} $val] {
set flags(noswitching) 1
@@ -568,6 +586,8 @@
if [regexp {EnableLogging\s*=\s*([^\s]+)} $line d val] {
if [regexp -nocase {1|yes|true} $val] {
set flags(logging) 1
+ } else {
+ set flags(logging) 0
}
}
if [regexp {SetStorageDelay\s*=\s*([^\s]+)} $line d val] {
@@ -583,51 +603,28 @@
# end of proc {ParseGlobalConfig}
-proc ParseDeviceConfig {configContent} {
+proc ParseDeviceConfig {cfg} {
global config
-set config(driverModule) ""
-set config(driverIDPath) ""
-set config(waitBefore) ""
-set config(targetVendor) ""
-set config(targetProduct) ""
-set config(targetClass) ""
+set config(DriverModule) ""
+set config(DriverIDPath) ""
+set config(WaitBefore) ""
+set config(TargetVendor) ""
+set config(TargetProduct) ""
+set config(TargetClass) ""
set config(Configuration) ""
-set config(noMBIMCheck) 0
-set config(checkSuccess) 20
+set config(NoMBIMCheck) 0
+set config(PantechMode) 0
+set config(CheckSuccess) 20
set loadDriver 1
-if [regexp -line {^[^#]*?TargetVendor.*?=.*?0x(\w+).*?$} $configContent d config(targetVendor)] {
- Log "config: TargetVendor set to $config(targetVendor)"
-}
-if [regexp -line {^[^#]*?TargetProduct.*?=.*?0x(\w+).*?$} $configContent d config(targetProduct)] {
- Log "config: TargetProduct set to $config(targetProduct)"
-}
-if [regexp -line {^[^#]*?TargetProductList.*?=.*?"([0-9a-fA-F,]+).*?$} $configContent d config(targetProduct)] {
- Log "config: TargetProductList set to $config(targetProduct)"
-}
-if [regexp -line {^[^#]*?TargetClass.*?=.*?0x(\w+).*?$} $configContent d config(targetClass)] {
- Log "config: TargetClass set to $config(targetClass)"
-}
-if [regexp -line {^[^#]*?Configuration.*?=.*?([0-9]+).*?$} $configContent d config(Configuration)] {
- Log "config: Configuration (target) set to $config(Configuration)"
-}
-if [regexp -line {^[^#]*?DriverModule.*?=.*?(\w+).*?$} $configContent d config(driverModule)] {
- Log "config: DriverModule set to $config(driverModule)"
-}
-if [regexp -line {^[^#]*?DriverIDPath.*?=.*?"?([/\-\w]+).*?$} $configContent d config(driverIDPath)] {
- Log "config: DriverIDPath set to $config(driverIDPath)"
-}
-if [regexp -line {^[^#]*?CheckSuccess.*?=.*?([0-9]+).*?$} $configContent d config(checkSuccess)] {
- Log "config: CheckSuccess set to $config(checkSuccess)"
-}
-if [regexp -line {^[^#]*?WaitBefore.*?=.*?([0-9]+).*?$} $configContent d config(waitBefore)] {
- Log "config: WaitBefore set to $config(waitBefore)"
-}
-if [regexp -line {^[^#]*?NoMBIMCheck.*?=.*?([0-9]+).*?$} $configContent d config(noMBIMCheck)] {
- Log "config: noMBIMCheck set to $config(noMBIMCheck)"
+foreach pname [lsort [array names config]] {
+ if [regexp -line "^\[^# \]*?$pname.*?= *(0x(\\w+)|\"(\[0-9a-fA-F,\]+)\"|(\[0-9\]+)) *\$" $cfg d config($pname)] {
+# Log "config: $pname set to $config($pname)"
+ }
}
-if [regexp -line {^[^#]*?NoDriverLoading.*?=.*?(1|yes|true).*?$} $configContent] {
+
+if [regexp -line {^[^#]*?NoDriverLoading.*?=.*?(1|yes|true).*?$} $cfg] {
set loadDriver 0
Log "config: NoDriverLoading is set to active"
}
@@ -635,19 +632,19 @@
# 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"
+ 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)"
+ if {$config(DriverIDPath) == ""} {
+ set config(DriverIDPath) "/sys/bus/usb/drivers/$config(DriverModule)"
}
}
- Log "Driver module is \"$config(driverModule)\", ID path is $config(driverIDPath)\n"
+ 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]
+set config(WaitBefore) [string trimleft $config(WaitBefore) 0]
}
# end of proc {ParseDeviceConfig}
@@ -736,7 +733,7 @@
proc {SymLinkName} {path} {
-global device
+global device flags
proc {hasInterrupt} {ifDir} {
if {[llength [glob -nocomplain $ifDir/ttyUSB*]] == 0} {
@@ -774,16 +771,17 @@
}
}
}
-
-if {![regexp {ttyUSB[0-9]+} $path myPort]} {
+if {![regexp {([0-9]+-[0-9]+[\.0-9]*:[^/]*).*(ttyUSB[0-9]+)} $path d myDev myPort]} {
if $flags(logging) {
set device [clock clicks]
+ set flags(logwrite) 1
Log "$loginit\nThis is not a ttyUSB port. Abort"
}
return ""
}
-set device $myPort
+set device ttyUSB_$myDev
+set flags(logwrite) 1
Log "$loginit\nMy name is $myPort\n"
if {![regexp {(.*?[0-9]+)\.([0-9]+)/ttyUSB} /sys$path d ifRoot ifNum]} {
@@ -858,15 +856,15 @@
}
Log "Module loader is $loader"
-set idfile $config(driverIDPath)/new_id
+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"
+ 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"
}
@@ -882,8 +880,8 @@
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)\""
+ 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"
@@ -893,7 +891,7 @@
} else {
Log " \"$idfile\" not found, check if kernel version is at least 2.6.27"
Log "Fall back to \"usbserial\""
- set config(driverModule) 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"
@@ -936,15 +934,6 @@
proc {AddToList} {name id} {
set listfile /var/lib/usb_modeswitch/$name
-set oldlistfile /etc/usb_modeswitch.d/bind_list
-
-if {($name == "bind_list") && [file exists $oldlistfile] && ![file exists $listfile]} {
- if [catch {file rename $oldlistfile $listfile} err] {
- Log "Error renaming the old bind list file ($err)"
- return
- }
-}
-
if [file exists $listfile] {
set rc [open $listfile r]
set buffer [read $rc]
@@ -1000,14 +989,14 @@
global config usb flags
set ifdir [file tail [IfDir 0]]
-if {[string length $config(targetClass)] || [string length $config(Configuration)]} {
- set config(targetVendor) $usb(idVendor)
- set config(targetProduct) $usb(idProduct)
+if {[string length $config(TargetClass)] || [string length $config(Configuration)]} {
+ set config(TargetVendor) $usb(idVendor)
+ set config(TargetProduct) $usb(idProduct)
}
-Log "Check success of mode switch for max. $config(checkSuccess) seconds ..."
+Log "Check success of mode switch for max. $config(CheckSuccess) seconds ..."
set expected 1
-for {set i 1} {$i <= $config(checkSuccess)} {incr i} {
+for {set i 1} {$i <= $config(CheckSuccess)} {incr i} {
after 1000
if {![file isdirectory $devdir]} {
Log " Wait for device file system ($i sec.) ..."
@@ -1025,23 +1014,24 @@
if [string length $config(Configuration)] {
if {$usb(bConfigurationValue) != $config(Configuration)} {continue}
}
- if [string length $config(targetClass)] {
- if {![regexp $usb($ifdir/bInterfaceClass) $config(targetClass)]} {
+ 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(TargetVendor)]} {
if {![regexp $usb(idVendor) $config(vendor)]} {
set expected 0
} else {continue}
}
- if {![regexp $usb(idProduct) $config(targetProduct)]} {
+ if {![regexp $usb(idProduct) $config(TargetProduct)]} {
if {![regexp $usb(idProduct) $config(product)]} {
set expected 0
} else {continue}
}
+ # Arriving here means that device attributes have changed
if $expected {
Log " All attributes matched"
} else {
@@ -1054,10 +1044,7 @@
}
break
}
-if {$i > 20} {
- return 0
-}
-return 1
+if {$i > 20} {return 0} else {return 1}
}
# end of proc {CheckSuccess}
@@ -1144,12 +1131,51 @@
proc {CheckMBIM} {} {
set kversion [exec uname -r]
-if [file exists /lib/modules/$kversion/kernel/drivers/net/usb/cdc_mbim.ko] {return 1}
+if [llength [glob -nocomplain /lib/modules/$kversion/kernel/drivers/net/usb/cdc_mbim*]] {return 1}
+if [file exists /sys/bus/usb/drivers/cdc_mbim] {return 1}
+return 0
+
+}
+
+proc {CheckQMI} {} {
+
+set kversion [exec uname -r]
+if [llength [glob -nocomplain /lib/modules/$kversion/kernel/drivers/net/usb/qmi_wwan*]] {return 1}
if [file exists /sys/bus/usb/drivers/cdc_mbim] {return 1}
return 0
}
+proc {PantechAutoSwitch} {} {
+
+global config flags
+if {$config(PantechMode) == 3} {return 1}
+if {$config(PantechMode) == 1} {
+ if {"$config(vendor):$config(product)" == "10a9:6080"} {
+ set flags(config) [regsub {PantechMode *= *1} $flags(config) "PantechMode=2"]
+ Log " PantechMode changed to 2"
+ return 0
+ } elseif [CheckQMI] {
+ set flags(config) [regsub {PantechMode *= *1} $flags(config) "PantechMode=4"]
+ Log " PantechMode changed to 4"
+ return 0
+ } else {
+ return 1
+ }
+} else {return 0}
+
+}
+
+proc UnbindDriver {devdir ifdir} {
+
+set att $devdir/$ifdir/driver/unbind
+if [file exists $att] {
+ Log "Unbinding driver"
+ exec echo -n "$ifdir" > $att
+}
+
+}
+
proc {LogAttributes} {} {
global flags usb
@@ -1162,5 +1188,18 @@
}
+proc {HasFF} {} {
+
+set i 0
+while {[set dir [IfDir $i]] != ""} {
+ set c [exec cat $dir/bInterfaceClass]
+ if {$c == "ff"} {return 1}
+ incr i
+}
+return 0
+
+}
+
+
# The actual entry point
Main $argv $argc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/usb_modeswitch@.service new/usb-modeswitch-2.2.5/usb_modeswitch@.service
--- old/usb-modeswitch-2.2.1/usb_modeswitch@.service 2013-08-26 22:34:05.000000000 +0200
+++ new/usb-modeswitch-2.2.5/usb_modeswitch@.service 2015-06-24 21:57:39.000000000 +0200
@@ -1,6 +1,8 @@
[Unit]
-Description=USB_ModeSwitch
+Description=USB_ModeSwitch_%i
[Service]
Type=oneshot
-ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-systemd %I
+ExecStart=/usr/sbin/usb_modeswitch_dispatcher --switch-systemd %i
+#ExecStart=/bin/echo %i
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-2.2.1/usb_modeswitch_dispatcher.1 new/usb-modeswitch-2.2.5/usb_modeswitch_dispatcher.1
--- old/usb-modeswitch-2.2.1/usb_modeswitch_dispatcher.1 2013-09-01 14:39:03.000000000 +0200
+++ new/usb-modeswitch-2.2.5/usb_modeswitch_dispatcher.1 2015-06-20 15:25:41.000000000 +0200
@@ -1,18 +1,19 @@
.TH "USB_MODESWITCH_DISPATCHER" "1"
.SH "NAME"
-usb_modeswitch_dispatcher - wrapper for usb_modeswitch, not intended for direct invocation.
+usb_modeswitch_dispatcher - Linux wrapper for usb_modeswitch (not intended for direct invocation)
.SH "SYNOPSIS"
.PP
\fBusb_modeswitch_dispatcher\fR
.SH "DESCRIPTION"
.PP
usb_modeswitch_dispatcher will do detailed device checking and will subsequently
-use the usb_modeswitch binary together with the selected device config file to
-switch the mode of certain USB devices.
+use the Linux-independent usb_modeswitch binary together with the selected device
+config file to switch the mode of certain USB devices.
.PP
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
-useable.
+will try to load and bind the "option" serial driver to any USB interfaces with
+class 0xff, in order to make the device useable in case it is not recognized by that
+driver yet. This may or may not work.
.PP
This program is called by udev and is not supposed to be called directly
by the user.
++++++ usb-modeswitch-data-20150115.tar.bz2 -> usb-modeswitch-data-20150627.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/40-usb_modeswitch.rules new/usb-modeswitch-data-20150627/40-usb_modeswitch.rules
--- old/usb-modeswitch-data-20150115/40-usb_modeswitch.rules 2015-01-15 21:12:36.000000000 +0100
+++ new/usb-modeswitch-data-20150627/40-usb_modeswitch.rules 2015-06-27 23:46:43.000000000 +0200
@@ -1,6 +1,6 @@
-# Part of usb-modeswitch-data, version 20150115
+# Part of usb-modeswitch-data, version 20150627
#
-# Works with usb_modeswitch versions >= 2.2.0 (introduction of HuaweiNewMode)
+# Works with usb_modeswitch versions >= 2.2.2 (extension of PantechMode)
#
ACTION!="add|change", GOTO="modeswitch_rules_end"
@@ -20,8 +20,8 @@
ACTION!="add", GOTO="modeswitch_rules_end"
-# Generic entry for all Huawei devices
-ATTRS{idVendor}=="12d1", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"
+# Generic entry for all Huawei devices, excluding Android phones
+ATTRS{idVendor}=="12d1", ATTRS{manufacturer}!="Android*", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"
# HP LaserJet Professional P1102
ATTR{idVendor}=="03f0", ATTR{idProduct}=="002a", RUN+="usb_modeswitch '%b/%k'"
@@ -116,13 +116,13 @@
# Axesstel Modems (w/ initial idProduct 0x0010)
ATTR{idVendor}=="05c6", ATTR{idProduct}=="0010", RUN+="usb_modeswitch '%b/%k'"
-# Prolink P2000 CDMA, Samsung SGH-Z810, Older Option devices, Vertex Wireless 100 Series, AnyDATA devices, Bless UC165, Option GlobeTrotter GX0201, Celot K-300, Celot CT-680, StrongRising device, TechFaith Venus VT-18
+# Prolink P2000 CDMA, Samsung SGH-Z810, Older Option devices, Vertex Wireless 100 Series, AnyDATA devices, Bless UC165, Celot K-300, Celot CT-680, StrongRising device, TechFaith Venus VT-18
ATTR{idVendor}=="05c6", ATTR{idProduct}=="1000", RUN+="usb_modeswitch '%b/%k'"
# Various USB modems
ATTR{idVendor}=="05c6", ATTR{idProduct}=="2000", RUN+="usb_modeswitch '%b/%k'"
-# D-Link DWM-162-U5, Micromax MMX 300c
+# D-Link DWM-162-U5, DWM-162 C1, Micromax MMX 300c
ATTR{idVendor}=="05c6", ATTR{idProduct}=="2001", RUN+="usb_modeswitch '%b/%k'"
# AnyDATA APE-540H
@@ -152,6 +152,9 @@
# Dymo LabelManager
ATTR{idVendor}=="0922", ATTR{idProduct}=="1001", RUN+="usb_modeswitch '%b/%k'"
+# Dymo LabelManager 420P
+ATTR{idVendor}=="0922", ATTR{idProduct}=="1003", RUN+="usb_modeswitch '%b/%k'"
+
# Toshiba G450
ATTR{idVendor}=="0930", ATTR{idProduct}=="0d46", RUN+="usb_modeswitch '%b/%k'"
@@ -368,7 +371,7 @@
# Mobile Action ("Smart Cable")
ATTR{idVendor}=="0df7", ATTR{idProduct}=="0800", RUN+="usb_modeswitch '%b/%k'"
-# MediaTek MT6276M and others
+# MediaTek/Medion S4222 and probably others, MediaTek MT6276M and others
ATTR{idVendor}=="0e8d", ATTR{idProduct}=="0002", RUN+="usb_modeswitch '%b/%k'"
# MediaTek Wimax USB Card
@@ -452,6 +455,9 @@
# Hisense E910 EVDO Phone
ATTR{idVendor}=="109b", ATTR{idProduct}=="f009", RUN+="usb_modeswitch '%b/%k'"
+# Pantech/Verizon UML295, Use 1 for automatic choice, 2 for RNDIS, 4 for QMI
+ATTR{idVendor}=="10a9", ATTR{idProduct}=="606f", RUN+="usb_modeswitch '%b/%k'"
+
# Pantech LTE Modem
ATTR{idVendor}=="10a9", ATTR{idProduct}=="6080", RUN+="usb_modeswitch '%b/%k'"
@@ -527,6 +533,9 @@
# Axesstel MU130
ATTR{idVendor}=="1726", ATTR{idProduct}=="f00e", RUN+="usb_modeswitch '%b/%k'"
+# Spreadtrum SC7702
+ATTR{idVendor}=="1782", ATTR{idProduct}=="0003", RUN+="usb_modeswitch '%b/%k'"
+
# JOA Telecom LM-700r
ATTR{idVendor}=="198a", ATTR{idProduct}=="0003", RUN+="usb_modeswitch '%b/%k'"
@@ -590,6 +599,9 @@
# ZTE MF821D
ATTR{idVendor}=="19d2", ATTR{idProduct}=="0325", RUN+="usb_modeswitch '%b/%k'"
+# ZTE MF90 Mobile Hotspot
+ATTR{idVendor}=="19d2", ATTR{idProduct}=="0388", RUN+="usb_modeswitch '%b/%k'"
+
# Telewell TW-LTE 4G
ATTR{idVendor}=="19d2", ATTR{idProduct}=="0413", RUN+="usb_modeswitch '%b/%k'"
@@ -866,7 +878,10 @@
# D-Link DWM-221
ATTR{idVendor}=="2001", ATTR{idProduct}=="98ff", RUN+="usb_modeswitch '%b/%k'"
-# D-Link DWM-156 A8
+# D-Link DWM-221 B1
+ATTR{idVendor}=="2001", ATTR{idProduct}=="a401", RUN+="usb_modeswitch '%b/%k'"
+
+# D-Link DWM-156 A8, DWP-157 B1
ATTR{idVendor}=="2001", ATTR{idProduct}=="a403", RUN+="usb_modeswitch '%b/%k'"
# D-Link DWM-167 A1
@@ -893,7 +908,7 @@
# Haier CE 100
ATTR{idVendor}=="201e", ATTR{idProduct}=="2009", RUN+="usb_modeswitch '%b/%k'"
-# Mediatek MT6229, Micromax MMX 377G
+# Mediatek MT6229, Micromax MMX 377G, Olicard 300
ATTR{idVendor}=="2020", ATTR{idProduct}=="0002", RUN+="usb_modeswitch '%b/%k'"
# SpeedUp SU-8000
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/ChangeLog new/usb-modeswitch-data-20150627/ChangeLog
--- old/usb-modeswitch-data-20150115/ChangeLog 2015-01-15 21:07:02.000000000 +0100
+++ new/usb-modeswitch-data-20150627/ChangeLog 2015-06-27 22:56:38.000000000 +0200
@@ -1,3 +1,13 @@
+20150627:
+ ATTENTION: recommended use with usb-modeswitch program package version
+ >= 2.2.2 due to extended parameter PantechMode (affects 2 devices, see
+ also REFERENCE);
+ Added devices: Dymo LabelManager 420P, MediaTek/Medion S4222 and probably
+ others, Pantech/Verizon UML295, Vodafone (Huawei) R205, Vodafone (Huawei)
+ R215, Huawei E3372, Huawei E3372s-153, Huawei E5377, Huawei/Vodafone R226,
+ Spreadtrum SC7702, D-Link DWM-221 B1, ZTE MF90 Mobile Hotspot; some new
+ target IDs added to existing device configs; modified the catch-all Huawei
+ udev rule to exclude Android smartphones
20150115:
Added devices: Aiko 81D, Alcatel-Lucent ABS-T920, Alcatel X602D,
Amoi H-01, Amoi H-02, D-Link DWM-157 B1, D-Link DWM-221, D-Link
@@ -122,7 +132,7 @@
Added devices: Huawei EC156, Huawei K3770, Huawei K3771, Option iCon 461,
Longcheer SU9800, ZTE AX226 (WiMax)
20110619:
- Added devices: Huawei E352, Huawei U8220, Huawei E173, D-Link DWM-156
+ Added devices: Huawei E352, Huawei U8220, Huawei E173, D-Link DWM-156
(Variant), Cricket A605, ZTE K3806-Z, ZTE MF190 (two Variants), ZTE MF192,
ZTE MF691, Visiontek 82GH 3G, C-motech CHU-629S (Variant), JOA Telecom
LM-700r, HP LaserJet Professional P1102, Mobile Action Cable (migrated from
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/Makefile new/usb-modeswitch-data-20150627/Makefile
--- old/usb-modeswitch-data-20150115/Makefile 2015-01-15 21:07:22.000000000 +0100
+++ new/usb-modeswitch-data-20150627/Makefile 2015-06-27 23:48:35.000000000 +0200
@@ -1,5 +1,5 @@
PROG = usb-modeswitch-data
-VERS = 20150115
+VERS = 20150627
RM = /bin/rm -f
PREFIX = $(DESTDIR)/usr
ETCDIR = $(DESTDIR)/etc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/README new/usb-modeswitch-data-20150627/README
--- old/usb-modeswitch-data-20150115/README 2015-01-14 21:21:53.000000000 +0100
+++ new/usb-modeswitch-data-20150627/README 2015-06-27 22:58:13.000000000 +0200
@@ -100,6 +100,7 @@
on-the-fly, this is the file node to use.
Example: "/sys/bus/usb-serial/drivers/option1/new_id"
+See also complete parameter explanation in REFERENCE.
Notes about specific devices:
@@ -143,4 +144,4 @@
-Last revised: 2015-01-15, Josua Dietze
+Last revised: 2015-06-27, Josua Dietze
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/REFERENCE new/usb-modeswitch-data-20150627/REFERENCE
--- old/usb-modeswitch-data-20150115/REFERENCE 2014-05-29 21:53:00.000000000 +0200
+++ new/usb-modeswitch-data-20150627/REFERENCE 2015-06-27 23:56:10.000000000 +0200
@@ -1,17 +1,17 @@
Configuration File Reference for USB_ModeSwitch
-----------------------------------------------
-Last modified: 2014-05-29
+Last modified: 2015-06-27
General Rules:
Numbers can be decimal or hexadecimal, Bulk message strings must be
-hexadecimal without prepended "0x". Digits 9-16 (command tag) in
-mass storage messages (starting with "55534243") are random; I set
-them to "12345678". Mind that you should make them unique if more
-than one MessageContent is used.
+hexadecimal without prepended "0x". Digits 9-16 (message tag) in
+mass storage messages (which start with "55534243") are random; I set
+them to "12345678". Not that you must make them unique if more than
+one MessageContent is used.
-> ALL MISTYPED PARAMETERS AND OTHER ENTRIES ARE SILENTLY IGNORED <-
@@ -126,7 +126,6 @@
* MobileActionMode <0/1> -A
* QisdaMode <0/1> -B
* QuantaMode <0/1> -E
-* PantechMode <0/1> -F
* BlackberryMode <0/1> -Z
* CiscoMode <0/1> -L
@@ -135,6 +134,20 @@
The names are referring to the respective manufacturers.
+* PantechMode -F <num value>
+
+Extended flag for Pantech devices offering multiple target modes. Not
+all models were confirmed to support all modes. Possible values are:
+
+ 1 - Automatic choice, checks for MBIM driver availability (recomm.)
+ 2 - forced RNDIS mode
+ 3 - forced CDC Ether mode (internal switch, no usb_modeswitch action)
+ 4 - forced MBIM mode
+
+Important: the -F parameter value for usb_modeswitch is directly used as
+wValue in the control message!
+
+
* ResetUSB <0/1> -R
Few devices or systems need a rougher treatment. If the switching seems
@@ -198,6 +211,6 @@
* NoMBIMCheck <0|1> (no command line parameter)
-Disable the check for new MBIM standard devices, which is always done
-by default.
-
+Disable the check for devices providing the MBIM standard; this check
+is otherwise done by default. See /etc/usb_modeswitch.conf from the
+program package for a global setting regarding this.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/gen-rules.tcl new/usb-modeswitch-data-20150627/gen-rules.tcl
--- old/usb-modeswitch-data-20150115/gen-rules.tcl 2014-05-29 21:46:57.000000000 +0200
+++ new/usb-modeswitch-data-20150627/gen-rules.tcl 2015-06-27 23:48:55.000000000 +0200
@@ -9,7 +9,7 @@
# Default version string
-set version "20140529"
+set version "20150627"
if {[lindex $argv 0] == "--set-version" && [regexp {\d\d\d\d\d\d\d\d} [lindex $argv 1]]} {
set version [lindex $argv 1]
@@ -35,7 +35,7 @@
puts -nonewline $wc {# Part of usb-modeswitch-data, version }
puts $wc $version
puts $wc {#
-# Works with usb_modeswitch versions >= 2.2.0 (introduction of HuaweiNewMode)
+# Works with usb_modeswitch versions >= 2.2.2 (extension of PantechMode)
#
ACTION!="add|change", GOTO="modeswitch_rules_end"
@@ -55,8 +55,8 @@
ACTION!="add", GOTO="modeswitch_rules_end"
-# Generic entry for all Huawei devices
-ATTRS{idVendor}=="12d1", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"}
+# Generic entry for all Huawei devices, excluding Android phones
+ATTRS{idVendor}=="12d1", ATTRS{manufacturer}!="Android", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"}
set vendorList ""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/05c6:2001 new/usb-modeswitch-data-20150627/usb_modeswitch.d/05c6:2001
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/05c6:2001 2014-03-26 20:50:18.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/05c6:2001 2015-06-21 17:50:14.000000000 +0200
@@ -1,4 +1,4 @@
-# D-Link DWM-162-U5, Micromax MMX 300c
+# D-Link DWM-162-U5, DWM-162 C1, Micromax MMX 300c
TargetVendor=0x1e0e
-TargetProductList="ce16,cefe"
+TargetProductList="ce16,ce17,cefe"
StandardEject=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/0922:1003 new/usb-modeswitch-data-20150627/usb_modeswitch.d/0922:1003
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/0922:1003 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/0922:1003 2015-06-21 13:53:33.000000000 +0200
@@ -0,0 +1,5 @@
+# Dymo LabelManager 420P
+TargetVendor= 0x0922
+TargetProduct= 0x1004
+MessageContent="1b5a01"
+NoDriverLoading=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/0e8d:0002:uPr=Product new/usb-modeswitch-data-20150627/usb_modeswitch.d/0e8d:0002:uPr=Product
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/0e8d:0002:uPr=Product 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/0e8d:0002:uPr=Product 2015-06-21 11:13:34.000000000 +0200
@@ -0,0 +1,4 @@
+# MediaTek/Medion S4222 and probably others
+TargetVendor=0x0e8d
+TargetProductList="00a1,00a2,00a5"
+MessageContent="555342431234567800000000000006f0010300000000000000000000000000"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/10a9:606f new/usb-modeswitch-data-20150627/usb_modeswitch.d/10a9:606f
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/10a9:606f 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/10a9:606f 2015-06-21 15:48:21.000000000 +0200
@@ -0,0 +1,6 @@
+# Pantech/Verizon UML295
+TargetVendor=0x10a9
+TargetProductList="6064"
+# Use 1 for automatic choice, 2 for RNDIS, 4 for QMI
+PantechMode=1
+NoDriverLoading=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:155a new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:155a
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:155a 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:155a 2015-06-21 11:15:23.000000000 +0200
@@ -0,0 +1,4 @@
+# Vodafone (Huawei) R205
+TargetVendor=0x12d1
+TargetProduct=0x14cd
+HuaweiNewMode=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:157d new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:157d
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:157d 2014-05-29 14:57:00.000000000 +0200
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:157d 2015-06-21 17:18:29.000000000 +0200
@@ -1,4 +1,4 @@
-# Huawei E3331
+# Huawei E3331, E3372
TargetVendor=0x12d1
-TargetProduct=0x14db
+TargetProductList="14db,14dc"
HuaweiNewMode=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1582 new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1582
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1582 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1582 2015-06-21 10:20:52.000000000 +0200
@@ -0,0 +1,4 @@
+# Vodafone / Huawei R215 Router
+TargetVendor=0x12d1
+TargetProduct=0x1588
+HuaweiNewMode=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:15cd new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:15cd
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:15cd 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:15cd 2015-06-21 17:38:16.000000000 +0200
@@ -0,0 +1,4 @@
+# Huawei E3372
+TargetVendor=0x12d1
+TargetProduct=0x1506
+HuaweiNewMode=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:15cf new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:15cf
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:15cf 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:15cf 2015-06-21 17:45:59.000000000 +0200
@@ -0,0 +1,4 @@
+# Huawei E3372s-153
+TargetVendor=0x12d1
+TargetProduct=0x1506
+HuaweiNewMode=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1f02 new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1f02
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1f02 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1f02 2015-06-21 13:35:18.000000000 +0200
@@ -0,0 +1,5 @@
+# Huawei E5377
+TargetVendor=0x12d1
+TargetProduct=0x14dc
+HuaweiNewMode=1
+NoDriverLoading=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1f07 new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1f07
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1f07 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1f07 2015-06-21 17:17:01.000000000 +0200
@@ -0,0 +1,5 @@
+# Huawei/Vodafone R226
+TargetVendor=0x12d1
+TargetProduct=0x15bf
+HuaweiNewMode=1
+NoDriverLoading=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1f09 new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1f09
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/12d1:1f09 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/12d1:1f09 2015-06-21 18:25:48.000000000 +0200
@@ -0,0 +1,5 @@
+# Huawei/Vodafone R216
+TargetVendor=0x12d1
+TargetProduct=0x1c50
+HuaweiNewMode=1
+NoDriverLoading=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/1782:0003 new/usb-modeswitch-data-20150627/usb_modeswitch.d/1782:0003
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/1782:0003 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/1782:0003 2015-06-21 17:46:43.000000000 +0200
@@ -0,0 +1,2 @@
+# Spreadtrum SC7702
+Configuration=2
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/19d2:#linux new/usb-modeswitch-data-20150627/usb_modeswitch.d/19d2:#linux
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/19d2:#linux 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/19d2:#linux 2015-06-27 21:00:21.000000000 +0200
@@ -0,0 +1,7 @@
+# ZTE generic for Linux (fall-back for unknown products)
+
+# Uncomment the following lines to activate
+
+#TargetVendor= 0x19d2
+#StandardEject=1
+#MessageContent="55534243123456702000000080000c85010101180101010101000000000000"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/19d2:0388 new/usb-modeswitch-data-20150627/usb_modeswitch.d/19d2:0388
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/19d2:0388 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/19d2:0388 2015-06-27 00:17:26.000000000 +0200
@@ -0,0 +1,4 @@
+# ZTE MF90 Mobile Hotspot
+TargetVendor=0x19d2
+TargetProduct=0x0447
+MessageContent="55534243123456782400000080000685000000240000000000000000000000"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/2001:a401 new/usb-modeswitch-data-20150627/usb_modeswitch.d/2001:a401
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/2001:a401 1970-01-01 01:00:00.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/2001:a401 2015-06-21 18:33:22.000000000 +0200
@@ -0,0 +1,7 @@
+# D-Link DWM-221 B1
+TargetVendor=0x2001
+TargetProduct=0x7e19
+#StandardEject=1
+MessageContent="5553424312345678000000000000061e000000000000000000000000000000"
+MessageContent2="5553424312345679000000000001061b000000010000000000000000000000"
+MessageContent3="5553424312345670000000000000061b000000020000000000000000000000"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/2001:a403 new/usb-modeswitch-data-20150627/usb_modeswitch.d/2001:a403
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/2001:a403 2015-01-14 23:45:54.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/2001:a403 2015-06-21 11:17:05.000000000 +0200
@@ -1,4 +1,4 @@
-# D-Link DWM-156 A8
+# D-Link DWM-156 A8, DWP-157 B1
TargetVendor=0x2001
-TargetProduct=0x7d0b
+TargetProductList="7d0b,7d0c"
StandardEject=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/usb-modeswitch-data-20150115/usb_modeswitch.d/2020:0002 new/usb-modeswitch-data-20150627/usb_modeswitch.d/2020:0002
--- old/usb-modeswitch-data-20150115/usb_modeswitch.d/2020:0002 2015-01-14 22:18:11.000000000 +0100
+++ new/usb-modeswitch-data-20150627/usb_modeswitch.d/2020:0002 2015-06-21 17:47:51.000000000 +0200
@@ -1,4 +1,4 @@
-# Mediatek MT6229, Micromax MMX 377G
+# Mediatek MT6229, Micromax MMX 377G, Olicard 300
TargetVendor=0x2020
-TargetProductList="2000,4010"
+TargetProductList="2000,4000,4010"
MessageContent="555342430820298900000000000003f0010100000000000000000000000000"