From: John Crispin Date: Thu, 17 Jul 2014 19:22:45 +0000 (+0100) Subject: recognize the HuaeiNewMode and StandardEject options X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=01ecc3b9764d1dd89cf36ede0a2d98f9adb0cd33;p=project%2Fusbmode.git recognize the HuaeiNewMode and StandardEject options Signed-off-by: John Crispin --- diff --git a/convert-modeswitch.pl b/convert-modeswitch.pl old mode 100644 new mode 100755 index 97f1d7b..8086e53 --- 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 },