Opened 9 years ago

Closed 9 years ago

#12051 closed enhancement (fixed)

usb_modeswitch.cpp missing several devices

Reported by: haiqu Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Add-Ons Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by humdinger)

The following devices need to be added to src/add-ons/kernel/drivers/common/usb_modeswitch.cpp

Huawei E5377 USB modem/router Huawei HWD12 LTE USB modem stick

The required code follows:

{ /* MSG_HUAWEI_4 */
0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,
0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x0a, 0x11,
0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},

...

	{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f02}, MSG_HUAWEI_3}, // E5377
	{{ 0, 0, 0, HUAWEI_VENDOR, 0x1f03}, MSG_HUAWEI_4}, // HWD12 LTE

I also note that this file object isn't being created, but I'm fairly unfamiliar with Jam so can't debug it at this stage. Consequently this functionality is missing from the build.

Attachments (5)

modeswitch.patch (1.6 KB ) - added by haiqu 9 years ago.
modeswitch.2.patch (1.6 KB ) - added by haiqu 9 years ago.
Add Huawei devices
enable_usb_modeswitch.patch (1.2 KB ) - added by haiqu 9 years ago.
Patch to enable usb_modeswitch code in build
0001-Add-new-Huawei-modems-to-usb_modeswitch-and-enable.patch (3.3 KB ) - added by haiqu 9 years ago.
0001-Update-Huawei-in-usb_modeswitch.patch (7.3 KB ) - added by haiqu 9 years ago.

Download all attachments as: .zip

Change History (21)

comment:1 by haiqu, 9 years ago

Note: The C style comment (double-slash) was interpreted above as italics. The terms E5377 and HWD12 LTE were actually comments, not to be included as code.

comment:2 by haiqu, 9 years ago

Argh. The above code contains an error. Should be:

{ /* MSG_HUAWEI_4 */

0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x0a, 0x11, 0x06, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

},

comment:3 by humdinger, 9 years ago

Description: modified (diff)

I edited the ticket description. You can use Preformatted Text for code snippets.

comment:4 by haiqu, 9 years ago

Thanks humdinger. I've finally figured out how to use 'git diff' so am attaching a patch for this one. Cheers!

by haiqu, 9 years ago

Attachment: modeswitch.patch added

comment:5 by haiqu, 9 years ago

OK, just checked several more websites and it appears the string supplied for the HWD12 LTE was incorrect. New patch attached.

by haiqu, 9 years ago

Attachment: modeswitch.2.patch added

Add Huawei devices

comment:6 by haiqu, 9 years ago

patch: 01

in reply to:  4 comment:7 by humdinger, 9 years ago

Replying to haiqu:

Thanks humdinger. I've finally figured out how to use 'git diff' so am attaching a patch for this one. Cheers!

You're on the right way. :)
To be perfect, please have a look at this wiki page on how to submit a formatted patch. That will include your name and the commit message and makes everything easier and repoducible. Thanks!

comment:8 by haiqu, 9 years ago

Since I don't have commit access, this is the only way I can send changes. I've set git.name and git.email locally and patches still don't contain that information.

Here's the patch to enable the modeswitch for jam. Untested, the current build fails just after target 5300.

by haiqu, 9 years ago

Attachment: enable_usb_modeswitch.patch added

Patch to enable usb_modeswitch code in build

in reply to:  8 comment:9 by humdinger, 9 years ago

Replying to haiqu:

Since I don't have commit access, this is the only way I can send changes. I've set git.name and git.email locally and patches still don't contain that information.

You have to create a patch with "git format-patch" as described in the wiki I linked above.

comment:10 by haiqu, 9 years ago

Yeah, read that page. Couldn't make any sense of it at all.

CVS and SVN may not have been as good, but at least I could use them.

comment:11 by haiqu, 9 years ago

OK, I think I've got this. Added, committed and patch generated ...

comment:12 by haiqu, 9 years ago

Tested patch today and it appears to be entirely successful:

  • E5377 device no longer appears as a USB stick on the desktop
  • turning off device no longer causes OS to drop into KDL
  • device appears in /dev/bus/usb tree correctly

Can't really test any further until we get the TCP/IP glue to USB devices.

comment:13 by korli, 9 years ago

Thanks for the patch. Did you have a look at latest usb-modeswitch-data? It seems they switched for a lot of devices to a simple message (Huawei new mode):

{ 
0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11,
0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
},

It would be nice if you could check this and add similar Huawei devices IDs: 0x1f11, 0x1f15, 0x1f16, 0x1f17, 0x1f18, 0x1f19, 0x1f1b, 0x1f1c, 0x1f1d, 0x1f1e.

comment:14 by haiqu, 9 years ago

Yes, that would make for a better patch, I agree. I actually got the data from a site specializing in the Raspberry Pi, which uses the same code interactively from the terminal. I did download part of the BSD package yesterday (the data part only, since I was interested in other devices) and noticed that they had new information direct from Huawei, but as yet haven't investigated this further. I'll get onto it and submit a new patch.

I also note that there is an existing driver called kernel/drivers/network/usb_ecm which *should* enable networking on this device once switched, but doesn't seem to do so. I'm thinking that maybe the device isn't being rescanned and added to the device tree after the modeswitch occurs but haven't yet looked further into that aspect.

comment:15 by haiqu, 9 years ago

korli: OK, I've redone this patch. Now all Huawei devices from the latest docs are included, and the switch method used is the one recommended by the manufacturer.

Previous patches can be ignored, I did a reset of the local git repository before generating this one.

comment:16 by korli, 9 years ago

Resolution: fixed
Status: newclosed

Applied in hrev49165. Thanks!

Note: See TracTickets for help on using tickets.