[Nexus One General] Alt.F4:
Hey,

I'm trying to get USB host working on my N1, but am running into some trouble:

First, I can't seem to find the android ndk 4b on Linux that Sven indicates in his instructions. The latest appears to be 5b. Not sure if this causes any problems.

I replaced the CROSS_COMPILE variable with: /android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin/arm-eabi-

...and it builds, and flashes. But when I try to load the kernel modules, I get a "failed (Exec format error)."

Someone earlier posted about having the same issue (link) , but then he just kind of says he fixed it without saying exactly how.

Using the binaries provided by Sven seems to be giving me a little more luck. I can flash it to my N1, but upon enabling the host driver (/sdcard/drivers/usb/host/ehci-hcd.ko) something crashes and gives me a stack trace:

<6>[ 384.419677] batt: 56%, 3825 mV, -175 mA (-191 avg), 30.3 C, 761 mAh
<6>[ 434.481048] batt: 56%, 3830 mV, -254 mA (-200 avg), 30.2 C, 760 mAh
<6>[ 486.809295] batt: 55%, 3825 mV, -175 mA (-179 avg), 30.1 C, 756 mAh
<4>[ 519.236114] mmc1: Starting deferred resume
<4>[ 519.435058] mmc1: Deferred resume completed
<6>[ 519.501800] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
<7>[ 519.502471] ehci_hcd: block sizes: qh 60 qtd 96 itd 160 sitd 96
<7>[ 519.503021] initializing MSM7201/QSD8X50 USB Controller
<6>[ 519.523223] msm_hsusb msm_hsusb: Qualcomm MSM7201/QSD8X50 On-Chip EHCI Host Controller
<7>[ 519.523773] drivers/usb/core/inode.c: creating file 'devices'
<7>[ 519.524444] drivers/usb/core/inode.c: creating file '001'
<6>[ 519.524841] msm_hsusb msm_hsusb: new USB bus registered, assigned bus number 1
<7>[ 519.525573] msm_hsusb msm_hsusb: reset command 080003 (park)=0 ithresh=8 period=1024 Reset RUN
<7>[ 519.526611] msm_hsusb msm_hsusb: park 0
<7>[ 519.527008] msm_hsusb msm_hsusb: reset command 080b02 park=3 ithresh=8 period=1024 Reset HALT
<7>[ 519.543212] msm_hsusb msm_hsusb: ...powerdown ports...
<6>[ 519.573242] msm_hsusb msm_hsusb: irq 58, io mem 0xa0800000
<7>[ 519.593261] usb usb1: default language 0x0409
<7>[ 519.593688] usb usb1: udev 1, busnum 1, minor = 0
<6>[ 519.594055] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
<6>[ 519.594726] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
<6>[ 519.595397] usb usb1: Product: Qualcomm MSM7201/QSD8X50 On-Chip EHCI Host Controller
<6>[ 519.595794] usb usb1: Manufacturer: Linux 2.6.32.9-27240-gbca5320-dirty ehci_hcd
<6>[ 519.596466] usb usb1: SerialNumber: msm_hsusb
<7>[ 519.597503] usb usb1: uevent
<7>[ 519.600311] usb usb1: usb_probe_device
<6>[ 519.600708] usb usb1: configuration #1 chosen from 1 choice
<7>[ 519.601409] usb usb1: adding 1-0:1.0 (config #1, interface 0)
<7>[ 519.602050] usb 1-0:1.0: uevent
<7>[ 519.606536] hub 1-0:1.0: usb_probe_interface
<7>[ 519.607208] hub 1-0:1.0: usb_probe_interface - got id
<6>[ 519.607574] hub 1-0:1.0: USB hub found
<6>[ 519.608062] hub 1-0:1.0: 1 port detected
<7>[ 519.608673] hub 1-0:1.0: standalone hub
<7>[ 519.609039] hub 1-0:1.0: individual port power switching
<7>[ 519.609680] hub 1-0:1.0: individual port over-current protection
<7>[ 519.610046] hub 1-0:1.0: Single TT
<7>[ 519.610412] hub 1-0:1.0: TT requires at most 8 FS bit times (666 ns)
<7>[ 519.611083] hub 1-0:1.0: power on to power good time: 20ms
<7>[ 519.611480] hub 1-0:1.0: local power source is good
<7>[ 519.612152] hub 1-0:1.0: enabling power on all ports
<7>[ 519.614685] drivers/usb/core/inode.c: creating file '001'
<4>[ 519.615661] ------------[ cut here ]------------
<4>[ 519.616058] WARNING: at kernel/irq/manage.c:274 enable_irq+0x5c/0xb4()
<4>[ 519.616699] Unbalanced enable for IRQ 58
<4>[ 519.617065] Modules linked in: ehci_hcd(+) usbcore
<4>[ 519.618713] [<c002bb00>] (unwind_backtrace+0x0/0xd8) from [<c0057158>] (warn_slowpath_common+0x48/0x60)
<4>[ 519.619171] [<c0057158>] (warn_slowpath_common+0x48/0x60) from [<c00571a8>] (warn_slowpath_fmt+0x24/0x30)
<4>[ 519.619873] [<c00571a8>] (warn_slowpath_fmt+0x24/0x30) from [<c008bd14>] (enable_irq+0x5c/0xb4)
<4>[ 519.620635] [<c008bd14>] (enable_irq+0x5c/0xb4) from [<bf0218ac>] (usb_hcd_msm7201_probe+0x22c/0x2cc [ehci_hcd])
<4>[ 519.621398] [<bf0218ac>] (usb_hcd_msm7201_probe+0x22c/0x2cc [ehci_hcd]) from [<c01b7f30>] (platform_drv_probe+0x18/0x1c)
<4>[ 519.622131] [<c01b7f30>] (platform_drv_probe+0x18/0x1c) from [<c01b70ec>] (driver_probe_device+0xa0/0x14c)
<4>[ 519.622863] [<c01b70ec>] (driver_probe_device+0xa0/0x14c) from [<c01b71f8>] (__driver_attach+0x60/0x84)
<4>[ 519.623565] [<c01b71f8>] (__driver_attach+0x60/0x84) from [<c01b6954>] (bus_for_each_dev+0x48/0x84)
<4>[ 519.623992] [<c01b6954>] (bus_for_each_dev+0x48/0x84) from [<c01b62a8>] (bus_add_driver+0x9c/0x218)
<4>[ 519.624725] [<c01b62a8>] (bus_add_driver+0x9c/0x218) from [<c01b74c4>] (driver_register+0xa8/0x138)
<4>[ 519.625457] [<c01b74c4>] (driver_register+0xa8/0x138) from [<bf02d0ac>] (ehci_hcd_init+0xac/0x108 [ehci_hcd])
<4>[ 519.626220] [<bf02d0ac>] (ehci_hcd_init+0xac/0x108 [ehci_hcd]) from [<c002637c>] (do_one_initcall+0x5c/0x1b4)
<4>[ 519.626922] [<c002637c>] (do_one_initcall+0x5c/0x1b4) from [<c00812f4>] (sys_init_module+0xb0/0x1dc)
<4>[ 519.627655] [<c00812f4>] (sys_init_module+0xb0/0x1dc) from [<c0026f40>] (ret_fast_syscall+0x0/0x2c)
<4>[ 519.628051] ---[ end trace 048932ae2a6b9568 ]---
<7>[ 519.703338] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000
<6>[ 536.891387] batt: 55%, 3815 mV, -187 mA (-201 avg), 30.1 C, 753 mAh
<6>[ 586.949249] batt: 55%, 3815 mV, -190 mA (-195 avg), 30.0 C, 752 mAh

Peering through the log, it appears to recognize the local USB hardware, and then also recognize the powered USB hub I'm using too. But the crash is troubling. I tried looking through some of the functions that the stack trace pointed to, but it wasn't immediately clear what the problem was.

Edit: Ultimately, I'm trying to make both USB host and usbnet work. So I can have the N1 sending IP packets over the usb port as host to a device that's a usb slave. Thanks!

Edit2: Actually, I see Sven says to ignore the above stack trace. So never mind about that. Hmm, the N1 still fails to recognize any devices I insert. No activity in dmesg when I insert a USB mouse or keyboard after enabling usbhid.ko, nothing from m usb flash stick after I enable usb mass storage, etc...