HTC Desire
HTC Desire Patches
My work on the USB Hostmode for the HTC Desire is based on the patch provided by Sven Killig for the Nexus one:
http://sven.killig.de/android/N1/2.2/usb_host/
Basically Sven’s patch also works for the HTC Desire. However since there has been a small change in the Kernel API for Kernel 3.6.37, I had to amend one line of the patch in order to make it work on the new kernel version.
Downloads:
Patches Available:
- Patch for Kernel 2.6.37
- Patch for Kernel 2.6.35
- Patch WLAN to not go to sleep when Display is turned off
- 2.6.37 cyanogen 7.x Kernel Patched with USB Host
This Kernel is configured without the WLAN-no-sleep patch. Feel free to contact me if you need a kernel with this patch applied. - 2.6.37 cyanogen 7.x Kernel with multicasting enabled
This Kernel is like the Cyanogen kernel, but has the multicasting feature enabled - 2.6.37 cyanogen 7.x Kernel with WLAN no sleep patch
This Kernel is like the Cyanogen Kernel but has the WLAN no sleep patch applied
Even though I did not have any problems with these patches and kernels so far, I cannot guarantee for any damage to your devices. Applying the provided kernel or any of the patches to your device and following any guide I provide happens on your own risk.
Using the Host mode
In my version of the Kernel, USB host mode is only available as a kernel module. I also had a version of the Kernel, where it was compiled right in the kernel but that resulted in having to connect at least a USB hub before booting the device. The advantage of using modules is that it is only required to connect the USB device before inserting the module into the kernel.
To load Hostmode, enter the following lines in a shell on your Desire:
insmod /system/lib/modules/$(uname -r)/kernel/drivers/usb/core/usbcore.ko insmod /system/lib/modules/$(uname -r)/kernel/drivers/usb/host/ehci-hcd.ko
Connecting a USB mass storage device
After installing the above kernel you can connect USB mass storage to your HTC-Desire.
Connect your USB mass storage device to your HTC-Desire
Open a shell and enter:
insmod /system/lib/modules/$(uname -r)/kernel/drivers/usb/core/usbcore.ko insmod /system/lib/modules/$(uname -r)/kernel/drivers/usb/host/ehci-hcd.ko insmod /system/lib/modules/$(uname -r)/kernel/drivers/scsi/scsi_wait_scan.ko insmod /system/lib/modules/$(uname -r)/kernel/drivers/scsi/scsi_mod.ko insmod /system/lib/modules/$(uname -r)/kernel/drivers/scsi/sd_mod.ko insmod /system/lib/modules/$(uname -r)/kernel/drivers/usb/storage/usb-storage.ko
Navigate to /dev/block and check if you have a sda1 in there. This is of course only for the first mass storage device. The second one is called sdb1 and so on. The following assumes that we take the first device. For all other devices, you will have to adjust the guide a little bit.
Load the filesystems:
insmod /system/lib/modules/$(uname -r)/kernel/fs/ntfs.ko insmod /system/lib/modules/$(uname -r)/kernel/fs/msdos.ko
So far, I only included FAT and NTFS as modules. Ext4 is built in. If you need any other file systems, please ask below in the comments area and I can compile them for you.
To mount your disk, you first need a folder you want to mount into. I chose to create a folder “mnt” on my sdcard. Then issue one of the following commands:
mount -t vfat /dev/block/sda1 /mnt/sdcard/mnt/ mount -t ntfs /dev/block/sda1 /mnt/sdcard/mnt/
depending on weather you have a NTFS of FAT Filesystem.
Now you should be able to access the files on your USB mass storage device.
WLAN sleep off
In my scenario, I need the WLAN to be running all the time without switching to sleep. This is only necessary if you are connecting to an ad-hoc network. In a managed network the base station will make sure you still receive the packets, even if the WLAN goes to sleep.
I wrote a small patch, that simply disables the sleeping function of the WLAN driver. It can be found above.
-
-
#96 geschrieben von renderit vor 4 Monaten
Another trouble,sorry, about usbnet.After load mii.ko usbnet.ko and asix.ko, disable wifi, I think I would have a ether net ( I type “netcfg” in terminal console) ,but none.
Any tips? Wish my endless question not put you too much trouble. IMO, after load the mdules, plug in a usb to RJ45,config IP, then I can use network. -
#98 geschrieben von Tim vor 4 Monaten
Hey,
you were right, there was just one codepage and charset compiled into the kernel. Now I enabled all of them and recompiled the kernel. You can download it above: http://tim.mactory.com/HTC_Desire/2.6.37_host_mod.zip
It also contains the mii.ko and the other two files needed for the usb networking.
If you figured out if the codepages now work, I would be glad if you reported back here
Thanks -
#99 geschrieben von renderit vor 4 Monaten
-
#100 geschrieben von Tim vor 4 Monaten
I don’t have your device and no experience weather it is possible to use it as USB-Host. If it has the same chipset as the Desire, the patches might work.
Maybe this Forum can help:
http://forum.xda-developers.com/showthread.php?t=1212437 -
#101 geschrieben von st11lgar vor 4 Monaten
-
#104 geschrieben von renderit vor 4 Monaten
Never mind.I prefer change the file name to match the filesystem.I just google that, one way is using “convmv “in a linux system to convert the coding of all the file name. Another way is making a ftp , upload my files to Desire,then the file name should be right. I think your kernel and the modules(except the usbnet.ko and asix.ko) work great,stable enough.Thanks very much.
-
#105 geschrieben von Tim vor 4 Monaten
Now there is something I have no Idea of. You will probably need to google that.
When compiling, I can specify a default iocharset and codepage for FAT, but no such options for NTFS. You might be able to change the charsets when loading the module or when mounting a disk, but like I said… you will need to google that.
-
#106 geschrieben von renderit vor 4 Monaten
The filesystem mudules has the -o specified build in,but this make things confused.Some file name coded with GBK(or GB2312),but other with UTF8,or Gig5.Only one of them can been displaced correctly.Could all those code page been supported,or can I specify the “-0 iocharset” and the codepage parameter when I mount the mass storage? Now, there are a lot of ? in my file name.
-
#109 geschrieben von renderit vor 4 Monaten
10G NTFS work too.A 10 G hard disk and a flash work at the same time too.
I found some file explorer can not seen any files in the NTFS disk,ie ,File Expert,IO About,But Root explorer work better.
40 G NTFS can mount ,but can not list all files( root exploere),as my test,only one file can been listed on my 40 G disk. -
#117 geschrieben von renderit vor 4 Monaten
Look at here,http://forum.xda-developers.com/archive/index.php/t-993152.html
torsrex wrote: wohoo! Now I got around 200gB on my phone! (yes you saw right, 200gB!). on Desire HD,
Make usb mass storage working on Desire is so Attractive for me , I am a newbie .
If usb mass storage work, then I can use my Desire as a file server for my Ipad. -
#119 geschrieben von Tim vor 4 Monaten
-
#121 geschrieben von renderit vor 4 Monaten
Now, I get a new hub,mouse work fine.but usb storage still not work.
I check the dmesg:
[ 476.845520] Initializing USB Mass Storage driver…
[ 476.846435] scsi0 : usb-storage 1-1.2:1.0
[ 476.851287] usbcore: registered new interface driver usb-storage
[ 476.851776] USB Mass Storage support registered.
[ 477.854522] scsi 0:0:0:0: Direct-Access IBM-DJSA -210 ABBA
PQ: 0 ANSI: 2 CCS
[ 870.375854] usb 1-1.4: new high speed USB device using msm_hsusb and addre
ss 4
[ 870.696441] scsi1 : usb-storage 1-1.4:1.0
[ 871.710205] scsi 1:0:0:0: Direct-Access aigo MiniKing 8.07
PQ: 0 ANSI: 2
_________________________________
_________________________________
There is no sda1 sda2 etc in the /dev , I think the kernel or the modules still lack something to support usb storage? -
#125 geschrieben von renderit vor 4 Monaten
yes,I resign your zip using a java tool(Auto-sign.zip),then flash successfully.Now my kernel version i 2.6.37-cyanogenmod+tim@VirtualBox #1.My phone can not used as a client now.Perhaps, I am near the end.
but I can not make my usb keyboard or usb storage work.
perhaps because of the chip of my hub(with a power) is not Compatible. I will try when I get a new hub tomorrow. -
#126 geschrieben von Tim vor 4 Monaten
Yes, you should be able to do that.
I Googled your problem and found this:
http://forum.xda-developers.com/showthread.php?p=10309975Seems like you need to disable signature verification in your recovery.
-
#127 geschrieben von renderit vor 4 Monaten
-
#130 geschrieben von Grzesiek vor 5 Monaten
-
#134 geschrieben von Grzesiek vor 5 Monaten
I also have Cyanogenmod 7.1.0 with kernel 2.6.37.6.
After using your patch usb device mode is completely lost.
Have you seen Andrew de Quincey’s patch (http://adq.livejournal.com/101420.html)? Maybe it would be possible to put it all together and apply to Cyanogen’s kernel?
I can try to help in some way, however I’m quite new to android development. -
#137 geschrieben von Tim vor 5 Monaten
Yes you can do that, but it will just unload the usb host mode. Since the host mode kernel does not include any android gadget usb support, you can’t switch between host and normal mode this way.
If you use rmmod you will just have a phone without any usb functionality.
I haven’t investigated wether it is possible to have android gadget mode as loadable module -
#139 geschrieben von Greg Hanford vor 6 Monaten
Hi Tim ,
Great work in this area I think you may be interested in what I have to say and possibly may want to help. I am doing a project involving a midi device ( midi music keyboard ) and want to connect it to my HTC Desire Bravo. I am having real big trouble as I have followed your instruction on the latest cyanogen V 7.1 and loaded the 2 modules for usb host so i can test it with a mouse to start with the usb host cable i got off amazon. It doesn’t work with the kernal loaded at recovery mode and was hoping you might be able to help me. Nobody seems to have a “out of the box” type of solution like you have and hope you can help me.
Regards,
Greg. -
-
#142 geschrieben von chross vor 7 Monaten
-
#144 geschrieben von chross vor 7 Monaten
-
#145 geschrieben von Tim vor 7 Monaten
Hey,
I would guess, that the 2.6.37 Patch also works for the 2.6.37.6 kernel. Have you tried that yet? I don’t know where to get the 2.6.37.6 Kernel. If you tell me where to get it, I could try compiling it.
You did not look properly above. There is a 2.6.37 Kernel without the WLAN no sleep patch: http://tim.mactory.com/HTC_Desire/2.6.37_host_mod.zip
-
-
#146 geschrieben von Tim vor 7 Monaten
Mmh.. I’ve never used the kernel with any other rom than cyanogen.
I don’t know if there is a difference between the kernels, but I don’t see why there would be.
There could be a problem with the 2.6.35 you are using, since I know that the 2.6.37 I use, does not work on the older cyanogen rom that uses 2.6.35 as standard kernel, since something changed with the wpa supplicant…I would say just try it. Beforehand make sure, that you have a working kernel image (or the image of your rom) on your SD card, so you can flash that again, if my kernel does not work. If you reflash your rom, I’m not sure however if it overwrites any of your data, so be sure to make a backup first.
I’ve added my older patch for the Kernel 2.6.35.9 to the page above. I’m not quite sure if it applies to the 2.6.35.9 Kernel correctly, because it was just something I quickly tried out. You could try compiling your own kernel for your rom.
-
- Kommentar-Feed für diesen Beitrag
Keine ähnlichen Beiträge gefunden :(
The built in ifconfig is somewhat broken. It does work but only limited. That’s why I installed a busy box on my own which includes a correctly working ifconfig.
I uploaded it here: http://tim.mactory.com/HTC_Desire/busybox.zip
Unzip, push it to your phone and execute e.g. to /data:
adb push busy box /data/busybox
Then run it with:
/data/busybox ifconfig
See what it tells you. You might also have to reconfigure the routes, but let’s start with seeing weather the network is found at all.