USB Host mode for Desire

Search This thread

gr0gmint

Senior Member
Feb 23, 2008
64
7
Hi,
I've applied Sven Killig's patches to a 2.6.32 kernel similiar to DeFroST 0.9b with no-echo patches.
Kernel update attached. I didn't do anything, please thank Sven Killig for his awesome work.

r2: Some often used USB modules included. (USB storage built-in)
r3: Modules are loading now
r4: Fix for error -14 included

THERE IS NO GUARANTEE THIS WILL WORK
GUIDE, IF YOU WANNA TRY IT OUT:
1. Flash kernel
2. Go into Terminal emulator and write the following:
insmod /system/lib/modules/usbcore.ko
insmod /system/lib/modules/ehci-hcd.ko
3. Load any other modules you want, ie. usb-storage.ko


To "un host", just flash the kernel from DeFRoST 0.9b
 

Attachments

  • usbhost_r4.zip
    5.4 MB · Views: 13,732
Last edited:

totzkotz

Senior Member
Apr 30, 2010
74
1
hm do you have create kernel modules or are the patches integrated in the kernel image itself?
with modules we simply are able to write a script or an app for switching from host mode to slave and back aren't we?
 

gr0gmint

Senior Member
Feb 23, 2008
64
7
hm do you have create kernel modules or are the patches integrated in the kernel image itself?
with modules we simply are able to write a script or an app for switching from host mode to slave and back aren't we?

I forgot to include support for some basic USB functions; storage and so on. Thanks for reminding me. I will compile them as modules to begin with
 

rexmundo

Member
May 27, 2010
25
0
nice ;)

Hi
I ordered my cable as soon as I saw Sven's vid last week and it arrived, just on time this morning.

I would however appreciate a brief how to..
I can understand up to the patching bit... I have the dual power USB cable and I am going to grab a self powered hub tomorrow. What I am not sure about is how to mount stuff onto android.
Is it like the usual linux mount commants? Will something like estrong file mananger pick up the new partition and show it (for USB stick).

Anyone tried a mouse? Keyboard?

cheers

rex
 

uipe

Member
Jan 29, 2010
18
2
Leiria
I am trying to test this but I havent been able to use adb wifi so that i dont have to write all the commands in the desire console :S any tip ?
the only module i tried to load was "insmod drivers/usb/core/usbcore.ko" and it said it couldnt find it (i am followying sven guide)
 

gr0gmint

Senior Member
Feb 23, 2008
64
7
I am trying to test this but I havent been able to use adb wifi so that i dont have to write all the commands in the desire console :S any tip ?
the only module i tried to load was "insmod drivers/usb/core/usbcore.ko" and it said it couldnt find it (i am followying sven guide)

You can use ConsoleBot, if it comes to it. But i am very sure i included usbcore as a part of the kernel, instead of as a module. And also, the modules are installed in /system/lib/modules, not "drivers/usb*etc" ..

I hope it works :eek: Good luck
 

JDouce

Senior Member
May 7, 2009
244
55
Pontefract
is there any posibility of mode switching?
would simply reflashing the non host kernel remove host moda and put back to slave mode?
if it can its not too inconveniant but requires a reboot every time you want to change mode...
using rom manager u can quickly apply the update.zip's tho
 

uipe

Member
Jan 29, 2010
18
2
Leiria
Oki here is what I am doing
I had the desire with DeFrost 0.9b, then when to fake-flash recovery and aplayed your kernel.
I have the OTG cable connected to a self powered usb hub and tried connecting bought a mouse and a pen but non of them were detected in dmesg.
The good and/or strange part is that I haven't lost the adb or usb mass storage mode of the phone.
 

gr0gmint

Senior Member
Feb 23, 2008
64
7
Oki here is what I am doing
I had the desire with DeFrost 0.9b, then when to fake-flash recovery and aplayed your kernel.
I have the OTG cable connected to a self powered usb hub and tried connecting bought a mouse and a pen but non of them were detected in dmesg.
The good and/or strange part is that I haven't lost the adb or usb mass storage mode of the phone.

I'll look into it, hold on. I may have configured the kernel wrong.

EDIT: At the moment it will require a reflash of the kernel everytime you need hostmode. Updating kernel in a moment :( I'm looking into writing OTG support for the device, so switching between slave/host mode is automatic or easy at least.
 
Last edited:

lambrospower

Senior Member
Jul 5, 2009
508
2
Nicosia
www.mastergenius.net
Hi,
I've applied Sven Killig's patches to a 2.6.32 kernel similiar to DeFroST 0.9b with no-echo patches.
Kernel update attached. I didn't do anything, please thank Sven Killig for his awesome work.

r2: Some often used USB modules included. (USB storage built-in)
r3: Modules are loading now

GUIDE:
1. Flash kernel
2. Go into Terminal emulator and write the following:
insmod /system/lib/modules/usbcore.ko
insmod /system/lib/modules/ehci-hcd.ko
3. Load any other modules you want, ie. usb-storage.ko


To "un host", just flash the kernel from DeFRoST 0.9b

since i have the MCR3.1 what kernel should i flash after this to un host ???? or it must be 2.2 ???
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    Hi,
    I've applied Sven Killig's patches to a 2.6.32 kernel similiar to DeFroST 0.9b with no-echo patches.
    Kernel update attached. I didn't do anything, please thank Sven Killig for his awesome work.

    r2: Some often used USB modules included. (USB storage built-in)
    r3: Modules are loading now
    r4: Fix for error -14 included

    THERE IS NO GUARANTEE THIS WILL WORK
    GUIDE, IF YOU WANNA TRY IT OUT:
    1. Flash kernel
    2. Go into Terminal emulator and write the following:
    insmod /system/lib/modules/usbcore.ko
    insmod /system/lib/modules/ehci-hcd.ko
    3. Load any other modules you want, ie. usb-storage.ko


    To "un host", just flash the kernel from DeFRoST 0.9b
    1
    Thanks m8 I recieved the OTG cable yesterday so I will try to test this tonight ;)
    1
    Oh, I just realized, if you do the
    git clone git://github.com/teamdesire/cm-kernel.git
    you probably won't get the 2.6.35.7 Kernel version anymore... either check out that version explicitly or just replace "2.6.35.7" by the version number you have anywhere it pops up...
    Sven Killing's patch probably still works... not sure though ;)
    1
    Hey guys,

    sorry I didn't answer for a while, I guess the notification E-Mail must have been filtered out by my spam filter and I didn't check for a while... Here's what I did to get FTDI running:

    1. Get the 2.6.35.7 Kernel source from
    git clone git://github.com/teamdesire/cm-kernel.git
    cd cm-kernel

    2. Apply the Hostmode Patch:
    http://sven.killig.de/android/N1/2.2/usb_host/android-kernel_msm-bca5320_Nexus-One_usb-host.patch

    3. Activate Hostmode in the config. Either manually with

    make cyanogen_bravo_defconfig
    to get the standard config and then

    make menuconfig
    to customize

    or you can take my .config file (see attachment)

    4. compile:

    make

    5. Take a Kernelimage, (I took cm_default.zip from the third post of the seventh page of this thread, http://forum.xda-developers.com/attachment.php?attachmentid=421496&d=1287359589) and unzip it.

    6. Replace the kernel/zImage from the zip file with the zImage which you find in:
    cm-kernel/arch/arm/boot

    7. Copy new kernel modules into the folder to zip:
    - cd to system/lib/modules
    - create a folder: 2.6.35.7-cyanogenmod
    - create subfolder: kernel
    - copy all needed kernel modules which you find in your kernel source for example under "drivers/usb/" into the new folders, but keep the folder structure intact.
    - Files you need for Hostmode:
    drivers/usb/core/usbcore.ko
    drivers/usb/host/ehci-hcd.ko
    drivers/usb/serial/usbserial.ko
    drivers/usb/serial/ftdi_sio.ko

    I also copied all other modules which were included with the "cm_default.zip" into it's corresponding folders, though I'm not sure if they are needed.

    8. Zip the folder
    zip -r <YOUR_ZIPNAME.zip> kernel META-INF system

    9. Copy onto your device's sdcard

    10. Start in Recovery

    11. Apply zip from sdcard
    -> Select your ZIP file

    12. Reboot

    13. Now you need a terminal connection. Unfortunately that does not work any longer via USB, because it's now running only hostmode. There is a solution using "adbWireless" just install that from the marked and you can connect to your phone via WLAN using:
    adb connect <PHONE'S IP>:5555
    adb shell

    14. In a shell enter the following:
    su
    cd /system/lib/modules/2.6.35.7-cyanogenmod/kernel/drivers
    /system/bin/insmod usb/core/*
    /system/bin/insmod usb/host/*
    /system/bin/insmod usb/serial/usb*
    /system/bin/insmod usb/serial/ftdi*

    you should write a shell script for this, b/c it's annoying to do this by hand every time :D

    15. now the modules should be loaded.

    I also attached my kernel-image file, so you don't need to compile.

    I am currently working on writing a wrapper program for the FTDI device, since you need SU rights to control a ftdi device and there's no way to enable that for a Java app. I am using libftdi for this which works good so far.

    I hope I was able to help you.

    -Tim

    Hey there Mastaxlokks! Ive been trying to use your instructions to modify a kernel, but could not understand how to apply sven killings patch. Could you please clarify that?

    Thanks in advance
    1
    I haven tried to compile that kernel, but the old kernel patch does not work for 2.6.35.9, so I'm sure it won't work with your Kernel either.
    I found some other patch which I had to modify slightly, but now works with my kernel. You could try if it also works for your kernel. You'll find it attached.

    You will then need to download the kernel source:

    mkdir -p ~/android/kernel
    cd ~/android/kernel
    git clone git://github.com/teamdesire/cm-kernel.git
    cd cm-kernel
    git checkout android-msm-2.6.37-unified

    The rest should work like I explained in a previous post:
    http://forum.xda-developers.com/showpost.php?p=12083199&postcount=117

    Just replace the kernel checkout with the above and take the attached patch instead of the old one...

    You can manually configure your Kernel, or try my config file for my 2.6.35.9 kernel which I attached. (It is named .config_host after unzipping, so it'll probably be invisible)

    Hope this works for you.
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone