Achievement Unlocked: USB Host (OTG) for Android on Nexus One Hacked
This is innovation! USB Host or USB OTG (On-The-Go) is a way for your device to read other USB devices such as keyboards, web cams or small EXTERNAL HARD DRIVES. Sven Killig decided to work out some driver tweaks to get this running on his Nexus One. The Nokia N8 also has USB OTG built in so it may be able to power the external device, but any devices the Nexus One hosts must be connected to a powered USB hub first in order for them to retrieve the power needed to operate.
Now if all Android devices could do this and had better video codec support I would be even more smiley.
Check out Sven’s instructions HERE on how to do this yourself.
You will need:
- Hardware
- Nexus One
- Micro USB OTG cable (e.g.)
- USB Dual Power Cable (e.g.) to provide power to the hub chip through the uplink port, since the Nexus One doesn’t provide bus power (yet)
- Powered USB 2.0 hub (will charge the Nexus One) (e.g.) and optionally a battery pack for mobile use (e.g.) (some power calculations)
- Software
- Android 2.2 Froyo (2.1 may work, too)
- ConnectBot
- Download binaries…
- …or build a Nexus One kernel from source
- # Fetch msm kernel tree
git clone git://android.git.kernel.org/kernel/msm.git
cd msm
# Switch to Nexus One 2.2 Froyo
git checkout origin/android-msm-2.6.32
# Get config
wget http://sven.killig.de/android/N1/2.2/usb_host/.config
# Patch (No device mode, Andrew de Quincey’s work not ported yet.)
wget http://sven.killig.de/android/N1/2.2/usb_host/android-kernel_msm-v2.6.30-rc2-27223-g248970b_Nexus-One_usb-host.patch
patch -p1 < android-kernel_msm-v2.6.30-rc2-27223-g248970b_Nexus-One_usb-host.patch
# Build
make -j2 ARCH=arm CROSS_COMPILE=/android-ndk-r4/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-
- # Fetch msm kernel tree
- Install kernel
- # Boot from RAM (till next reset)…
fastboot boot arch/arm/boot/zImage - # …or write to flash (boot.img from a nandroid backup)
/getramdisk.py boot.img
/mydroid/out/host/linux-x86/bin/mkbootimg --kernel arch/arm/boot/zImage --ramdisk ramdisk.img --base 0x20000000 -o boot_usb-host.img
fastboot flash boot boot_usb-host.img
- # Boot from RAM (till next reset)…
- Start ConnectBot and connect to Local
- su
insmod drivers/usb/core/usbcore.ko
insmod drivers/usb/host/ehci-hcd.ko
insmod drivers/hid/usbhid/usbhid.ko
insmod drivers/usb/storage/usb-storage.ko
# Wait for usb-storage to enumerate partitions
mount /dev/block/sda1 /sdcard/usbstick
- su
- To use adb over WLAN
- adb connect IPAddress:5555
Filed Under: Android • Google • Innovation
