recognize the HuaeiNewMode and StandardEject options
authorJohn Crispin <blogic@openwrt.org>
Thu, 17 Jul 2014 19:22:45 +0000 (20:22 +0100)
committerJohn Crispin <blogic@openwrt.org>
Thu, 17 Jul 2014 20:02:50 +0000 (21:02 +0100)
Signed-off-by: John Crispin <blogic@openwrt.org>
convert-modeswitch.pl [changed mode: 0644->0755]
switch.c

old mode 100644 (file)
new mode 100755 (executable)
index 97f1d7b..8086e53
@@ -60,6 +60,7 @@ my %options = (
        WaitBefore => [ ],
        DetachStorageOnly => [ ],
        HuaweiMode => $mode_option,
        WaitBefore => [ ],
        DetachStorageOnly => [ ],
        HuaweiMode => $mode_option,
+       HuaweiNewMode => $mode_option,
        SierraMode => $mode_option,
        SonyMode => $mode_option,
        QisdaMode => $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,
        SequansMode => $mode_option,
        MobileActionMode => $mode_option,
        CiscoMode => $mode_option,
+       StandardEject => $mode_option,
        NoDriverLoading => [],
        MessageEndpoint => $hex_option,
        ReleaseDelay => [],
        NoDriverLoading => [],
        MessageEndpoint => $hex_option,
        ReleaseDelay => [],
index 763acfa..b8fe88e 100644 (file)
--- 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);
 }
 
        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;
 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,
 enum {
        MODE_GENERIC,
        MODE_HUAWEI,
+       MODE_HUAWEINEW,
        MODE_SIERRA,
        MODE_SIERRA,
+       MODE_STDEJECT,
        MODE_SONY,
        MODE_QISDA,
        MODE_GCT,
        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 },
        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_HUAWEI] = { "Huawei", handle_huawei },
+       [MODE_HUAWEINEW] = { "HuaweiNew", handle_huaweinew },
        [MODE_SIERRA] = { "Sierra", handle_sierra },
        [MODE_SONY] = { "Sony", handle_sony },
        [MODE_QISDA] = { "Qisda", handle_qisda },
        [MODE_SIERRA] = { "Sierra", handle_sierra },
        [MODE_SONY] = { "Sony", handle_sony },
        [MODE_QISDA] = { "Qisda", handle_qisda },