USB Host mode on Defy

Search This thread

hackergnome

Senior Member
Apr 21, 2011
2,613
875
Bengaluru
Did it work only only on android 2.1?

walter have u tried this??
i cant get otg cable! f***
asking all mah friends!
guess have to buy one!

Sent from my MB525 using xda premium

---------- Post added at 04:52 PM ---------- Previous post was at 03:53 PM ----------

Hmm doing something wrong!!

# sh ./USBOTG.sh
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/scsi_mod.ko' failed (Exec format error)
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/sd_mod.ko' failed (Exec format error)
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/usb-storage.ko' failed (Exec format error)
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/ntfs.ko' failed (Exec format error)
wait 20s...............Segmentation fault (core dumped)

mount done, enter exit to umount
./USBOTG.sh: line 45: /data/data/de.schaeuffelhut.android.openvpn/confs/busybox: not found
umount: can't forcibly umount /sdcard/mnt/*: No such file or directory
#


Is busybox so important anyway will edit the script and try with correct busybox path...
i kept the .ko files at correct place though...





EDiT it works after changing busy box path!!

On cm9 I see sdcard/mnt but I don't have otg cable so can't say it works completely!!

ql5aasi5

xPROTc0F

Zaklsp5z
 
Last edited:
  • Like
Reactions: Gafanhotz

sykoism

Senior Member
Oct 5, 2011
105
26
walter have u tried this??
i cant get otg cable! f***
asking all mah friends!
guess have to buy one!

Sent from my MB525 using xda premium

---------- Post added at 04:52 PM ---------- Previous post was at 03:53 PM ----------

Hmm doing something wrong!!

# sh ./USBOTG.sh
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/scsi_mod.ko' failed (Exec format error)
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/sd_mod.ko' failed (Exec format error)
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/usb-storage.ko' failed (Exec format error)
insmod: init_module '/data/data/com.teslacoilsw.quicksshd/home/ko/ntfs.ko' failed (Exec format error)
wait 20s...............Segmentation fault (core dumped)

mount done, enter exit to umount
./USBOTG.sh: line 45: /data/data/de.schaeuffelhut.android.openvpn/confs/busybox: not found
umount: can't forcibly umount /sdcard/mnt/*: No such file or directory
#


Is busybox so important anyway will edit the script and try with correct busybox path...
i kept the .ko files at correct place though...





EDiT it works after changing busy box path!!

On cm9 I see sdcard/mnt but I don't have otg cable so can't say it works completely!!

ql5aasi5

xPROTc0F

Zaklsp5z

It is a big news!
I would like to try it but I cannot get an otg cable as well:'(
Maybe you can post it on another thread so that more people can get notified and help you test for it;-)

Sent from my MB525 using XDA App
 

sam_24

Member
Oct 20, 2009
23
30
Stuttgart
sam24.sa.funpic.de
I was abel to build a OTG-Cable but i can't get the software to run

otg cable pinout

micro usb usb-stick
1----------Vss--------------1
2----------D- --------------2
3----------D+ --------------3
4----------ID ---|
5----------Gnd--|-----------4

ID und GND connectet with switch

CM9 2.3.4 kernel 2.01.2012
shows that the device is in Host-Mode

error output
root@android:/dev/usb # insmod scsi_mod.ko insmod: init_module 'scsi_mod.ko' failed (Exec format error)
 

hackergnome

Senior Member
Apr 21, 2011
2,613
875
Bengaluru
I was abel to build a OTG-Cable but i can't get the software to run

otg cable pinout

micro usb usb-stick
1----------Vss--------------1
2----------D- --------------2
3----------D+ --------------3
4----------ID ---|
5----------Gnd--|-----------4

ID und GND connectet with switch

CM9 2.3.4 kernel 2.01.2012
shows that the device is in Host-Mode

error output
root@android:/dev/usb # insmod scsi_mod.ko insmod: init_module 'scsi_mod.ko' failed (Exec format error)

Read my post above I got the same error... in my case it was coz I din specify busy box path did u?

2 1 2012?
I think that's froyo kernel by quarx!
Can u try eppy's build?


Sent from my MB526 using xda premium
 
Last edited:

elnacho12

Member
Dec 28, 2011
24
1
Buenos Aires
Yup ur right...
But I can't get it to work now even on gb kernel!...
Exec error...
Will try a fresh copy again...
Sent from my MB526 using xda premium

Guys, I've trying this too and found that after you try to run the script and get those errors, if you run "dmesg" it shows:

"ext2: version magic '2.6.29 preempt mod_unload ARMv7 ' should be '2.6.32.9 preempt mod_unload ARMv7 '"

After googling this, I confirmed that it's because these modules were compiled with an old kernel (2.6.29) and I have 2.6.32

If there only was an option to force it... :(
 

hackergnome

Senior Member
Apr 21, 2011
2,613
875
Bengaluru
Guys, I've trying this too and found that after you try to run the script and get those errors, if you run "dmesg" it shows:

"ext2: version magic '2.6.29 preempt mod_unload ARMv7 ' should be '2.6.32.9 preempt mod_unload ARMv7 '"

After googling this, I confirmed that it's because these modules were compiled with an old kernel (2.6.29) and I have 2.6.32

If there only was an option to force it... :(

i saw that too!
but y did it work on the cm9 u can see...
i forgot to take screenshot of dmesg!

Sent from my MB525 using xda premium
 

vishal24387

Inactive Recognized Contributor
May 11, 2011
3,936
1,976
37
Solapur, Maharashtra
Guys, I've trying this too and found that after you try to run the script and get those errors, if you run "dmesg" it shows:

"ext2: version magic '2.6.29 preempt mod_unload ARMv7 ' should be '2.6.32.9 preempt mod_unload ARMv7 '"

After googling this, I confirmed that it's because these modules were compiled with an old kernel (2.6.29) and I have 2.6.32

If there only was an option to force it... :(

try to creat those modules with referance to new kernel 2.6.32 & then try again.
 

walter79

Recognized Developer
Dec 18, 2006
4,138
4,636
Scripts did not work on Gingerbread.

"invalid module format"

Did it only works with old kernel?

I use Galaxy S2 cable.

---------- Post added 16th January 2012 at 12:11 AM ---------- Previous post was 15th January 2012 at 11:41 PM ----------

Maybe this help.

2.6.32.9 kernel modules.

http://sven.killig.de/android/N1/2.2/usb_host/
 
Last edited:

GuustFlater89

Senior Member
Jan 15, 2008
85
37
Any hope in getting USB host working on the Defy? Or will an unlocked bootloader the only possibility?
I thought some people were close in getting it working? I would really like this option!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 30
    New OTG Kernel

    Here is a new version of the OTG kernel based on the latest AeroKernel for Android 4.2/4.3.
    I integrated Quarx's fixes and made some more stability fixes which focus on not breaking existing kernel functionality. So as long as you do not connect an OTG cable, you should not notice any difference to the latest AeroKernel.

    OTG Features:
    • Switch from regular mode to OTG mode any time by plugging/unplugging cable.
    • Connect devices with power consumption up to 100mA without an external power supply.
    • Connect devices with power consumption up to 200mA without external power supply at your own risk. They might work or might not, or they may break your device. I tried a few USB devices and my Defy is still ok, however some of the devices disconnected after some time, possibly due to voltage drop.
    • Connect any USB device which is supported by Android/Linux Kernel via USB hub with external power supply (might need additional Kernel modules)


    Working devices: (i.e. devices I plugged in that worked)
    • Mouse, Keyboard
    • Cordless Mouse
    • USB Flash Drives
    • Camera
    • Joystick :)

    Issues in OTG mode:
    • Disconnecting USB devices does not work properly. After unplugging a USB device, the next thing you connect to the USB port will not be detected (no matter if it is a charger, USB cable or USB device). You have to unplug and replug the cable at least once more (sometimes more often). Afterwards, everything works as usual.
    • After unplugging the USB device without removing the OTG cable, other USB devices will not be detected. Always unplug the OTG cable when changing devices
    .

    Please keep in mind that this feature is not officially supported by Motorola or by anyone, so if it does not work as you'd expect, chances are high that it will never work. I will not work any further on this because I ran out of ideas how to fix the remaining issues (maybe hardware related) and because it works good enough for my purposes already.

    If some people here give me positive feedback that this kernel works good for them, I will ask Quarx to merge it.

    Edit:
    For anyone who is interested in this, I recompiled the OTG kernel with the latest (final?) changes for the 2.6.32 kernel. As development on the 2.6.32 kernel has stopped, there is no point in merging it into Quarx's repository any more. Quarx's 3.0 kernel will support OTG by default:)

    Some people reported that connecting works for them only after a fresh boot. Reconnect works as described on my device (MB525 green lens), but it could be different on other devices.
    27
    USB Host Kernel for Defy

    So for anyone who is keen enough to try this, here is my modified kernel with USB host support. I also compiled some of the USB storage modules into the kernel.

    You have to copy the zImage to /system/bootmenu/2nd-boot/ and the android.hardware.usb.host.xml to /etc/permissions (It's not a flashable zip, sorry!) And don't forget to make a backup first:)

    This is based on the AeroKernel from Quarx's latest nightlly, so it should work with the CM10.1/2 builds (tested it on CM10.2).

    Please test and report any issues.

    What you need:
    - USB OTG cable
    - Defy does not provide power via USB, you therefore need some sort of external power source for your USB device. The following should work:
    - self-powered device (e.g. camera)
    - hard disk with Y-cable, second end in external power source
    - USB hub with external power source

    What works:
    - USB hub
    - USB keyboard and mouse
    - USB mass storage devices (with external app, I tested StickMount)
    - disconnecting and reconnecting devices at the hub
    - changing from client to host mode and vice versa on OTG cable connect/disconnect

    Known issues/what does not work:
    - first connect after boot works fine, but reconnecting the OTG cable needs a few (2-4) tries.
    - sometimes after using host mode, charger or USB client connection is not detected any more
    - when disconnecting a device, the driver sometimes gets stuck in a strange loop and phone must be rebooted


    Amazing!! Did you need a self-powered cable or just plain OTG?
    The USB device needs an external power source, but a simple externally powered USB hub with an OTG cable will do.
    20
    @SlugZero, thanks for OTG:)
    I looked into it and made some fixes., reconnecting works after boot, but not always... And usb works.
    If you not mind, after fully fix i can include it in cm builds.

    @ljsh093, wireless mouse works.
    11
    Usb OTG Fix ?

    After fiddling today with the latest kernel from @SlugZero and testing all my usb devices with an otg cable and running dmesg on the kernel i found that all of them where throwing this error: ''device descriptor read/64 error -71'' , while searching for it i found that is being made by the UsbCore module which is working on our kernel using the ''New Scheme'' (detailed description about the schemes used by the UsbCore i found here ) thus throwing errors and not registering the usb device after the error , forcing the UsbCore to work with the ''Old Scheme'' can be done by putting the following line in the cmdline(system/bootmenu/2nd-boot/cmdline)

    Code:
    usbcore.old_scheme_first=Y

    You can also make it to use both of the schemes with the line below:

    Code:
    usbcore.use_both_schemes=Y

    I have tested 5 usb sticks, 2 wireless mouses, 1 card reader, 1 usb modem and 1 wireless Xbox 360 controller and all of the sticks worked without a problem and the mouses and the reader the modem was found but not recognized as an usable usb device and the wireless receiver of the 360 pad is found but can't get enough power.I have tried both of the methods the old one and the dual one , for me the old one worked always on each device and not throw-ed any errors, the dual method because it used first the new method then the old one if it trowed an error and tried to reconnect after 75% of the times didn't connect my devices.All of the devices that i tried where connected only to the phone without a powered hub and the phone correctly detected the device power requirement on the Old Scheme, the only problem that we seem to have is that the musb_hdrc module is not releasing the device after disconnecting it.
    9
    OTG without external power

    I will not have time to work on this for the next month, so I want to share what I've got until now. I could power and mount an USB stick with the following change:
    https://github.com/slugzero/jordan-kernel/commit/45e34e87e48edb47fc46a50ff761d13a51ececf1

    This is very unstable, seems like power goes down again after a while. I could browse through the directories on the stick but I could not open any files any more. It also works immediately after boot only, disconnect and reconnect of devices does not work.
    Since this may possibly damage your device, I recommend not testing this and also will not provide a compiled kernel until I got this working properly. Everyone who knows what he/she is doing, should be able to compile a kernel himself.

    Input devices on the other hand work really nicely, see attached image:)


    Btw. I am using the kernel I posted previously for more than one week now and had no issues so far, but I've got the feeling that power consumption is slightly higher. I think this is due to the changes in the musb part, I will have a look at this as soon as I am back.