summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-07-17 20:22:45 +0100
committerJohn Crispin <blogic@openwrt.org>2014-07-17 21:02:50 +0100
commit01ecc3b9764d1dd89cf36ede0a2d98f9adb0cd33 (patch)
tree5fe446312fdcd3085ad0a37fb9823440f9ed43e6
parent575c8e8dec6d1f544debe867ebc0bde051209c17 (diff)
recognize the HuaeiNewMode and StandardEject options
Signed-off-by: John Crispin <blogic@openwrt.org>
-rwxr-xr-x[-rw-r--r--]convert-modeswitch.pl2
-rw-r--r--switch.c35
2 files changed, 37 insertions, 0 deletions
diff --git a/convert-modeswitch.pl b/convert-modeswitch.pl
index 97f1d7b..8086e53 100644..100755
--- a/convert-modeswitch.pl
+++ b/convert-modeswitch.pl
@@ -60,6 +60,7 @@ my %options = (
WaitBefore => [ ],
DetachStorageOnly => [ ],
HuaweiMode => $mode_option,
+ HuaweiNewMode => $mode_option,
SierraMode => $mode_option,
SonyMode => $mode_option,
QisdaMode => $mode_option,
@@ -68,6 +69,7 @@ my %options = (
SequansMode => $mode_option,
MobileActionMode => $mode_option,
CiscoMode => $mode_option,
+ StandardEject => $mode_option,
NoDriverLoading => [],
MessageEndpoint => $hex_option,
ReleaseDelay => [],
diff --git a/switch.c b/switch.c
index 763acfa..b8fe88e 100644
--- a/switch.c
+++ b/switch.c
@@ -137,6 +137,37 @@ static void handle_huawei(struct usbdev_data *data, struct blob_attr **tb)
send_control_packet(data, type, LIBUSB_REQUEST_SET_FEATURE, 1, 0, 0);
}
+static void handle_huaweinew(struct usbdev_data *data, struct blob_attr **tb)
+{
+ static struct msg_entry msgs[] = {
+ {
+ "\x55\x53\x42\x43\x12\x34\x56\x78\x00\x00\x00\x00\x00\x00\x00\x11"
+ "\x06\x20\x00\x00\x01\x01\x00\x01\x00\x00\x00\x00\x00\x00\x00", 31
+ }
+ };
+
+ detach_driver(data);
+ data->need_response = false;
+ send_messages(data, msgs, ARRAY_SIZE(msgs));
+}
+
+static void handle_standardeject(struct usbdev_data *data, struct blob_attr **tb)
+{
+ static struct msg_entry msgs[] = {
+ {
+ "\x55\x53\x42\x43\x12\x34\x56\x78\x00\x00\x00\x00\x00\x00\x06\x1e"
+ "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 31
+ }, {
+ "\x55\x53\x42\x43\x12\x34\x56\x79\x00\x00\x00\x00\x00\x00\x06\x1b"
+ "\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 31
+ }
+ };
+
+ detach_driver(data);
+ data->need_response = true;
+ send_messages(data, msgs, ARRAY_SIZE(msgs));
+}
+
static void handle_sierra(struct usbdev_data *data, struct blob_attr **tb)
{
int type = LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE;
@@ -300,7 +331,9 @@ static void set_alt_setting(struct usbdev_data *data, int setting)
enum {
MODE_GENERIC,
MODE_HUAWEI,
+ MODE_HUAWEINEW,
MODE_SIERRA,
+ MODE_STDEJECT,
MODE_SONY,
MODE_QISDA,
MODE_GCT,
@@ -316,7 +349,9 @@ static const struct {
void (*cb)(struct usbdev_data *data, struct blob_attr **tb);
} modeswitch_cb[__MODE_MAX] = {
[MODE_GENERIC] = { "Generic", handle_generic },
+ [MODE_STDEJECT] = { "StandardEject", handle_standardeject },
[MODE_HUAWEI] = { "Huawei", handle_huawei },
+ [MODE_HUAWEINEW] = { "HuaweiNew", handle_huaweinew },
[MODE_SIERRA] = { "Sierra", handle_sierra },
[MODE_SONY] = { "Sony", handle_sony },
[MODE_QISDA] = { "Qisda", handle_qisda },