From e2d89fa49625b24f7139ea04db5fffdd3d552ead Mon Sep 17 00:00:00 2001 From: Shibby Date: Thu, 18 Feb 2016 14:34:36 +0100 Subject: [PATCH] usb_modeswitch ver. 2.3.0 with data package 2016-01-12 --- release/src/router/usbmodeswitch/ChangeLog | 14 + release/src/router/usbmodeswitch/Makefile | 2 +- .../usbmodeswitch/data/40-usb_modeswitch.rules | 77 ++- release/src/router/usbmodeswitch/data/ChangeLog | 22 + release/src/router/usbmodeswitch/data/Makefile | 4 +- release/src/router/usbmodeswitch/data/README | 11 +- release/src/router/usbmodeswitch/data/REFERENCE | 17 +- .../src/router/usbmodeswitch/data/gen-rules.tcl | 11 +- .../usbmodeswitch/data/usb_modeswitch.d/0408:1000 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0408:ea43 | 4 +- .../data/usb_modeswitch.d/05c6:1000:sVe=GT | 3 +- .../data/usb_modeswitch.d/05c6:1000:sVe=Option | 3 +- .../data/usb_modeswitch.d/05c6:1000:uMa=Option | 3 +- .../usbmodeswitch/data/usb_modeswitch.d/07d1:f000 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/0922:1007 | 5 + .../usbmodeswitch/data/usb_modeswitch.d/0af0:6711 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6731 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6751 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6771 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6791 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6811 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6911 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6951 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:6971 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7011 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7031 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7051 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7071 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7111 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7211 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7251 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7271 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7301 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7311 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7361 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7381 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7401 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7501 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7601 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7701 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7706 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7801 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7901 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7a01 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:7a05 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8006 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8200 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8201 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8300 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8302 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8304 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8400 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8600 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8700 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8800 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:8900 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:9000 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:9200 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:c031 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:c100 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d001 | 3 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d013 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d031 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d033 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d035 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d055 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d057 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d058 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d155 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d157 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d255 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d257 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0af0:d357 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/0e8d:7109 | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/10a9:606f | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/1199:9011 | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:9013 | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:9017 | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:901b | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:901c | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:901f | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:9041 | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:9051 | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:9053 | 3 + .../usbmodeswitch/data/usb_modeswitch.d/1199:9063 | 3 + .../usbmodeswitch/data/usb_modeswitch.d/12d1:101e | 2 +- .../usbmodeswitch/data/usb_modeswitch.d/12d1:14fe | 4 +- .../usbmodeswitch/data/usb_modeswitch.d/12d1:1573 | 2 + .../usbmodeswitch/data/usb_modeswitch.d/12d1:1597 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/12d1:15ce | 4 + .../usbmodeswitch/data/usb_modeswitch.d/12d1:15d0 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/12d1:15d2 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/12d1:1c24 | 4 +- .../usbmodeswitch/data/usb_modeswitch.d/1410:9020 | 2 + .../usbmodeswitch/data/usb_modeswitch.d/19d2:0198 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/19d2:1580 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/19d2:1595 | 5 + .../usbmodeswitch/data/usb_modeswitch.d/19d2:2000 | 4 +- .../usbmodeswitch/data/usb_modeswitch.d/1c9e:9bfe | 4 + .../usbmodeswitch/data/usb_modeswitch.d/1ee8:0007 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/1ee8:0048 | 4 + .../usbmodeswitch/data/usb_modeswitch.d/1ee8:0063 | 4 +- .../usbmodeswitch/data/usb_modeswitch.d/2001:a401 | 6 +- .../usbmodeswitch/data/usb_modeswitch.d/20a6:f00a | 4 + release/src/router/usbmodeswitch/dispatcher.c | 2 +- release/src/router/usbmodeswitch/usb_modeswitch.1 | 23 +- release/src/router/usbmodeswitch/usb_modeswitch.c | 519 ++++++++++----------- release/src/router/usbmodeswitch/usb_modeswitch.h | 15 +- release/src/router/usbmodeswitch/usb_modeswitch.sh | 2 +- .../src/router/usbmodeswitch/usb_modeswitch.tcl | 58 ++- 110 files changed, 605 insertions(+), 420 deletions(-) create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/07d1:f000 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/0922:1007 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9011 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9013 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9017 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901b create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901c create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901f create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9041 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9051 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9053 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9063 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1573 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1597 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15ce create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d0 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d2 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1410:9020 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:0198 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1580 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1595 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1c9e:9bfe create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0007 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0048 create mode 100644 release/src/router/usbmodeswitch/data/usb_modeswitch.d/20a6:f00a diff --git a/release/src/router/usbmodeswitch/ChangeLog b/release/src/router/usbmodeswitch/ChangeLog index 4ff32392e9..11fcd76e04 100644 --- a/release/src/router/usbmodeswitch/ChangeLog +++ b/release/src/router/usbmodeswitch/ChangeLog @@ -2,6 +2,20 @@ History of USB_ModeSwitch ========================= +Version 2.3.0, 2016/01/12 + ATTENTION: -I flag is now history and being ignored - determining SCSI + attributes is really an 'outside task'; -n flag (NeedResponse) is being + ignored, CSW response will now always be read; introduction of parameter + "OptionMode", wrapping the standard bulk message for all newer Huawei + devices; fixed missing variable initialization in dispatcher script which + could lead to crash (thanks, Dmitry Kunilov!); fixed bug which prevented + early logging; fixed success report for Cisco AM10; some source code + formatting and clean-up +Version 2.2.6, 2015/11/01 + Renamed function abort(), avoiding possible conflicts in static builds + with libjim (thanks, Gustavo Zacharias); removed storage class check of + interface 0 from dispatcher, enabling new multi-config devices in data + package 20151101 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 diff --git a/release/src/router/usbmodeswitch/Makefile b/release/src/router/usbmodeswitch/Makefile index ef24749353..3c0159d4a4 100644 --- a/release/src/router/usbmodeswitch/Makefile +++ b/release/src/router/usbmodeswitch/Makefile @@ -1,5 +1,5 @@ PROG = usb_modeswitch -VERS = 2.2.5 +VERS = 2.3.0 CC ?= gcc CFLAGS += -Wall LIBS = -l usb-1.0 diff --git a/release/src/router/usbmodeswitch/data/40-usb_modeswitch.rules b/release/src/router/usbmodeswitch/data/40-usb_modeswitch.rules index 2595515225..daa3b9ac87 100644 --- a/release/src/router/usbmodeswitch/data/40-usb_modeswitch.rules +++ b/release/src/router/usbmodeswitch/data/40-usb_modeswitch.rules @@ -1,4 +1,4 @@ -# Part of usb-modeswitch-data, version 20150627 +# Part of usb-modeswitch-data, version 20160112 # # Works with usb_modeswitch versions >= 2.2.2 (extension of PantechMode) # @@ -20,8 +20,8 @@ ATTR{bInterfaceClass}=="ff", ATTR{bInterfaceNumber}=="00", ATTRS{bNumConfigurati ACTION!="add", GOTO="modeswitch_rules_end" -# 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'" +# Generic entry for most 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'" @@ -35,7 +35,7 @@ ATTR{idVendor}=="0408", ATTR{idProduct}=="ea17", RUN+="usb_modeswitch '%b/%k'" # Quanta 1K3 LTE ATTR{idVendor}=="0408", ATTR{idProduct}=="ea25", RUN+="usb_modeswitch '%b/%k'" -# Quanta MobileGenie 4G lte, Quanta 1K6 +# Quanta MobileGenie 4G LTE, Quanta 1K6 ATTR{idVendor}=="0408", ATTR{idProduct}=="ea43", RUN+="usb_modeswitch '%b/%k'" # Yota Router (Quanta 1QDLZZZ0ST2) @@ -116,7 +116,7 @@ ATTR{idVendor}=="057c", ATTR{idProduct}=="84ff", RUN+="usb_modeswitch '%b/%k'" # 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, 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, Option GlobeTrotter GX0201, 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 @@ -149,12 +149,18 @@ ATTR{idVendor}=="07d1", ATTR{idProduct}=="a800", RUN+="usb_modeswitch '%b/%k'" # D-Link DWM-156 HSUPA 3.75G USB Modem ATTR{idVendor}=="07d1", ATTR{idProduct}=="a804", RUN+="usb_modeswitch '%b/%k'" +# D-Link DWM-151 A1 +ATTR{idVendor}=="07d1", ATTR{idProduct}=="f000", RUN+="usb_modeswitch '%b/%k'" + # 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'" +# Dymo LabelManager Wireless PnP +ATTR{idVendor}=="0922", ATTR{idProduct}=="1007", RUN+="usb_modeswitch '%b/%k'" + # Toshiba G450 ATTR{idVendor}=="0930", ATTR{idProduct}=="0d46", RUN+="usb_modeswitch '%b/%k'" @@ -464,9 +470,42 @@ ATTR{idVendor}=="10a9", ATTR{idProduct}=="6080", RUN+="usb_modeswitch '%b/%k'" # Sierra devices (specific driver) ATTR{idVendor}=="1199", ATTR{idProduct}=="0fff", RUN+="usb_modeswitch '%b/%k'" +# Sierra MC8305 +ATTR{idVendor}=="1199", ATTR{idProduct}=="9011", RUN+="usb_modeswitch '%b/%k'" + +# Sierra MC8355 +ATTR{idVendor}=="1199", ATTR{idProduct}=="9013", RUN+="usb_modeswitch '%b/%k'" + +# Sierra MC8355 Variant +ATTR{idVendor}=="1199", ATTR{idProduct}=="9017", RUN+="usb_modeswitch '%b/%k'" + +# Sierra MC7770 +ATTR{idVendor}=="1199", ATTR{idProduct}=="901b", RUN+="usb_modeswitch '%b/%k'" + +# Sierra EM7700 +ATTR{idVendor}=="1199", ATTR{idProduct}=="901c", RUN+="usb_modeswitch '%b/%k'" + +# Sierra EM7355 +ATTR{idVendor}=="1199", ATTR{idProduct}=="901f", RUN+="usb_modeswitch '%b/%k'" + +# Sierra EM7305 +ATTR{idVendor}=="1199", ATTR{idProduct}=="9041", RUN+="usb_modeswitch '%b/%k'" + +# Sierra AC340U +ATTR{idVendor}=="1199", ATTR{idProduct}=="9051", RUN+="usb_modeswitch '%b/%k'" + +# Sierra AC770S +ATTR{idVendor}=="1199", ATTR{idProduct}=="9053", RUN+="usb_modeswitch '%b/%k'" + +# Sierra EM7305 +ATTR{idVendor}=="1199", ATTR{idProduct}=="9063", RUN+="usb_modeswitch '%b/%k'" + # Digicom 8E4455 (and all Pirelli devices - EXPERIMENTAL) ATTR{idVendor}=="1266", ATTR{idProduct}=="1000", RUN+="usb_modeswitch '%b/%k'" +# Huawei ME909u-521 +ATTR{idVendor}=="12d1", ATTR{idProduct}=="1573", RUN+="usb_modeswitch '%b/%k'" + # Cisco AM10 "Valet Connector" ATTR{idVendor}=="1307", ATTR{idProduct}=="1169", RUN+="usb_modeswitch '%b/%k'" @@ -497,6 +536,9 @@ ATTR{idVendor}=="1410", ATTR{idProduct}=="5059", RUN+="usb_modeswitch '%b/%k'" # Novatel Generic MiFi 2372 / Vodafone MiFi 2372 ATTR{idVendor}=="1410", ATTR{idProduct}=="7001", RUN+="usb_modeswitch '%b/%k'" +# Novatel U620L +ATTR{idVendor}=="1410", ATTR{idProduct}=="9020", RUN+="usb_modeswitch '%b/%k'" + # Sequans SQN1210/SQN1220 (generic chipsets) ATTR{idVendor}=="148e", ATTR{idProduct}=="a000", RUN+="usb_modeswitch '%b/%k'" @@ -587,6 +629,9 @@ ATTR{idVendor}=="19d2", ATTR{idProduct}=="0166", RUN+="usb_modeswitch '%b/%k'" # ZTE A371B ATTR{idVendor}=="19d2", ATTR{idProduct}=="0169", RUN+="usb_modeswitch '%b/%k'" +# ZTE MF820s, MF832s +ATTR{idVendor}=="19d2", ATTR{idProduct}=="0198", RUN+="usb_modeswitch '%b/%k'" + # Onda MT8205 LTE ATTR{idVendor}=="19d2", ATTR{idProduct}=="0266", RUN+="usb_modeswitch '%b/%k'" @@ -698,10 +743,16 @@ ATTR{idVendor}=="19d2", ATTR{idProduct}=="1536", RUN+="usb_modeswitch '%b/%k'" # ZTE MF190J ATTR{idVendor}=="19d2", ATTR{idProduct}=="1542", RUN+="usb_modeswitch '%b/%k'" +# ZTE MF195E +ATTR{idVendor}=="19d2", ATTR{idProduct}=="1580", RUN+="usb_modeswitch '%b/%k'" + # ZTE MF710M Variants ATTR{idVendor}=="19d2", ATTR{idProduct}=="1588", RUN+="usb_modeswitch '%b/%k'" -# ZTE devices +# ZTE MF710 (Vietnam) +ATTR{idVendor}=="19d2", ATTR{idProduct}=="1595", RUN+="usb_modeswitch '%b/%k'" + +# ZTE devices, some Onda devices ATTR{idVendor}=="19d2", ATTR{idProduct}=="2000", RUN+="usb_modeswitch '%b/%k'" # ZTE MF60 @@ -779,6 +830,9 @@ ATTR{idVendor}=="1c9e", ATTR{idProduct}=="9800", RUN+="usb_modeswitch '%b/%k'" # Telewell TW-3G HSPA+, FS01BU 3G, SmartBro WM66E ATTR{idVendor}=="1c9e", ATTR{idProduct}=="98ff", RUN+="usb_modeswitch '%b/%k'" +# XS Stick W100 (Omega) +ATTR{idVendor}=="1c9e", ATTR{idProduct}=="9bfe", RUN+="usb_modeswitch '%b/%k'" + # Prolink PCM100 ATTR{idVendor}=="1c9e", ATTR{idProduct}=="9d00", RUN+="usb_modeswitch '%b/%k'" @@ -824,6 +878,9 @@ ATTR{idVendor}=="1edf", ATTR{idProduct}=="6003", RUN+="usb_modeswitch '%b/%k'" # Onda MV815U ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0003", RUN+="usb_modeswitch '%b/%k'" +# Onda POM1051 +ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0007", RUN+="usb_modeswitch '%b/%k'" + # Onda MW833UP ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0009", RUN+="usb_modeswitch '%b/%k'" @@ -839,6 +896,9 @@ ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0040", RUN+="usb_modeswitch '%b/%k'" # Onda MDC655 ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0045", RUN+="usb_modeswitch '%b/%k'" +# Onda MT655 +ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0048", RUN+="usb_modeswitch '%b/%k'" + # Onda MDC655 ATTR{idVendor}=="1ee8", ATTR{idProduct}=="004a", RUN+="usb_modeswitch '%b/%k'" @@ -851,7 +911,7 @@ ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0054", RUN+="usb_modeswitch '%b/%k'" # Onda MSA 14.4 (TIM Brasil) ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0060", RUN+="usb_modeswitch '%b/%k'" -# Onda TM201 14.4 (TIM Italy) +# Onda TM201, CM201 ATTR{idVendor}=="1ee8", ATTR{idProduct}=="0063", RUN+="usb_modeswitch '%b/%k'" # Onda WM301 @@ -923,6 +983,9 @@ ATTR{idVendor}=="2077", ATTR{idProduct}=="1000", RUN+="usb_modeswitch '%b/%k'" # Telenet 3G dongle (T&W WU160) and others ATTR{idVendor}=="2077", ATTR{idProduct}=="f000", RUN+="usb_modeswitch '%b/%k'" +# BM WM78 +ATTR{idVendor}=="20a6", ATTR{idProduct}=="f00a", RUN+="usb_modeswitch '%b/%k'" + # Intex 3.5G ATTR{idVendor}=="20a6", ATTR{idProduct}=="f00e", RUN+="usb_modeswitch '%b/%k'" diff --git a/release/src/router/usbmodeswitch/data/ChangeLog b/release/src/router/usbmodeswitch/data/ChangeLog index 0ab84a9119..31f7e85dd1 100644 --- a/release/src/router/usbmodeswitch/data/ChangeLog +++ b/release/src/router/usbmodeswitch/data/ChangeLog @@ -1,3 +1,25 @@ +20160112: + ATTENTION: requires usb-modeswitch version >= 2.3.0 due to new para- + meter OptionMode (further reducing config file space demand); + Added devices: D-Link DWM-151 A1 [07d1:f000], Dymo LabelManager Wireless + PnP [0922:1007], Sierra MC8305 [1199:9011], Sierra MC8355 [1199:9013], + Sierra MC8355 Variant [1199:9017], Sierra MC7770 [1199:901b], Sierra + EM7700 [1199:901c], Sierra EM7355 [1199:901f], Sierra EM7305 [1199:9041], + Sierra AC340U [1199:9051], Sierra AC770S [1199:9053], Sierra EM7305 + [1199:9063], ZTE MF710 (Vietnam) [19d2:1595], XS Stick W100 (Omega) + [1c9e:9bfe], Onda POM1051 [1ee8:0007], Onda MT655 [1ee8:0048], BM WM78 + [20a6:f00a]; Corrected: Quanta MU-Q101 [0408:1000], Huawei U7510 / U7517 + [12d1:101e], Novatel U620L [1410:9020], D-Link DWM-221 B1 [2001:a401]; + Removed: [1410:9022] which was just one of the modes of [1410:9020]; + some new target IDs added to existing device configs; all Option configs + updated with new parameter +20151101: + Added devices: Huawei ME909u-521 [12d1:1573], Huawei E327s-150 (Variant) + [12d1:1597], Huawei E3531s-2, E3131 (Variant) [12d1:15ce], Huawei E3131 + (Variant) [12d1:15d0], Huawei E3531 (Variant) [12d1:15d2], Novatel U620L + [1410:9020], Novatel U620L [1410:9022], ZTE MF820s, MF832s [19d2:0198], + ZTE MF195E [19d2:1580]; some new target IDs added to existing device + configs; small correction of Makefile to fix Debian bug #803603 20150627: ATTENTION: recommended use with usb-modeswitch program package version >= 2.2.2 due to extended parameter PantechMode (affects 2 devices, see diff --git a/release/src/router/usbmodeswitch/data/Makefile b/release/src/router/usbmodeswitch/data/Makefile index 53e0b906df..9c7bc5413b 100644 --- a/release/src/router/usbmodeswitch/data/Makefile +++ b/release/src/router/usbmodeswitch/data/Makefile @@ -1,5 +1,5 @@ PROG = usb-modeswitch-data -VERS = 20150627 +VERS = 20160112 RM = /bin/rm -f PREFIX = $(DESTDIR)/usr ETCDIR = $(DESTDIR)/etc @@ -31,7 +31,7 @@ db-install: files-install db-install-packed: @# Create a compressed tar without gzip timestamp, so tar.gz @# differs only if content is different - cd ./usb_modeswitch.d; tar -cf ../configPack.tar * + cd ./usb_modeswitch.d; tar --mode=go=rX,u+rw,a-s -cf ../configPack.tar * gzip -f9n ./configPack.tar install --mode=644 -t $(PREFIX)/share/usb_modeswitch ./configPack.tar.gz rm -f ./configPack.tar.gz diff --git a/release/src/router/usbmodeswitch/data/README b/release/src/router/usbmodeswitch/data/README index 35baca6ad1..a532e28862 100644 --- a/release/src/router/usbmodeswitch/data/README +++ b/release/src/router/usbmodeswitch/data/README @@ -1,11 +1,16 @@ README for USB_ModeSwitch Data +Almost all new and corrected device configurations since around 2012 +were collected and compiled by Lars Melin. Thank you! -For up-to-date and detailed information (plus a friendly forum) visit -http://www.draisberghof.de/usb_modeswitch +Without a well-maintained base of configuration info, usb_modeswitch +would just be a useless blob of code. So: PLEASE REPORT NEW DEVICES ! +For up-to-date and detailed information (plus a friendly forum) visit +http://www.draisberghof.de/usb_modeswitch + This is a data package to complement the full release package of @@ -144,4 +149,4 @@ Or find it as the file COPYING in this folder. -Last revised: 2015-06-27, Josua Dietze +Last revised: 2016-01-12, Josua Dietze diff --git a/release/src/router/usbmodeswitch/data/REFERENCE b/release/src/router/usbmodeswitch/data/REFERENCE index 0446ab3fdb..2870ea96ed 100644 --- a/release/src/router/usbmodeswitch/data/REFERENCE +++ b/release/src/router/usbmodeswitch/data/REFERENCE @@ -1,7 +1,7 @@ Configuration File Reference for USB_ModeSwitch ----------------------------------------------- -Last modified: 2015-06-27 +Last modified: 2016-01-12 @@ -113,6 +113,11 @@ but different target layouts may be reached with variants of that message; use MessageContent for these +* OptionMode <0/1> -U + +The standard for all devices by Option. Sends a specific bulk message + + * SonyMode <0/1> -O Some Sony-Ericsson devices can be switched by a special control @@ -179,9 +184,8 @@ might have the same effect as a manual replug) * InquireDevice <0|1> -I (enables inquiry) -Prints out SCSI device attributes in addition to USB device attributes. -These may be used later to tell apart ambiguous device IDs. Only needed -for creating new configurations +Formerly printed out SCSI device attributes. Obsolete and ignored since +version 2.3.0. * CheckSuccess -s @@ -214,3 +218,8 @@ Waiting time before taking any action. Helps with some sensitive setups. 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. +The usb_modeswitch wrapper will test if a device has a configuration +according to the MBIM standard. If so, it will search for the matching +kernel driver. It it's available, the device will be configured for +MBIM usage which is preferable to other modes and configurations + diff --git a/release/src/router/usbmodeswitch/data/gen-rules.tcl b/release/src/router/usbmodeswitch/data/gen-rules.tcl index bc87d2d6f6..44781d31ee 100755 --- a/release/src/router/usbmodeswitch/data/gen-rules.tcl +++ b/release/src/router/usbmodeswitch/data/gen-rules.tcl @@ -4,12 +4,17 @@ # # should be in the form YYYYMMDD # +# Config files are expected to be in subfolder "usb_modeswitch.d" +# # A config file is expected to have one comment line containing # a model name or other concise device specifications # Default version string -set version "20150627" +set version "20160112" + +# Devices excluded from Huawei catch-all rule +set x_huaweiList {12d1:1573} if {[lindex $argv 0] == "--set-version" && [regexp {\d\d\d\d\d\d\d\d} [lindex $argv 1]]} { set version [lindex $argv 1] @@ -55,7 +60,7 @@ ATTR{bInterfaceClass}=="ff", ATTR{bInterfaceNumber}=="00", ATTRS{bNumConfigurati ACTION!="add", GOTO="modeswitch_rules_end" -# Generic entry for all Huawei devices, excluding Android phones +# Generic entry for most Huawei devices, excluding Android phones ATTRS{idVendor}=="12d1", ATTRS{manufacturer}!="Android", ATTR{bInterfaceNumber}=="00", ATTR{bInterfaceClass}=="08", RUN+="usb_modeswitch '%b/%k'"} @@ -64,7 +69,7 @@ set dvid "" foreach idfile $filelist { if {![regexp -nocase {./([0-9A-F]{4}:[0-9A-F]{4})} $idfile d id]} {continue} - if [regexp -nocase {^12d1:} $id] {continue} + if {[regexp -nocase {^12d1:} $id] && [lsearch $x_huaweiList $id] == -1} {continue} if [info exists entry($id)] { append entry($id) ", " } diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:1000 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:1000 index 340fbade54..089c43786b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:1000 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:1000 @@ -1,4 +1,4 @@ # Quanta MU-Q101 TargetVendor=0x0408 TargetProduct=0xea02 -Message="5553424338474ffc0002000000000a2a000000003300000100000000000000" +MessageContent="55534243123456780002000000000a2a000000003300000100000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:ea43 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:ea43 index 32488cf454..5c580e8678 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:ea43 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0408:ea43 @@ -1,4 +1,4 @@ -# Quanta MobileGenie 4G lte, Quanta 1K6 +# Quanta MobileGenie 4G LTE, Quanta 1K6 TargetVendor=0x0408 -TargetProductList="ea47,ea49" +TargetProductList="ea47,ea49,ea4d" StandardEject=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=GT b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=GT index 2cc6a74758..330d07c62b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=GT +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=GT @@ -1,5 +1,4 @@ # Option GlobeTrotter GX0201 TargetVendor=0x0af0 TargetProduct=0x6701 -MessageContent="55534243123456780000000000000601000000000000000000000000000000" -NeedResponse=1 +OptionMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=Option b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=Option index 1b16a46c3a..c76cde8e7b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=Option +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:sVe=Option @@ -1,5 +1,4 @@ # Older Option devices TargetVendor= 0x0af0 TargetProductList="6901,6701,6600" -MessageContent="55534243123456780000000000000601000000000000000000000000000000" -NeedResponse=1 +OptionMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:uMa=Option b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:uMa=Option index be1c42f1e4..0f2ce474b9 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:uMa=Option +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/05c6:1000:uMa=Option @@ -1,5 +1,4 @@ # Quirky Option devices TargetVendor=0x0af0 TargetProduct=0x6901 -MessageContent="55534243123456780000000000000601000000000000000000000000000000" -NeedResponse=1 +OptionMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/07d1:f000 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/07d1:f000 new file mode 100644 index 0000000000..f79dba7845 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/07d1:f000 @@ -0,0 +1,4 @@ +# D-Link DWM-151 A1 +TargetVendor=0x07d1 +TargetProduct=0x7e07 +MessageContent="555342431234567800000000000006bd000000020000000000000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0922:1007 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0922:1007 new file mode 100644 index 0000000000..e8c0fd66d9 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0922:1007 @@ -0,0 +1,5 @@ +# Dymo LabelManager Wireless PnP +TargetVendor= 0x0922 +TargetProduct= 0x1008 +MessageContent="1b5a01" +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6711 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6711 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6711 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6711 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6731 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6731 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6731 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6731 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6751 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6751 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6751 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6751 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6771 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6771 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6771 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6771 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6791 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6791 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6791 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6791 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6811 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6811 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6811 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6811 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6911 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6911 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6911 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6911 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6951 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6951 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6951 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6951 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6971 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6971 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6971 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:6971 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7011 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7011 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7011 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7011 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7031 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7031 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7031 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7031 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7051 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7051 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7051 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7051 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7071 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7071 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7071 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7071 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7111 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7111 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7111 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7111 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7211 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7211 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7211 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7211 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7251 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7251 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7251 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7251 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7271 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7271 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7271 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7271 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7301 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7301 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7301 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7301 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7311 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7311 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7311 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7311 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7361 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7361 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7361 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7361 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7381 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7381 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7381 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7381 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7401 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7401 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7401 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7401 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7501 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7501 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7501 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7501 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7601 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7601 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7601 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7601 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7701 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7701 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7701 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7701 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7706 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7706 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7706 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7706 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7801 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7801 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7801 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7801 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7901 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7901 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7901 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7901 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a01 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a01 index c62712d2a3..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a01 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a01 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243123456780000000000000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a05 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a05 index 97fb19dd0c..e8dd2c35bf 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a05 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:7a05 @@ -1,4 +1,4 @@ # Option iCon 461 TargetClass=0xff -MessageContent="55534243123456780000000000000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8006 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8006 index 9e05ae3aff..407b15eb86 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8006 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8006 @@ -1,5 +1,5 @@ # Option Globetrotter (Variant) TargetVendor=0x0af0 TargetProduct=0x9100 -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8200 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8200 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8200 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8200 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8201 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8201 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8201 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8201 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8300 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8300 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8300 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8300 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8302 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8302 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8302 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8302 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8304 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8304 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8304 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8304 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8400 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8400 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8400 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8400 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8600 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8600 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8600 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8600 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8700 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8700 index 638837b9a3..32348ebd24 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8700 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8700 @@ -1,4 +1,4 @@ # Option GI0643 (aka XYFI) TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8800 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8800 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8800 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8800 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8900 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8900 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8900 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:8900 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9000 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9000 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9000 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9000 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9200 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9200 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9200 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:9200 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c031 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c031 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c031 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c031 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c100 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c100 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c100 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:c100 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d001 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d001 index de38126fb3..7675b3f529 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d001 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d001 @@ -1,6 +1,5 @@ # Option GlobeTrotter GI1515 TargetVendor=0x0af0 TargetProductList="d157,d255,d257" -Interface=0x01 -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d013 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d013 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d013 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d013 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d031 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d031 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d031 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d031 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d033 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d033 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d033 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d033 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d035 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d035 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d035 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d035 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d055 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d055 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d055 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d055 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d057 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d057 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d057 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d057 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d058 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d058 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d058 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d058 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d155 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d155 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d155 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d155 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d157 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d157 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d157 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d157 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d255 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d255 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d255 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d255 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d257 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d257 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d257 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d257 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d357 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d357 index b90e19335d..372efcb78b 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d357 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0af0:d357 @@ -1,4 +1,4 @@ # Option HSO device TargetClass=0xff -MessageContent="55534243785634120100000080000601000000000000000000000000000000" +OptionMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0e8d:7109 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0e8d:7109 index c3d3bc4d90..90361b1ffb 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0e8d:7109 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/0e8d:7109 @@ -1,5 +1,5 @@ # MediaTek Wimax USB Card TargetVendor=0x0e8d -TargetProduct=0x7118 +TargetProductList="7115,7118" StandardEject=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/10a9:606f b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/10a9:606f index 78385ffdcf..5ffb0a4e07 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/10a9:606f +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/10a9:606f @@ -1,6 +1,6 @@ # Pantech/Verizon UML295 TargetVendor=0x10a9 -TargetProductList="6064" +TargetProductList="6064,6074" # Use 1 for automatic choice, 2 for RNDIS, 4 for QMI PantechMode=1 NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9011 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9011 new file mode 100644 index 0000000000..af4718ed37 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9011 @@ -0,0 +1,3 @@ +# Sierra MC8305 +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9013 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9013 new file mode 100644 index 0000000000..b8d7de45ef --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9013 @@ -0,0 +1,3 @@ +# Sierra MC8355 +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9017 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9017 new file mode 100644 index 0000000000..d5f78ad691 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9017 @@ -0,0 +1,3 @@ +# Sierra MC8355 Variant +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901b b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901b new file mode 100644 index 0000000000..a7549d7446 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901b @@ -0,0 +1,3 @@ +# Sierra MC7770 +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901c b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901c new file mode 100644 index 0000000000..8726dc46c8 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901c @@ -0,0 +1,3 @@ +# Sierra EM7700 +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901f b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901f new file mode 100644 index 0000000000..83b8b3d474 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:901f @@ -0,0 +1,3 @@ +# Sierra EM7355 +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9041 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9041 new file mode 100644 index 0000000000..74534e36a3 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9041 @@ -0,0 +1,3 @@ +# Sierra EM7305 +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9051 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9051 new file mode 100644 index 0000000000..4e55ee872d --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9051 @@ -0,0 +1,3 @@ +# Sierra AC340U +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9053 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9053 new file mode 100644 index 0000000000..ec0ddb27b9 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9053 @@ -0,0 +1,3 @@ +# Sierra AC770S +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9063 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9063 new file mode 100644 index 0000000000..74534e36a3 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1199:9063 @@ -0,0 +1,3 @@ +# Sierra EM7305 +Configuration=1 +NoDriverLoading=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:101e b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:101e index 70379d7748..dae8e2e628 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:101e +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:101e @@ -1,3 +1,3 @@ # Huawei U7510 / U7517 TargetClass=0xff -Message="55534243123456780600000080000601000000000000000000000000000000" +MessageContent="55534243123456780600000080000601000000000000000000000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:14fe b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:14fe index bffcfe2d95..9c16d2a957 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:14fe +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:14fe @@ -1,4 +1,4 @@ -# T-Mobile NL (Huawei E352) +# Huawei E352 (T-Mobile NL), E173s (Variant) TargetVendor=0x12d1 -TargetProductList="1506,150f,151d" +TargetProductList="1506,150f,151d,1c1e" HuaweiNewMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1573 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1573 new file mode 100644 index 0000000000..0e6ae6808c --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1573 @@ -0,0 +1,2 @@ +# Huawei ME909u-521 +Configuration=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1597 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1597 new file mode 100644 index 0000000000..0a91c2d950 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1597 @@ -0,0 +1,4 @@ +# Huawei E327s-150 (Variant) +TargetVendor=0x12d1 +TargetProduct=0x1598 +HuaweiNewMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15ce b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15ce new file mode 100644 index 0000000000..3ec6ce313f --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15ce @@ -0,0 +1,4 @@ +# Huawei E3531s-2, E3131 (Variant) +TargetVendor=0x12d1 +TargetProductList="15b1,15b3" +HuaweiNewMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d0 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d0 new file mode 100644 index 0000000000..5d2ee646cf --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d0 @@ -0,0 +1,4 @@ +# Huawei E3131 (Variant) +TargetVendor=0x12d1 +TargetProduct=0x15d1 +HuaweiNewMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d2 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d2 new file mode 100644 index 0000000000..94bbbac2cf --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:15d2 @@ -0,0 +1,4 @@ +# Huawei E3531 (Variant) +TargetVendor=0x12d1 +TargetProduct=0x15d3 +HuaweiNewMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1c24 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1c24 index c8689cdcd4..3b9f1962ae 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1c24 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/12d1:1c24 @@ -1,4 +1,4 @@ -# Huawei E173 (Moviestar) +# Huawei E173 (Moviestar), E173s (Variant) TargetVendor=0x12d1 -TargetProduct=0x1c12 +TargetProductList="1c12,1c23" HuaweiNewMode=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1410:9020 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1410:9020 new file mode 100644 index 0000000000..ba50114f19 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1410:9020 @@ -0,0 +1,2 @@ +# Novatel U620L +Configuration=4 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:0198 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:0198 new file mode 100644 index 0000000000..c12e299e8e --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:0198 @@ -0,0 +1,4 @@ +# ZTE MF820s, MF832s +TargetVendor=0x19d2 +TargetProduct=0x0199 +StandardEject=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1580 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1580 new file mode 100644 index 0000000000..5b99ce84e9 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1580 @@ -0,0 +1,4 @@ +# ZTE MF195E +TargetVendor= 0x19d2 +TargetProduct=0x1582 +StandardEject=1 diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1595 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1595 new file mode 100644 index 0000000000..80dacefe8c --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:1595 @@ -0,0 +1,5 @@ +# ZTE MF710 (Vietnam) +TargetVendor= 0x19d2 +TargetProductList=0x1596 +StandardEject=1 +MessageContent="55534243123456702000000080000c85010101180101010101000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:2000 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:2000 index 455ec84ba0..067173e009 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:2000 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/19d2:2000 @@ -1,5 +1,5 @@ -# ZTE devices +# ZTE devices, some Onda devices TargetVendor= 0x19d2 -TargetProductList="0001,0002,0015,0016,0017,0019,0031,0033,0037,0042,0052,0055,0061,0063,0064,0066,0091,0108,0117,0128,0151,0157,0177,1402,2002,2003" +TargetProductList="0001,0002,0015,0016,0017,0019,0024,0031,0033,0037,0042,0052,0055,0061,0063,0064,0066,0091,0108,0117,0128,0151,0157,0177,1402,2002,2003" StandardEject=1 MessageContent="55534243123456702000000080000c85010101180101010101000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1c9e:9bfe b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1c9e:9bfe new file mode 100644 index 0000000000..25767f0c4d --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1c9e:9bfe @@ -0,0 +1,4 @@ +# XS Stick W100 (Omega) +TargetVendor=0x1c9e +TargetProduct=0x9b01 +MessageContent="55534243123456780000000000000606f50402527000000000000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0007 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0007 new file mode 100644 index 0000000000..9a9fbaa55d --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0007 @@ -0,0 +1,4 @@ +# Onda POM1051 +TargetVendor=0x1ee8 +TargetProduct=0x000b +MessageContent="555342431234567800000000000010ff000000000000000000000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0048 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0048 new file mode 100644 index 0000000000..a0618ab224 --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0048 @@ -0,0 +1,4 @@ +# Onda MT655 +TargetVendor=0x1ee8 +TargetProduct=0x0049 +MessageContent="555342431234567800000000000010ff000000000000000000000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0063 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0063 index 47a282c8b2..b46c775a52 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0063 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/1ee8:0063 @@ -1,4 +1,4 @@ -# Onda TM201 14.4 (TIM Italy) +# Onda TM201, CM201 TargetVendor=0x1ee8 -TargetProduct=0x0064 +TargetProductList="0064,0065" MessageContent="555342431234567800000000000008ff000000000000030000000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/2001:a401 b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/2001:a401 index dab3534eea..58d0dbccd3 100644 --- a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/2001:a401 +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/2001:a401 @@ -1,7 +1,5 @@ # D-Link DWM-221 B1 TargetVendor=0x2001 TargetProduct=0x7e19 -#StandardEject=1 -MessageContent="5553424312345678000000000000061e000000000000000000000000000000" -MessageContent2="5553424312345679000000000001061b000000010000000000000000000000" -MessageContent3="5553424312345670000000000000061b000000020000000000000000000000" +MessageContent="5553424312345678000000000001061e000000000000000000000000000000" +MessageContent2="5553424312345679000000000001061b000000020000000000000000000000" diff --git a/release/src/router/usbmodeswitch/data/usb_modeswitch.d/20a6:f00a b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/20a6:f00a new file mode 100644 index 0000000000..9e20b7e13b --- /dev/null +++ b/release/src/router/usbmodeswitch/data/usb_modeswitch.d/20a6:f00a @@ -0,0 +1,4 @@ +# BM WM78 +TargetVendor=0x20a6 +TargetProduct=0x1000 +StandardEject=1 diff --git a/release/src/router/usbmodeswitch/dispatcher.c b/release/src/router/usbmodeswitch/dispatcher.c index 49ba85c3c0..c38ae3128b 100644 --- a/release/src/router/usbmodeswitch/dispatcher.c +++ b/release/src/router/usbmodeswitch/dispatcher.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 Josua Dietze, usb_modeswitch version 2.2.2 + * Copyright (c) 2011-2016 Josua Dietze, usb_modeswitch version 2.3.0 * Contains code under * Copyright (c) 2010 Wojciech A. Koszek * All rights reserved. diff --git a/release/src/router/usbmodeswitch/usb_modeswitch.1 b/release/src/router/usbmodeswitch/usb_modeswitch.1 index 5bf0685054..fecac7c15d 100644 --- a/release/src/router/usbmodeswitch/usb_modeswitch.1 +++ b/release/src/router/usbmodeswitch/usb_modeswitch.1 @@ -77,19 +77,14 @@ strongly advised to comply with specifications and to avoid likely errors After issuing all bulk messages, wait for NUM milliseconds before releasing the interface. Required for some modems on older systems (especially after an EJECT message) .IP "\fB-n\fP \fB\-\-need-response\fP " 10 -Read the response (command status wrapper) to a mass storage command -transfer. -Some devices have trouble switching if the response is not read; most -are disappearing right away. When sending multiple mass storage commands -with \fB\-2\fR and \fB\-3\fR, this may need to be set to avoid transfer errors +Obsolete. CSW is always attempted to being read after mass storage transfers. No downside .IP "\fB-r\fP \fB\-\-response-endpoint NUM\fP " 10 -Try to read the response to a storage command from there -if option \-n is active. Only for testing purposes; usually -endpoints are determined from the device attributes +Try to read the response to a storage command from there. Only for testing purposes; +usually endpoints are determined from the device attributes .IP "\fB-K\fP \fB\-\-std-eject\fP " 10 Apply the standard SCSI sequence of "Allow Medium Removal" and "Eject". Implies \fB-n\fP. One 'Message' can be added with \fB-M\fP -that will be transmitted after the eject sequence +that will be transmitted after the eject sequence. Used by many modems .IP "\fB-d\fP \fB\-\-detach-only\fP " 10 Just detach the current driver. This is sufficient for some early devices to switch successfully. Otherwise this feature can @@ -118,6 +113,8 @@ 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-S\fP \fB\-\-option-mode\fP " 10 +Send a special control message used by all Option devices .IP "\fB-O\fP \fB\-\-sony-mode\fP " 10 Apply a special sequence used by Sony Ericsson devices. Implies option \--check-success .IP "\fB-L\fP \fB\-\-cisco-mode\fP " 10 @@ -151,10 +148,8 @@ integration with a wrapper script After switching, keep checking for the result up to max. NUM seconds. If target IDs or target class were provided, their appearance indicates certain success. Otherwise the disconnection of the original device is rated as likely proof -.IP "\fB-I\fP \fB\-\-no-inquire\fP " 10 -do not obtain SCSI attributes from device (default is on). For proper identification -of differing devices the attributes of the storage part provide valuable information. -This is not needed for devices that are known and supported +.IP "\fB-I\fP \fB\-\-inquire\fP " 10 +Obsolete. Formerly obtained SCSI attributes, now ignored .IP "\fB-i\fP \fB\-\-interface NUM\fP " 10 Select initial USB interface (default: 0). Only for testing purposes .IP "\fB-u\fP \fB\-\-configuration NUM\fP " 10 @@ -174,4 +169,4 @@ later version published by the Free Software Foundation. The complete text of the current GNU General Public License can be found in http://www.gnu.org/licenses/gpl.txt -.\" last edited 2014-05-29 for version 2.2.0 +.\" last edited 2016-01-11 for version 2.3.0 diff --git a/release/src/router/usbmodeswitch/usb_modeswitch.c b/release/src/router/usbmodeswitch/usb_modeswitch.c index 70883216e9..d38fb06840 100755 --- a/release/src/router/usbmodeswitch/usb_modeswitch.c +++ b/release/src/router/usbmodeswitch/usb_modeswitch.c @@ -1,8 +1,8 @@ /* Mode switching tool for controlling mode of 'multi-state' USB devices - Version 2.2.5, 2015/07/16 + Version 2.3.0, 2016/01/12 - Copyright (C) 2007 - 2015 Josua Dietze (mail to "digidietze" at the domain + Copyright (C) 2007 - 2016 Josua Dietze (mail to "digidietze" at the domain of the home page; or write a personal message through the forum to "Josh". NO SUPPORT VIA E-MAIL - please use the forum for that) @@ -18,7 +18,7 @@ Created with initial help from: "usbsnoop2libusb.pl" by Timo Lindfors (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) - Config file parsing stuff borrowed from: + Config file parsing code borrowed from: Guillaume Dargaud (http://www.gdargaud.net/Hack/SourceCode.html) Hexstr2bin function borrowed from: @@ -45,7 +45,7 @@ /* Recommended tab size: 4 */ -#define VERSION "2.2.5" +#define VERSION "2.3.0" #include #include @@ -59,17 +59,17 @@ #include "usb_modeswitch.h" -/* libusb 1.0 wrappers, lazy leftover */ +// Little helpers -int usb_bulk_io(struct libusb_device_handle *handle, int ep, char *bytes, - int size, int timeout) +int usb_bulk_io(struct libusb_device_handle *handle, int ep, unsigned char *bytes, + int size, int timeout) { int actual_length; int r; // usbi_dbg("endpoint %x size %d timeout %d", ep, size, timeout); - r = libusb_bulk_transfer(handle, ep & 0xff, (unsigned char *)bytes, size, + r = libusb_bulk_transfer(handle, ep & 0xff, bytes, size, &actual_length, timeout); - + /* if we timed out but did transfer some data, report as successful short * read. FIXME: is this how libusb-0.1 works? */ if (r == 0 || (r == LIBUSB_ERROR_TIMEOUT && actual_length > 0)) @@ -78,15 +78,16 @@ int usb_bulk_io(struct libusb_device_handle *handle, int ep, char *bytes, return r; } -static int usb_interrupt_io(libusb_device_handle *handle, int ep, char *bytes, - int size, int timeout) + +static int usb_interrupt_io(libusb_device_handle *handle, int ep, unsigned char *bytes, + int size, int timeout) { int actual_length; int r; // usbi_dbg("endpoint %x size %d timeout %d", ep, size, timeout); - r = libusb_interrupt_transfer(handle, ep & 0xff, (unsigned char *)bytes, size, + r = libusb_interrupt_transfer(handle, ep & 0xff, bytes, size, &actual_length, timeout); - + /* if we timed out but did transfer some data, report as successful short * read. FIXME: is this how libusb-0.1 works? */ if (r == 0 || (r == LIBUSB_ERROR_TIMEOUT && actual_length > 0)) @@ -136,21 +137,21 @@ unsigned int ModeMap = 0; #define BLACKBERRY_MODE 0x00000800 #define PANTECH_MODE 0x00001000 #define HUAWEINEW_MODE 0x00002000 +#define OPTION_MODE 0x00004000 + 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 NoDriverLoading=0, sysmode=0, mbim=0; char StandardEject=0; -char imanufact[DESCR_MAX], iproduct[DESCR_MAX], iserial[DESCR_MAX]; - char MessageContent[LINE_DIM]; char MessageContent2[LINE_DIM]; char MessageContent3[LINE_DIM]; char TargetProductList[LINE_DIM]; char DefaultProductList[5]; -char ByteString[LINE_DIM/2]; -char buffer[BUF_SIZE]; +unsigned char ByteString[LINE_DIM/2]; +unsigned char buffer[BUF_SIZE]; FILE *output; @@ -177,6 +178,7 @@ static struct option long_options[] = { {"device-num", required_argument, 0, 'g'}, {"detach-only", no_argument, 0, 'd'}, {"huawei-mode", no_argument, 0, 'H'}, + {"huawei-new-mode", no_argument, 0, 'J'}, {"sierra-mode", no_argument, 0, 'S'}, {"sony-mode", no_argument, 0, 'O'}, {"qisda-mode", no_argument, 0, 'B'}, @@ -187,6 +189,7 @@ static struct option long_options[] = { {"mobileaction-mode", no_argument, 0, 'A'}, {"cisco-mode", no_argument, 0, 'L'}, {"blackberry-mode", no_argument, 0, 'Z'}, + {"option-mode", no_argument, 0, 'U'}, {"pantech-mode", required_argument, 0, 'F'}, {"std-eject", no_argument, 0, 'K'}, {"need-response", no_argument, 0, 'n'}, @@ -227,6 +230,7 @@ void readConfigFile(const char *configFilename) ParseParamBoolMap(configFilename, CiscoMode, ModeMap, CISCO_MODE); ParseParamBoolMap(configFilename, QisdaMode, ModeMap, QISDA_MODE); ParseParamBoolMap(configFilename, QuantaMode, ModeMap, QUANTA_MODE); + ParseParamBoolMap(configFilename, OptionMode, ModeMap, OPTION_MODE); ParseParamBoolMap(configFilename, BlackberryMode, ModeMap, BLACKBERRY_MODE); ParseParamInt(configFilename, PantechMode); if (PantechMode) @@ -238,10 +242,8 @@ void readConfigFile(const char *configFilename) ParseParamString(configFilename, MessageContent2); ParseParamString(configFilename, MessageContent3); ParseParamInt(configFilename, ReleaseDelay); - ParseParamHex(configFilename, NeedResponse); ParseParamHex(configFilename, ResponseEndpoint); ParseParamHex(configFilename, ResetUSB); - ParseParamHex(configFilename, InquireDevice); ParseParamInt(configFilename, CheckSuccess); ParseParamHex(configFilename, Interface); ParseParamHex(configFilename, Configuration); @@ -260,17 +262,17 @@ void readConfigFile(const char *configFilename) void printConfig() { if ( DefaultVendor ) - fprintf (output,"DefaultVendor= 0x%04x\n", DefaultVendor); + fprintf (output,"DefaultVendor= 0x%04x\n", DefaultVendor); if ( DefaultProduct ) - fprintf (output,"DefaultProduct= 0x%04x\n", DefaultProduct); + fprintf (output,"DefaultProduct= 0x%04x\n", DefaultProduct); if ( TargetVendor ) - fprintf (output,"TargetVendor= 0x%04x\n", TargetVendor); + fprintf (output,"TargetVendor= 0x%04x\n", TargetVendor); if ( TargetProduct > -1 ) - fprintf (output,"TargetProduct= 0x%04x\n", TargetProduct); + fprintf (output,"TargetProduct= 0x%04x\n", TargetProduct); if ( TargetClass ) - fprintf (output,"TargetClass= 0x%02x\n", TargetClass); + fprintf (output,"TargetClass= 0x%02x\n", TargetClass); if ( strlen(TargetProductList) ) - fprintf (output,"TargetProductList=\"%s\"\n", TargetProductList); + fprintf (output,"TargetProductList=\"%s\"\n", TargetProductList); if (StandardEject) fprintf (output,"\nStandardEject=1\n"); if (ModeMap & DETACHONLY_MODE) @@ -299,6 +301,8 @@ void printConfig() fprintf (output,"CiscoMode=1\n"); if (ModeMap & BLACKBERRY_MODE) fprintf (output,"BlackberryMode=1\n"); + if (ModeMap & OPTION_MODE) + fprintf (output,"OptionMode=1\n"); if (ModeMap & PANTECH_MODE) fprintf (output,"PantechMode=1\n"); if ( MessageEndpoint ) @@ -309,7 +313,6 @@ void printConfig() fprintf (output,"MessageContent2=\"%s\"\n", MessageContent2); if ( strlen(MessageContent3) ) fprintf (output,"MessageContent3=\"%s\"\n", MessageContent3); - fprintf (output,"NeedResponse=%i\n", (int)NeedResponse); if ( ResponseEndpoint ) fprintf (output,"ResponseEndpoint=0x%02x\n", ResponseEndpoint); if ( Interface > -1 ) @@ -318,8 +321,6 @@ void printConfig() fprintf (output,"Configuration=0x%02x\n", Configuration); if ( AltSetting > -1 ) fprintf (output,"AltSetting=0x%02x\n", AltSetting); - if ( InquireDevice ) - fprintf (output,"\nInquireDevice=1\n"); if ( CheckSuccess ) fprintf (output,"Success check enabled, max. wait time %d seconds\n", CheckSuccess); if ( sysmode ) @@ -340,7 +341,7 @@ int readArguments(int argc, char **argv) while (1) { - 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:", + c = getopt_long (argc, argv, "hejWQDndKHJSOBEGTNALZUF: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. */ @@ -360,7 +361,7 @@ int readArguments(int argc, char **argv) case '2': strncpy(MessageContent2, optarg, LINE_DIM); break; case '3': strncpy(MessageContent3, optarg, LINE_DIM); break; case 'w': ReleaseDelay = strtol(optarg, NULL, 10); break; - case 'n': NeedResponse = 1; break; + case 'n': break; case 'r': ResponseEndpoint = strtol(optarg, NULL, 16); break; case 'K': StandardEject = 1; break; case 'd': ModeMap = ModeMap + DETACHONLY_MODE; break; @@ -376,6 +377,7 @@ int readArguments(int argc, char **argv) case 'A': ModeMap = ModeMap + MOBILEACTION_MODE; break; case 'L': ModeMap = ModeMap + CISCO_MODE; break; case 'Z': ModeMap = ModeMap + BLACKBERRY_MODE; break; + case 'U': ModeMap = ModeMap + OPTION_MODE; break; case 'F': ModeMap = ModeMap + PANTECH_MODE; PantechMode = strtol(optarg, NULL, 10); break; case 'c': readConfigFile(optarg); break; @@ -384,7 +386,7 @@ int readArguments(int argc, char **argv) case 'Q': show_progress = 0; verbose = 0; count--; break; case 'D': sysmode = 1; count--; break; case 's': CheckSuccess = strtol(optarg, NULL, 10); count--; break; - case 'I': InquireDevice = 1; break; + case 'I': break; case 'b': busnum = strtol(optarg, NULL, 10); break; case 'g': devnum = strtol(optarg, NULL, 10); break; @@ -418,7 +420,6 @@ int readArguments(int argc, char **argv) exit(1); } } - return count; } @@ -426,7 +427,7 @@ int readArguments(int argc, char **argv) int main(int argc, char **argv) { int ret=0, numDefaults=0, sonySuccess=0; - int currentConfig=0, defaultClass=0, interfaceClass=0; + int currentConfigVal=0, defaultClass=0, interfaceClass=0; struct libusb_device_descriptor descriptor; enum libusb_error libusbError; @@ -474,7 +475,9 @@ int main(int argc, char **argv) exit(1); } if ( hexstr2bin(MessageContent, ByteString, strlen(MessageContent)/2) == -1) { - fprintf(stderr, "Error: MessageContent %s\n is not a hex string. Abort\n\n", MessageContent); + fprintf(stderr, "Error: MessageContent %s\n is not a hex string. Abort\n\n", + MessageContent); + exit(1); } } @@ -487,7 +490,9 @@ int main(int argc, char **argv) } if (show_progress) - if (CheckSuccess && !(TargetVendor || TargetProduct > -1 || TargetProductList[0] != '\0') && !TargetClass) + if (CheckSuccess && !(TargetVendor || TargetProduct > -1 || TargetProductList[0] != '\0') + && !TargetClass) + fprintf(output,"Note: No target parameter given; success check limited\n"); if (TargetProduct > -1 && TargetProductList[0] == '\0') { @@ -512,7 +517,9 @@ int main(int argc, char **argv) /* Count existing target devices, remember for success check */ if (searchMode != SEARCH_BUSDEV && (TargetVendor || TargetClass)) { SHOW_PROGRESS(output,"Look for target devices ...\n"); - search_devices(&targetDeviceCount, TargetVendor, TargetProductList, TargetClass, 0, SEARCH_TARGET); + search_devices(&targetDeviceCount, TargetVendor, TargetProductList, TargetClass, 0, + SEARCH_TARGET); + if (targetDeviceCount) { SHOW_PROGRESS(output," Found devices in target mode or class (%d)\n", targetDeviceCount); } else @@ -523,7 +530,9 @@ int main(int argc, char **argv) SHOW_PROGRESS(output,"Look for default devices ...\n"); sprintf(DefaultProductList,"%04x",DefaultProduct); - dev = search_devices(&numDefaults, DefaultVendor, DefaultProductList, TargetClass, Configuration, searchMode); + dev = search_devices(&numDefaults, DefaultVendor, DefaultProductList, TargetClass, + Configuration, searchMode); + if (numDefaults) { SHOW_PROGRESS(output," Found devices in default mode (%d)\n", numDefaults); } else { @@ -531,6 +540,7 @@ int main(int argc, char **argv) close_all(); exit(0); } + if (dev == NULL) { SHOW_PROGRESS(output," No bus/device match. Is device connected? Abort\n\n"); close_all(); @@ -544,18 +554,18 @@ int main(int argc, char **argv) libusb_open(dev, &devh); if (devh == NULL) { SHOW_PROGRESS(output,"Error opening the device. Abort\n\n"); - abort(); + abortExit(); } } - - /* Get current configuration of default device if parameter is set */ - libusb_get_active_config_descriptor(dev, &active_config); + /* Get current configuration of default device, note value if Configuration + * parameter is set. Also sets active_config + */ + currentConfigVal = get_current_config_value(dev); if (Configuration > -1) { - currentConfig = active_config->bConfigurationValue; - SHOW_PROGRESS(output,"Current configuration number is %d\n", currentConfig); + SHOW_PROGRESS(output,"Current configuration number is %d\n", currentConfigVal); } else - currentConfig = 0; + currentConfigVal = 0; libusb_get_device_descriptor(dev, &descriptor); defaultClass = descriptor.bDeviceClass; @@ -567,31 +577,37 @@ int main(int argc, char **argv) interfaceClass = get_interface_class(); /* Check or get endpoints */ - if (strlen(MessageContent) || StandardEject || InquireDevice || ModeMap & CISCO_MODE || ModeMap & HUAWEINEW_MODE) { + if (strlen(MessageContent) || StandardEject || ModeMap & CISCO_MODE + || ModeMap & HUAWEINEW_MODE || ModeMap & OPTION_MODE) { + if (!MessageEndpoint) MessageEndpoint = find_first_bulk_endpoint(LIBUSB_ENDPOINT_OUT); if (!ResponseEndpoint) ResponseEndpoint = find_first_bulk_endpoint(LIBUSB_ENDPOINT_IN); if (!MessageEndpoint) { fprintf(stderr,"Error: message endpoint not given or found. Abort\n\n"); - abort(); + abortExit(); } if (!ResponseEndpoint) { fprintf(stderr,"Error: response endpoint not given or found. Abort\n\n"); - abort(); + abortExit(); } - SHOW_PROGRESS(output,"Use endpoints 0x%02x (out) and 0x%02x (in)\n", MessageEndpoint, ResponseEndpoint); + SHOW_PROGRESS(output,"Use endpoints 0x%02x (out) and 0x%02x (in)\n", MessageEndpoint, + ResponseEndpoint); + } if (interfaceClass == -1) { fprintf(stderr, "Error: Could not get class of interface %d. Does it exist? Abort\n\n",Interface); - abort(); + abortExit(); } if (defaultClass == 0) defaultClass = interfaceClass; else - if (interfaceClass == 8 && defaultClass != 8 && defaultClass != 0xef && defaultClass != 0xff) { + if (interfaceClass == LIBUSB_CLASS_MASS_STORAGE && defaultClass != LIBUSB_CLASS_MASS_STORAGE + && defaultClass != 0xef && defaultClass != LIBUSB_CLASS_VENDOR_SPEC) { + /* Unexpected default class combined with differing interface class */ SHOW_PROGRESS(output,"Bogus Class/InterfaceClass: 0x%02x/0x08\n", defaultClass); defaultClass = 8; @@ -601,27 +617,12 @@ int main(int argc, char **argv) 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); - abort(); + abortExit(); } - if (InquireDevice && show_progress) { - if (defaultClass == 0x08) { - SHOW_PROGRESS(output,"Inquire device details; driver will be detached ...\n"); - detachDriver(); - if (deviceInquire() >= 0) - InquireDevice = 2; - } else - SHOW_PROGRESS(output,"Not a storage device, skip SCSI inquiry\n"); - } - - deviceDescription(); if (show_progress) { fprintf(output,"\nUSB description data (for identification)\n"); - fprintf(output,"-------------------------\n"); - fprintf(output,"Manufacturer: %s\n", imanufact); - fprintf(output," Product: %s\n", iproduct); - fprintf(output," Serial No.: %s\n", iserial); - fprintf(output,"-------------------------\n"); + deviceDescription(); } /* Special modes are exclusive, so check for illegal combinations. @@ -629,7 +630,7 @@ int main(int argc, char **argv) */ if ( ModeMap & (ModeMap-1) ) { fprintf(output,"Multiple special modes selected; check configuration. Abort\n\n"); - abort(); + abortExit(); } if ((strlen(MessageContent) || StandardEject) && ModeMap ) { @@ -651,18 +652,16 @@ int main(int argc, char **argv) if (sysmode) { openlog("usb_modeswitch", 0, LOG_SYSLOG); - syslog(LOG_NOTICE, "switch device %04x:%04x on %03d/%03d", DefaultVendor, DefaultProduct, busnum, devnum); + syslog(LOG_NOTICE, "switch device %04x:%04x on %03d/%03d", DefaultVendor, DefaultProduct, + busnum, devnum); + } if (ModeMap & DETACHONLY_MODE) { SHOW_PROGRESS(output,"Detach storage driver as switching method ...\n"); - if (InquireDevice == 2) { - SHOW_PROGRESS(output," Any driver was already detached for inquiry. Do nothing\n"); - } else { - ret = detachDriver(); - if (ret == 2) - SHOW_PROGRESS(output," You may want to remove the storage driver manually\n"); - } + ret = detachDriver(); + if (ret == 2) + SHOW_PROGRESS(output," You may want to remove the storage driver manually\n"); } if(ModeMap & HUAWEI_MODE) { @@ -723,32 +722,35 @@ int main(int argc, char **argv) strcpy(MessageContent,"5553424387654321000000000000061e000000000000000000000000000000"); strcpy(MessageContent2,"5553424397654321000000000000061b000000020000000000000000000000"); - NeedResponse = 1; switchSendMessage(); } else if (ModeMap & HUAWEINEW_MODE) { SHOW_PROGRESS(output,"Using standard Huawei switching message\n"); detachDriver(); strcpy(MessageContent,"55534243123456780000000000000011062000000101000100000000000000"); - NeedResponse = 0; + switchSendMessage(); + } else if (ModeMap & OPTION_MODE) { + SHOW_PROGRESS(output,"Using standard Option switching message\n"); + detachDriver(); +// strcpy(MessageContent,"55534243123456780100000080000601000000000000000000000000000000"); + strcpy(MessageContent,"55534243123456780000000000000601000000000000000000000000000000"); switchSendMessage(); } else if (strlen(MessageContent)) { - if (InquireDevice != 2) - detachDriver(); + detachDriver(); switchSendMessage(); } if (Configuration > 0) { - if (currentConfig != Configuration) { + if (currentConfigVal != Configuration) { if (switchConfiguration()) { - currentConfig = get_current_configuration(dev); - if (currentConfig == Configuration) { + currentConfigVal = get_current_config_value(dev); + if (currentConfigVal == Configuration) { SHOW_PROGRESS(output,"The configuration was set successfully\n"); } else { SHOW_PROGRESS(output,"Changing the configuration has failed\n"); } } } else { - SHOW_PROGRESS(output,"Target configuration %d found. Do nothing\n", currentConfig); + SHOW_PROGRESS(output,"Target configuration %d found. Do nothing\n", currentConfigVal); } } @@ -811,6 +813,7 @@ int main(int argc, char **argv) /* Get descriptor strings if available (identification details) */ void deviceDescription () { + char imanufact[DESCR_MAX], iproduct[DESCR_MAX], iserial[DESCR_MAX]; int ret=0; char* c; memset (imanufact, ' ', DESCR_MAX); @@ -826,8 +829,10 @@ void deviceDescription () if (iManufacturer) { ret = libusb_get_string_descriptor_ascii(devh, iManufacturer, (unsigned char *)imanufact, DESCR_MAX); - if (ret < 0) + if (ret < 0) { fprintf(stderr, "Error: could not get description string \"manufacturer\"\n"); + strcpy(imanufact, "read error"); + } } else strcpy(imanufact, "not provided"); c = strstr(imanufact, " "); @@ -836,8 +841,10 @@ void deviceDescription () if (iProduct) { ret = libusb_get_string_descriptor_ascii(devh, iProduct, (unsigned char *)iproduct, DESCR_MAX); - if (ret < 0) + if (ret < 0) { fprintf(stderr, "Error: could not get description string \"product\"\n"); + strcpy(iproduct, "read error"); + } } else strcpy(iproduct, "not provided"); c = strstr(iproduct, " "); @@ -846,81 +853,20 @@ void deviceDescription () if (iSerialNumber) { ret = libusb_get_string_descriptor_ascii(devh, iSerialNumber, (unsigned char *)iserial, DESCR_MAX); - if (ret < 0) + if (ret < 0) { fprintf(stderr, "Error: could not get description string \"serial number\"\n"); + strcpy(iserial, "read error"); + } } else strcpy(iserial, "not provided"); c = strstr(iserial, " "); if (c) memset((void*)c, '\0', 1); - -} - -/* Print result of SCSI command INQUIRY (identification details) */ -int deviceInquire () -{ - const unsigned char inquire_msg[] = { - 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78, - 0x24, 0x00, 0x00, 0x00, 0x80, 0x00, 0x06, 0x12, - 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - char *command; - char data[36]; - int i, ret=0; - - command = malloc(31); - if (command == NULL) { - ret = 1; - goto out; - } - - memcpy(command, inquire_msg, sizeof (inquire_msg)); - - ret = libusb_claim_interface(devh, Interface); - if (ret != 0) { - SHOW_PROGRESS(output," Could not claim interface (error %d). Skip device inquiry\n", ret); - goto out; - } - libusb_clear_halt(devh, MessageEndpoint); - - ret = usb_bulk_io(devh, MessageEndpoint, (char *)command, 31, 0); - if (ret < 0) { - SHOW_PROGRESS(output," INQUIRY message failed (error %d)\n", ret); - goto out; - } - - ret = usb_bulk_io(devh, ResponseEndpoint, data, 36, 0); - if (ret < 0) { - SHOW_PROGRESS(output," INQUIRY response failed (error %d)\n", ret); - goto out; - } - - i = usb_bulk_io(devh, ResponseEndpoint, command, 13, 0); - - fprintf(output,"\nSCSI inquiry data (for identification)\n"); fprintf(output,"-------------------------\n"); - - fprintf(output," Vendor String: "); - for (i = 8; i < 16; i++) printf("%c",data[i]); - fprintf(output,"\n"); - - fprintf(output," Model String: "); - for (i = 16; i < 32; i++) printf("%c",data[i]); - fprintf(output,"\n"); - - fprintf(output,"Revision String: "); - for (i = 32; i < 36; i++) printf("%c",data[i]); - - fprintf(output,"\n-------------------------\n"); - -out: - if (strlen(MessageContent) == 0) { - libusb_clear_halt(devh, MessageEndpoint); - libusb_release_interface(devh, Interface); - } - free(command); - return ret; + fprintf(output,"Manufacturer: %s\n", imanufact); + fprintf(output," Product: %s\n", iproduct); + fprintf(output," Serial No.: %s\n", iserial); + fprintf(output,"-------------------------\n"); } @@ -979,6 +925,7 @@ int findMBIMConfig(int vendor, int product, int mode) return 0; } + void resetUSB () { int success; @@ -1020,17 +967,11 @@ int switchSendMessage () msg[1] = MessageContent2; msg[2] = MessageContent3; - /* May be activated in future versions */ -// if (MessageContent2[0] != '\0' || MessageContent3[0] != '\0') -// NeedResponse = 1; - SHOW_PROGRESS(output,"Set up interface %d\n", Interface); - if (InquireDevice != 2) { - ret = libusb_claim_interface(devh, Interface); - if (ret != 0) { - SHOW_PROGRESS(output," Could not claim interface (error %d). Skip message sending\n", ret); - return 0; - } + ret = libusb_claim_interface(devh, Interface); + if (ret != 0) { + SHOW_PROGRESS(output," Could not claim interface (error %d). Skip message sending\n", ret); + return 0; } libusb_clear_halt(devh, MessageEndpoint); SHOW_PROGRESS(output,"Use endpoint 0x%02x for message sending ...\n", MessageEndpoint); @@ -1042,21 +983,19 @@ int switchSendMessage () continue; if ( sendMessage(msg[i], i+1) ) - goto skip; + goto skip; - if (NeedResponse) { - if ( strstr(msg[i],cmdHead) != NULL ) { - // UFI command - SHOW_PROGRESS(output,"Read the response to message %d (CSW) ...\n", i+1); - ret = read_bulk(ResponseEndpoint, ByteString, 13); - } else { - // Other bulk transfer - SHOW_PROGRESS(output,"Read the response to message %d ...\n", i+1); - ret = read_bulk(ResponseEndpoint, ByteString, strlen(msg[i])/2 ); - } - if (ret < 0) - goto skip; + if ( strstr(msg[i],cmdHead) != NULL ) { + // UFI command + SHOW_PROGRESS(output,"Read the response to message %d (CSW) ...\n", i+1); + ret = read_bulk(ResponseEndpoint, ByteString, 13); + } else { + // Other bulk transfer + SHOW_PROGRESS(output,"Read the response to message %d ...\n", i+1); + ret = read_bulk(ResponseEndpoint, ByteString, strlen(msg[i])/2 ); } + if (ret < 0) + goto skip; } SHOW_PROGRESS(output,"Reset response endpoint 0x%02x\n", ResponseEndpoint); @@ -1104,6 +1043,7 @@ int switchConfiguration () } } + int switchAltSetting () { int ret; @@ -1127,8 +1067,9 @@ 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); + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT, + LIBUSB_REQUEST_SET_FEATURE, 00000001, 0, buffer, 0, 1000); + if (ret != 0) { fprintf(stderr, "Error: Huawei control message failed (error %d). Abort\n\n", ret); exit(0); @@ -1140,7 +1081,8 @@ 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); + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT, + LIBUSB_REQUEST_SET_INTERFACE, 00000001, 0, buffer, 0, 1000); if (ret == LIBUSB_ERROR_PIPE) { SHOW_PROGRESS(output," communication with device stopped. May have switched modes anyway\n"); return; @@ -1160,13 +1102,19 @@ void switchGCTMode () SHOW_PROGRESS(output," Could not claim interface (error %d). Skip GCT sequence\n", ret); return; } - SHOW_PROGRESS(output,"Send GCT control message 1 ...\n"); - ret = libusb_control_transfer(devh, 0xa1, 0xa0, 0, Interface, (unsigned char *)buffer, 1, 1000); + SHOW_PROGRESS(output,"Send GCT control message 1 ...\n type (should be 161/0xA1): %d", + LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_IN); + + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_IN, + 0xa0, 0, Interface, buffer, 1, 1000); + if (ret < 0) { SHOW_PROGRESS(output," GCT control message 1 failed (error %d), continue anyway ...\n", ret); } SHOW_PROGRESS(output,"Send GCT control message 2 ...\n"); - ret = libusb_control_transfer(devh, 0xa1, 0xfe, 0, Interface, (unsigned char *)buffer, 1, 1000); + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_IN, + 0xfe, 0, Interface, buffer, 1, 1000); + if (ret < 0) { SHOW_PROGRESS(output," GCT control message 2 failed (error %d). Abort\n\n", ret); } @@ -1180,7 +1128,8 @@ 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); + 0x88, 0, 0, buffer, 8, 1000); + if (ret < 0) { fprintf(stderr, "Error: Kobil control message failed (error %d). Abort\n\n", ret); exit(0); @@ -1192,7 +1141,7 @@ 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); + ret = libusb_control_transfer(devh, 0x40, 0x04, 0, 0, buffer, 16, 1000); if (ret < 0) { fprintf(stderr, "Error: Qisda control message failed (error %d). Abort\n\n", ret); exit(0); @@ -1204,7 +1153,8 @@ 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); + 0xff, 0, 0, buffer, 0, 1000); + if (ret < 0) { SHOW_PROGRESS(output,"Error: Quanta control message failed (error %d). Abort\n\n", ret); exit(0); @@ -1217,13 +1167,15 @@ 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); + 0xb1, 0x0000, 0, buffer, 8, 1000); + if (ret != 8) { fprintf(stderr, "Error: Blackberry control message 1 failed (result %d)\n", ret); } SHOW_PROGRESS(output,"Send Blackberry control message 2 ...\n"); ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, - 0xa9, 0x000e, 0, (unsigned char *)buffer, 2, 1000); + 0xa9, 0x000e, 0, buffer, 2, 1000); + if (ret != 2) { fprintf(stderr, "Error: Blackberry control message 2 failed (result %d). Abort\n\n", ret); exit(0); @@ -1235,7 +1187,9 @@ void switchPantechMode() { 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); + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT, + 0x70, PantechMode, 0, buffer, 0, 1000); + if (ret < 0) { SHOW_PROGRESS(output," Error: Pantech control message failed (error %d). Abort\n\n", ret); exit(0); @@ -1250,9 +1204,8 @@ void switchPantechMode() #define MOBILE_ACTION_READLOOP1 63 #define MOBILE_ACTION_READLOOP2 73 -/* If anyone can test the MobileAction cable - I bet this - * function (which is confirmed working) can be greatly - * simplified ... +/* The code here is statically derived from sniffing (and confirmed working). + * However I bet it could be simplified significantly. */ void switchActionMode () @@ -1260,9 +1213,13 @@ void switchActionMode () 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); + libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_OUT, + 0x09, 0x0300, 0, buffer, SIZE, 1000); + 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); + libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_CLASS | LIBUSB_RECIPIENT_INTERFACE | LIBUSB_ENDPOINT_OUT, + 0x09, 0x0300, 0, buffer, SIZE, 1000); + usb_interrupt_io(devh, EP_IN, buffer, SIZE, 1000); usb_interrupt_io(devh, EP_IN, buffer, SIZE, 1000); memcpy(buffer, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", SIZE); @@ -1308,19 +1265,24 @@ void switchActionMode () #define SQN_MASS_STORAGE_MODE 0x01 #define SQN_CUSTOM_DEVICE_MODE 0x02 -void switchSequansMode() { +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); + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_OUT, + SQN_SET_DEVICE_MODE_REQUEST, SQN_CUSTOM_DEVICE_MODE, 0, buffer, 0, 1000); + if (ret < 0) { fprintf(stderr, "Error: Sequans request failed (error %d). Abort\n\n", ret); exit(0); } } -void switchCiscoMode() { - int ret, i; + +void switchCiscoMode() +{ + int ret, i, j; char* msg[11]; msg[0] = "55534243f83bcd810002000080000afd000000030000000100000000000000"; @@ -1339,7 +1301,7 @@ void switchCiscoMode() { ret = libusb_claim_interface(devh, Interface); if (ret < 0) { SHOW_PROGRESS(output," Could not claim interface (error %d). Abort\n", ret); - abort(); + abortExit(); } // libusb_clear_halt(devh, MessageEndpoint); if (show_progress) @@ -1352,20 +1314,21 @@ void switchCiscoMode() { if ( sendMessage(msg[i], i+1) ) goto skip; - SHOW_PROGRESS(output," Read the response (CSW) to bulk message %d ...\n",i+1); - ret = read_bulk(ResponseEndpoint, ByteString, 13); - if (ret < 0) - goto skip; - if (ret < 13) { - SHOW_PROGRESS(output," Repeat reading the response to bulk message %d ...\n",i+1); - ret = read_bulk(ResponseEndpoint, ByteString, 13); - } - if (ret < 13) { - SHOW_PROGRESS(output," Repeat reading the response to bulk message %d ...\n",i+1); + for (j=1; j<4; j++) { + + SHOW_PROGRESS(output," Read the CSW for bulk message %d (attempt %d) ...\n",i+1,j); ret = read_bulk(ResponseEndpoint, ByteString, 13); + + if (ret < 0) + goto skip; + if (ret == 13) + break; } } + libusb_clear_halt(devh, MessageEndpoint); + libusb_clear_halt(devh, ResponseEndpoint); +ReleaseDelay = 2000; if (ReleaseDelay) { SHOW_PROGRESS(output,"Wait for %d ms before releasing interface ...\n", ReleaseDelay); usleep(ReleaseDelay*1000); @@ -1392,7 +1355,9 @@ int switchSonyMode () } SHOW_PROGRESS(output,"Send Sony control message\n"); - ret = libusb_control_transfer(devh, 0xc0, 0x11, 2, 0, (unsigned char *)buffer, 3, 100); + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, + 0x11, 2, 0, buffer, 3, 100); + if (ret < 0) { fprintf(stderr, "Error: Sony control message failed (error %d). Abort\n\n", ret); exit(0); @@ -1435,7 +1400,9 @@ int switchSonyMode () sleep(1); SHOW_PROGRESS(output,"Send Sony control message again ...\n"); - ret = libusb_control_transfer(devh, 0xc0, 0x11, 2, 0, (unsigned char *)buffer, 3, 100); + ret = libusb_control_transfer(devh, LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN, + 0x11, 2, 0, buffer, 3, 100); + if (ret < 0) { fprintf(stderr, "Error: Sony control message (2) failed (error %d)\n", ret); return 0; @@ -1451,9 +1418,6 @@ int detachDriver() { int ret; - // Driver already detached during SCSI inquiry ? - if (InquireDevice == 2) - return 1; SHOW_PROGRESS(output,"Looking for active driver ...\n"); ret = libusb_kernel_driver_active(devh, 0); if (ret == LIBUSB_ERROR_NOT_SUPPORTED) { @@ -1492,7 +1456,9 @@ int sendMessage(char* message, int count) } message_length = strlen(message) / 2; if ( hexstr2bin(message, ByteString, message_length) == -1) { - fprintf(stderr, "Error: MessageContent %d %s\n is not a hex string. Skipping ...\n", count, MessageContent); + fprintf(stderr, "Error: MessageContent %d %s\n is not a hex string. Skipping ...\n", + count, MessageContent); + return 1; } SHOW_PROGRESS(output,"Trying to send message %d to endpoint 0x%02x ...\n", count, MessageEndpoint); @@ -1549,7 +1515,8 @@ int checkSuccess() break; } if (i == CheckSuccess-1) { - SHOW_PROGRESS(output," Original device still present after the timeout\n\nMode switch most likely failed. Bye!\n\n"); + SHOW_PROGRESS(output," Original device still present after the timeout\n\n" + "Mode switch most likely failed. Bye!\n\n"); } else sleep(1); } @@ -1562,29 +1529,29 @@ int checkSuccess() */ for (i=i; i < CheckSuccess; i++) { SHOW_PROGRESS(output," Search for target devices ...\n"); - dev = search_devices(&newTargetCount, TargetVendor, TargetProductList, TargetClass, 0, SEARCH_TARGET); + dev = search_devices(&newTargetCount, TargetVendor, TargetProductList, TargetClass, + 0, SEARCH_TARGET); + if (dev && (newTargetCount > targetDeviceCount)) { - fprintf(output,"\nFound target device, open it\n"); - libusb_open(dev, &devh); - deviceDescription(); - libusb_close(devh); - devh = NULL; if (verbose) { - fprintf(output,"\nFound target device %03d on bus %03d\n", \ - libusb_get_device_address(dev), libusb_get_bus_number(dev)); + libusb_open(dev, &devh); + fprintf(output,"\nFound target device %03d on bus %03d\n", + libusb_get_device_address(dev), libusb_get_bus_number(dev)); + fprintf(output,"\nTarget device description data\n"); - fprintf(output,"-------------------------\n"); - fprintf(output,"Manufacturer: %s\n", imanufact); - fprintf(output," Product: %s\n", iproduct); - fprintf(output," Serial No.: %s\n", iserial); - fprintf(output,"-------------------------\n"); + deviceDescription(); + libusb_close(devh); + devh = NULL; } - SHOW_PROGRESS(output," Found correct target device\n\nMode switch succeeded. Bye!\n\n"); + SHOW_PROGRESS(output," Found correct target device\n\n" + "Mode switch succeeded. Bye!\n\n"); + success = 2; break; } if (i == CheckSuccess-1) { - SHOW_PROGRESS(output," No new devices in target mode or class found\n\nMode switch has failed. Bye!\n\n"); + SHOW_PROGRESS(output," No new devices in target mode or class found\n\n" + "Mode switch has failed. Bye!\n\n"); } else sleep(1); } @@ -1592,7 +1559,8 @@ int checkSuccess() /* No target data given, rely on the vanished device */ if (!devh) { SHOW_PROGRESS(output," (For a better success check provide target IDs or class)\n"); - SHOW_PROGRESS(output," Original device vanished after switching\n\nMode switch most likely succeeded. Bye!\n\n"); + SHOW_PROGRESS(output," Original device vanished after switching\n\n" + "Mode switch most likely succeeded. Bye!\n\n"); success = 1; } @@ -1605,7 +1573,9 @@ int checkSuccess() break; case 2: if (sysmode) - syslog(LOG_NOTICE, "switched to %04x:%04x on %03d/%03d", TargetVendor, TargetProduct, busnum, devnum); + syslog(LOG_NOTICE, "switched to %04x:%04x on %03d/%03d", TargetVendor, + TargetProduct, busnum, devnum); + success = 1; break; case 1: @@ -1622,7 +1592,7 @@ int checkSuccess() } -int write_bulk(int endpoint, char *message, int length) +int write_bulk(int endpoint, unsigned char *message, int length) { int ret = usb_bulk_io(devh, endpoint, message, length, 3000); if (ret >= 0 ) { @@ -1636,7 +1606,8 @@ int write_bulk(int endpoint, char *message, int length) } -int read_bulk(int endpoint, char *buffer, int length) + +int read_bulk(int endpoint, unsigned char *buffer, int length) { int ret = usb_bulk_io(devh, endpoint, buffer, length, 3000); if (ret >= 0 ) { @@ -1650,7 +1621,9 @@ int read_bulk(int endpoint, char *buffer, int length) } -void release_usb_device(int __attribute__((unused)) dummy) { + +void release_usb_device(int __attribute__((unused)) dummy) +{ SHOW_PROGRESS(output,"Program cancelled by system. Bye!\n\n"); if (devh) libusb_release_interface(devh, Interface); @@ -1663,9 +1636,11 @@ void release_usb_device(int __attribute__((unused)) dummy) { /* Iterates over busses and devices, counts the ones which match the given * parameters and returns the last one of them */ -struct libusb_device* search_devices( int *numFound, int vendor, char* productList, int targetClass, int configuration, int mode) +struct libusb_device* search_devices( int *numFound, int vendor, char* productList, + int targetClass, int configuration, int mode) { - char *listcopy=NULL, *token, buffer[2]; + char *listcopy=NULL, *token; + unsigned char buffer[2]; int devClass, product; struct libusb_device* right_dev = NULL; // struct libusb_device_handle *testdevh; @@ -1714,11 +1689,15 @@ struct libusb_device* search_devices( int *numFound, int vendor, char* productLi token = strtok(listcopy, ","); while (token != NULL) { if (strlen(token) != 4) { - SHOW_PROGRESS(output,"Error: entry in product ID list has wrong length: %s. Ignored\n", token); + SHOW_PROGRESS(output,"Error: entry in product ID list has wrong length: %s. " + "Ignored\n", token); + goto NextToken; } if ( hexstr2bin(token, buffer, strlen(token)/2) == -1) { - SHOW_PROGRESS(output,"Error: entry in product ID list is not a hex string: %s. Ignored\n", token); + SHOW_PROGRESS(output,"Error: entry in product ID list is not a hex string: %s. " + "Ignored\n", token); + goto NextToken; } product = 0; @@ -1766,10 +1745,12 @@ struct libusb_device* search_devices( int *numFound, int vendor, char* productLi } } else if (configuration > 0) { // Configuration parameter is set, check device configuration - int testconfig = get_current_configuration(dev); + int testconfig = get_current_config_value(dev); if (testconfig != configuration) { if (verbose) - fprintf (output," device configuration %d not matching target\n", testconfig); + fprintf (output," device configuration %d not matching target\n", + testconfig); + (*numFound)++; right_dev = dev; if (verbose) @@ -1796,9 +1777,6 @@ struct libusb_device* search_devices( int *numFound, int vendor, char* productLi } -#define USB_DIR_OUT 0x00 -#define USB_DIR_IN 0x80 - /* Autodetect bulk endpoints (ab) */ int find_first_bulk_endpoint(int direction) @@ -1810,10 +1788,11 @@ int find_first_bulk_endpoint(int direction) for (j=0; j < active_config->bNumInterfaces; j++) { alt = &(active_config->interface[j].altsetting[0]); if (alt->bInterfaceNumber == Interface) { - for(i=0; i < alt->bNumEndpoints; i++) { - ep=&(alt->endpoint[i]); - if( ( (ep->bmAttributes & LIBUSB_ENDPOINT_ADDRESS_MASK) == LIBUSB_TRANSFER_TYPE_BULK) && - ( (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) == direction ) ) { + for (i=0; i < alt->bNumEndpoints; i++) { + ep = &(alt->endpoint[i]); + if ( ( (ep->bmAttributes & LIBUSB_ENDPOINT_ADDRESS_MASK) == LIBUSB_TRANSFER_TYPE_BULK) + && ( (ep->bEndpointAddress & LIBUSB_ENDPOINT_DIR_MASK) == direction ) ) { + return ep->bEndpointAddress; } } @@ -1822,7 +1801,8 @@ int find_first_bulk_endpoint(int direction) return 0; } -int get_current_configuration() + +int get_current_config_value() { SHOW_PROGRESS(output,"Get the current device configuration ...\n"); if (active_config != NULL) { @@ -1832,11 +1812,12 @@ int get_current_configuration() 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(); + abortExit(); } return active_config->bConfigurationValue; } + int get_interface_class() { int i; @@ -1847,6 +1828,7 @@ int get_interface_class() return -1; } + /* Parameter parsing */ char* ReadParseParam(const char* FileName, char *VariableName) @@ -1878,7 +1860,7 @@ char* ReadParseParam(const char* FileName, char *VariableName) } if (file==NULL) { fprintf(stderr, "Error: Could not find file %s. Abort\n\n", FileName); - abort(); + abortExit(); } else { token = fgets(Str, LINE_DIM-1, file); } @@ -1923,7 +1905,9 @@ char* ReadParseParam(const char* FileName, char *VariableName) LastQuote=strrchr (Equal, '"'); if (FirstQuote!=NULL) { if (LastQuote==NULL) { - fprintf(stderr, "Error reading parameters from file %s - Missing end quote:\n%s\n", FileName, Str); + fprintf(stderr, "Error reading parameters from file %s - " + "Missing end quote:\n%s\n", FileName, Str); + goto Next; } *FirstQuote=*LastQuote='\0'; @@ -1933,7 +1917,9 @@ char* ReadParseParam(const char* FileName, char *VariableName) // removes leading/trailing spaces Pos=strspn (Str, " \t"); if (Pos==strlen(Str)) { - fprintf(stderr, "Error reading parameters from file %s - Missing variable name:\n%s\n", FileName, Str); + fprintf(stderr, "Error reading parameters from file %s - " + "Missing variable name:\n%s\n", FileName, Str); + goto Next; } while ((P1=strrchr(Str, ' '))!=NULL or (P2=strrchr(Str, '\t'))!=NULL) @@ -1943,7 +1929,9 @@ char* ReadParseParam(const char* FileName, char *VariableName) Pos=strspn (Equal, " \t"); if (Pos==strlen(Equal)) { - fprintf(stderr, "Error reading parameter from file %s - Missing value:\n%s\n", FileName, Str); + fprintf(stderr, "Error reading parameter from file %s - " + "Missing value:\n%s\n", FileName, Str); + goto Next; } Equal+=Pos; @@ -1983,23 +1971,25 @@ int hex2byte(const char *hex) return (a << 4) | b; } -int hexstr2bin(const char *hex, char *buffer, int len) + +int hexstr2bin(const char *hex, unsigned char *buffer, int len) { int i; int a; const char *ipos = hex; - char *opos = buffer; + unsigned char *opos = buffer; for (i = 0; i < len; i++) { a = hex2byte(ipos); if (a < 0) return -1; - *opos++ = a; + *opos++ = (unsigned char) a; ipos += 2; } return 0; } + void close_all() { if (active_config) @@ -2014,7 +2004,8 @@ void close_all() closelog(); } -void abort() + +void abortExit() { close_all(); exit(1); @@ -2030,6 +2021,7 @@ void printVersion() " ! PLEASE REPORT NEW CONFIGURATIONS !\n\n", version); } + void printHelp() { fprintf(output,"\nUsage: usb_modeswitch [] [-c filename]\n\n" @@ -2046,7 +2038,8 @@ void printHelp() " -m, --message-endpoint NUM direct the message transfer there (optional)\n" " -M, --message-content message to send (hex number as string)\n" " -2 , -3 additional messages to send (-n recommended)\n" - " -n, --need-response read response to the message transfer (CSW)\n" + " -w, --release-delay NUM wait NUM ms before releasing the interface\n" + " -n, --need-response obsolete, no effect (always on)\n" " -r, --response-endpoint NUM read response from there (optional)\n" " -K, --std-eject send standard EJECT sequence\n" " -d, --detach-only detach the active driver, no further action\n" @@ -2062,12 +2055,14 @@ void printHelp() " -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" + " -Z, --blackberry-mode apply a special procedure\n" + " -U, --option-mode apply a special procedure\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" " -D, --sysmode specific result and syslog message\n" " -s, --success switching result check with timeout\n" - " -I, --inquire retrieve SCSI attributes initially\n\n" + " -I, --inquire obsolete, no effect\n\n" " -c, --config-file load long configuration from file\n\n" " -t, --stdinput read long configuration from stdin\n\n" " -f, --long-config get long configuration from string\n\n" diff --git a/release/src/router/usbmodeswitch/usb_modeswitch.h b/release/src/router/usbmodeswitch/usb_modeswitch.h index 1c28ef9df6..f01bbd4796 100644 --- a/release/src/router/usbmodeswitch/usb_modeswitch.h +++ b/release/src/router/usbmodeswitch/usb_modeswitch.h @@ -2,8 +2,8 @@ This file is part of usb_modeswitch, a mode switching tool for controlling the mode of 'multi-state' USB devices - Version 2.2.5, 2015/07/16 - Copyright (C) 2007 - 2015 Josua Dietze + Version 2.3.0, 2016/01/12 + Copyright (C) 2007 - 2016 Josua Dietze Config file parsing stuff borrowed from Guillaume Dargaud (http://www.gdargaud.net/Hack/SourceCode.html) @@ -46,25 +46,24 @@ int switchSonyMode(); int detachDriver(); int checkSuccess(); int sendMessage(char* message, int count); -int write_bulk(int endpoint, char *message, int length); -int read_bulk(int endpoint, char *buffer, int length); +int write_bulk(int endpoint, unsigned char *message, int length); +int read_bulk(int endpoint, unsigned char *buffer, int length); void release_usb_device(int dummy); struct libusb_device* search_devices( int *numFound, int vendor, char* productList, int targetClass, int configuration, int mode); int find_first_bulk_endpoint(int direction); -int get_current_configuration(); +int get_current_config_value(); int get_interface_class(); char* ReadParseParam(const char* FileName, char *VariableName); int hex2num(char c); int hex2byte(const char *hex); -int hexstr2bin(const char *hex, char *buffer, int len); +int hexstr2bin(const char *hex, unsigned char *buffer, int len); void printVersion(); void printHelp(); void close_all(); -void abort(); +void abortExit(); int readArguments(int argc, char **argv); void deviceDescription(); -int deviceInquire(); void resetUSB(); void release_usb_device(int dummy); int findMBIMConfig(int vendor, int product, int mode); diff --git a/release/src/router/usbmodeswitch/usb_modeswitch.sh b/release/src/router/usbmodeswitch/usb_modeswitch.sh index f538acf222..fb02579def 100755 --- a/release/src/router/usbmodeswitch/usb_modeswitch.sh +++ b/release/src/router/usbmodeswitch/usb_modeswitch.sh @@ -1,5 +1,5 @@ #!/bin/sh -# part of usb_modeswitch 2.2.5 +# part of usb_modeswitch 2.3.0 device_in() { if [ ! -e /var/lib/usb_modeswitch/$1 ]; then diff --git a/release/src/router/usbmodeswitch/usb_modeswitch.tcl b/release/src/router/usbmodeswitch/usb_modeswitch.tcl index bbefe53e4a..0a71565c68 100755 --- a/release/src/router/usbmodeswitch/usb_modeswitch.tcl +++ b/release/src/router/usbmodeswitch/usb_modeswitch.tcl @@ -9,8 +9,8 @@ # the mode switching program with the matching parameter # file from /usr/share/usb_modeswitch # -# Part of usb-modeswitch-2.2.5 package -# (C) Josua Dietze 2009-2015 +# Part of usb-modeswitch-2.3.0 package +# (C) Josua Dietze 2009-2016 set arg0 [lindex $argv 0] if [regexp {\.tcl$} $arg0] { @@ -28,6 +28,8 @@ set flags(logging) 1 set flags(noswitching) 0 set flags(stordelay) 0 set flags(logwrite) 0 +# also settable in device config files +set flags(nombim) 0 # Execution starts at file bottom @@ -109,10 +111,7 @@ if {[string length [lindex $argList 0]] == 0} { SafeExit } else { if {![regexp {(.*?):} [lindex $argList 1] d dev_top]} { - if [regexp {([0-9]+-[0-9]+\.?[0-9]*.*)} [lindex $argList 1] d dev_top] { - # new udev rules file, got to check class of first interface - set ifChk 1 - } else { + if {![regexp {([0-9]+-[0-9]+\.?[0-9]*.*)} [lindex $argList 1] d dev_top]} { Log "Could not determine device dir from udev values! Exit" SafeExit } @@ -131,21 +130,15 @@ if {![file isdirectory $devdir]} { Log "Use top device dir $devdir" set iface 0 -if $ifChk { - Log "Check class of first interface ..." - set config(class) [IfClass 0] - if {$iface < 0} { - Log " No access to interface 0. Exit" - SafeExit - } - Log " Interface class is $config(class)." - if {$config(class) == "08" || $config(class) == "03"} { - } else { - Log "No install mode found. Aborting" - exit - } +Log "Check class of first interface ..." +set config(class) [IfClass 0 $devdir] +if {$config(class) < 0} { + Log " No access to interface 0. Exit" + SafeExit } -set ifdir [file tail [IfDir $iface]] +Log " Interface 0 class is $config(class)." + +set ifdir [file tail [IfDir $iface $devdir]] regexp {:([0-9]+\.[0-9]+)$} $ifdir d iface set flags(logwrite) 1 @@ -250,7 +243,7 @@ foreach mconfig $configList { Log "Check config: $mconfig" if [MatchDevice $mconfig] { Log "! matched. Read config data" - set flags(config) $mconfig +# set flags(config) $mconfig if [string length $usb(busnum)] { set busParam "-b [string trimleft $usb(busnum) 0]" set devParam "-g [string trimleft $usb(devnum) 0]" @@ -355,7 +348,7 @@ if [regexp {ok:busdev} $report] { # Checking for bound drivers if there is an interface with class 0xff if {$config(DriverModule) != "" && [regexp {ok:} $report]} { - if [HasFF] { + if [HasFF $devdir] { AddToList link_list $usb(idVendor):$usb(idProduct) } else { set config(DriverModule) "" @@ -724,7 +717,7 @@ if $flags(logwrite) { proc {SafeExit} {} { global flags -set $flags(logwrite) 1 +set flags(logwrite) 1 Log "" exit @@ -987,8 +980,12 @@ close $lc proc {CheckSuccess} {devdir} { global config usb flags -set ifdir [file tail [IfDir 0]] +# For Cisco AM10, target device not on same port +if {$usb(idVendor) == "1307" && $usb(idProduct) == "1169"} { + set devdir [string range $devdir 0 end-1]2 +} +set ifdir [file tail [IfDir 0 $devdir]] if {[string length $config(TargetClass)] || [string length $config(Configuration)]} { set config(TargetVendor) $usb(idVendor) set config(TargetProduct) $usb(idProduct) @@ -1004,7 +1001,7 @@ for {set i 1} {$i <= $config(CheckSuccess)} {incr i} { } else { Log " Read attributes ..." } - set ifdir [IfDir 0] + set ifdir [IfDir 0 $devdir] if {$ifdir == ""} {continue} set ifdir [file tail $ifdir] if {![ReadUSBAttrs $devdir $ifdir]} { @@ -1050,9 +1047,8 @@ if {$i > 20} {return 0} else {return 1} # end of proc {CheckSuccess} -proc {IfDir} {iface} { +proc {IfDir} {iface devdir} { -global devdir set allfiles [glob -nocomplain $devdir/*] set files [glob -nocomplain $devdir/*.$iface] if {[llength $files] == 0} { @@ -1067,9 +1063,9 @@ return $ifdir } # end of proc {IfDir} -proc {IfClass} {iface} { +proc {IfClass} {iface devdir} { -set ifdir [IfDir $iface] +set ifdir [IfDir $iface $devdir] if {![file exists $ifdir/bInterfaceClass]} { return -1 @@ -1188,10 +1184,10 @@ if $flags(logging) { } -proc {HasFF} {} { +proc {HasFF} {devdir} { set i 0 -while {[set dir [IfDir $i]] != ""} { +while {[set dir [IfDir $i $devdir]] != ""} { set c [exec cat $dir/bInterfaceClass] if {$c == "ff"} {return 1} incr i -- 2.11.4.GIT