Skip to content

Commit

Permalink
Update Huawei in usb_modeswitch
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Duval <jerome.duval@gmail.com>
  • Loading branch information
haiqu authored and korli committed May 12, 2015
1 parent c2bc264 commit b4c4664
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 31 deletions.
2 changes: 1 addition & 1 deletion build/jam/packages/Haiku
Expand Up @@ -68,7 +68,7 @@ AddNewDriversToPackage power : $(SYSTEM_ADD_ONS_DRIVERS_POWER) ;
#AddNewDriversToPackage display : display_adapter@x86 ;

# legacy drivers
AddDriversToPackage : console dprintf null <driver>tty zero ;
AddDriversToPackage : console dprintf null <driver>tty usb_modeswitch zero ;
AddDriversToPackage audio hmulti : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO) ;
AddDriversToPackage audio old : $(SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD) ;
AddDriversToPackage midi : $(SYSTEM_ADD_ONS_DRIVERS_MIDI) ;
Expand Down
80 changes: 50 additions & 30 deletions src/add-ons/kernel/drivers/common/usb_modeswitch.cpp
Expand Up @@ -8,6 +8,7 @@

/*
Devices and messages reference: usb-modeswitch-data-20100826
Huawei devices updated to usb-modeswitch-data-20150115
*/

#include <ByteOrder.h>
Expand Down Expand Up @@ -64,7 +65,7 @@ unsigned char kDevicesMsg[][31] = {
{ /* MSG_HUAWEI_3 */
0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11,
0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},
{ /* MSG_NOKIA_1 */
Expand Down Expand Up @@ -122,7 +123,7 @@ unsigned char kDevicesMsg[][31] = {
#define NOKIA_VENDOR 0x0421
#define NOVATEL_VENDOR 0x1410
#define ZYDAS_VENDOR 0x0ace
#define ZTE_VENDOR 0x19d2
#define ZTE_VENDOR 0x19d2
#define OLIVETTI_VENDOR 0x0b3c
#define OPTION_VENDOR 0x0af0
#define ATHEROS_VENDOR 0x0cf3
Expand All @@ -133,33 +134,52 @@ static const struct {
msgType type, type2, type3;
} kDevices[] = {
{{ 0, 0, 0, HUAWEI_VENDOR, 0x101e}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1446}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1449}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14ad}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14b5}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14b7}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14ba}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14c1}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14c3}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14c4}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14c5}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14d1}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x14fe}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1505}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x151a}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1520}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1521}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1523}, MSG_HUAWEI_1},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1526}, MSG_HU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_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f16}, MSG_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f17}, MSG_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f18}, MSG_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f19}, MSG_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1b}, MSG_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1c}, MSG_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1d}, MSG_HUAWEI_3},
{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f1e}, MSG_HUAWEI_3},
{{ 0, 0, 0, NOKIA_VENDOR, 0x060c}, MSG_NOKIA_1},
{{ 0, 0, 0, NOKIA_VENDOR, 0x0610}, MSG_NOKIA_1},
{{ 0, 0, 0, NOKIA_VENDOR, 0x061d}, MSG_NOKIA_1},
Expand Down Expand Up @@ -388,7 +408,7 @@ my_get_msg_type(const usb_device_descriptor *desc, int index)
case 2:
return kDevices[i].type3;
}

}

return MSG_NONE;
Expand All @@ -412,7 +432,7 @@ my_modeswitch(my_device* device)
TRACE_ALWAYS("send message %d failed\n", i + 1);
return err;
}

TRACE("device switched: %p\n", device);

char data[36];
Expand All @@ -422,9 +442,9 @@ my_modeswitch(my_device* device)
i + 1, device->status);
return err;
}
TRACE("device switched (response length %ld)\n", device->actual_length);
TRACE("device switched (response length %ld)\n", device->actual_length);
}

TRACE("device switched: %p\n", device);

return B_OK;
Expand Down

0 comments on commit b4c4664

Please sign in to comment.