Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add usb_configuration and usb_connected switches
- Loading branch information
Showing
2 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?... tethering? USB host?
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's some code backported from the 2.6.35 kernel for USB tethering, yes.
In order for it to work properly, you also need to compile netd with a custom USBController.cpp implementation that takes into account the proper USB product IDs for tethered and untethered states. My phone uses ID 1038 for untethered and 1039 for tethered (RNDIS), and the code is here: https://github.com/psyke83/android_device_huawei_u8160/blob/master/UsbController.cpp
You can check your phone's product IDs by looking at board-msm7225.c and/or checking the output of /sys/module/g_android/parameters/product_id while tethered/untethered (the former would require you to test on a stock ROM, I guess). I have a strong suspicion that your U8150 will use the same IDs, however.
Don't forget to define the custom controller code in your BoardConfig.mk. Mine is like so:
BOARD_CUSTOM_USB_CONTROLLER := ../../device/huawei/u8160/UsbController.cpp
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, I remember you discussing this some weeks ago in the U8150 CM7 thread on XDA... 1038 looks familiar to me, I'm pretty sure I've seen that in my udev rules (among the dozen I have for oddball devices). I'll port this to U8150 when I get some time to test. Adios!
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think tilal's got it working in our U8150 but I haven't tried, and his commits are a bit hard to follow :). I might ask for help in a bit.
On a related note, I keep seeing this error in logcat: D/Vold ( 117): USB mass storage support is not enabled in the kernel
Which I'm assuming is related to USB mounting of the sdcard on the host computer. I notice we don't have anything like CONFIG_USB_ANDROID_MASS_STORAGE=y in our kernel, so what could it be missing?
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See: http://forum.xda-developers.com/showpost.php?p=18168850&postcount=38
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got tethering working on linux. From next time I'll make commits clearer :)
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AHhahah future generations of hackers will thank you ;). I'll still keep pursuing it in my kernel/device tree so I can understand what's going on when I'm haxx0ring and troubleshooting.
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, my USB tethering is finally working. Actually it was working lastnight, I just had to rebuild CM with the new UsbController and reflash, but got busy.
My kernel patches to JoeyJiao's source are exactly the same as yours, but the changes were already present in the kernel (only commented out). Weird, eh? See: alanorth/android-huawei-kernel-common@482f13d
Thanks for the help. The tethering is buggy, but working; still gotta debug a bit.
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JoeyJiao added this same switch code to his kernel source, and then commented the code for some unknown reason.
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where'd you get yours?
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember where it came from exactly; I found it for another device's .32 kernel... perhaps the Blade ZTE. The code itself is from the 2.6.35 kernel.
039582a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It must have been this one: https://www.codeaurora.org/gitweb/quic/la/?p=kernel/common.git;a=commit;h=3fa64c7f7fc44d88bfbb6cb925882017850c0c69
Just poring through the msm 2.6.35 for interesting patches and I saw that :)