yashsingh1/xdaforums huggingface dataset:
[Nexus One General] sonic74:
There's an ongoing effort here.
[Nexus One General] famou:
Great job Sven and your warm help to the community, think about the pages of reply here! I'm kind of new to kernel world and would like to get some tip from you:

If I'd like to add "non official " USB devices with linux drivers, where should I go? Say if I would like connect Kinect and let the phone manipulate the toy, I have all the ubuntu10.10 working environment and all related libXnxxxxx.so etc...

In fact in my case USB host mode is already working and when I plug in Kinect lsusb shows the 4 newly added device, one usb hub with another 3 are xbox NUI Motor, xbox NUI Audio, xbox NUI Camera, and the LED start blinking, so my guess is I just need to make sure install the .so somewhere and make sure they are working together, then build an android app to manipulate them.

Otherwise, How can I come up with a Kinect.ko file to start with? it is used for insmod in all your examples...
[Nexus One General] mloverme:
I got a dlink powered hub today that also didnt work. I cant get either of the two you listed on your site because they dont ship to the United States from sites like amazon.uk. Do you know of any common hub I could get from amazon.com that is kown to work?
[Nexus One General] sonic74:
Which one?
[Nexus One General] mloverme:
This one: from amazon

I figured since it was a from a common brand name it would work but I guess not. The phone didn't even see it - just like the one built in my dell monitor.
[Nexus One General] sonic74:
I think occassionally I had problems after a reboot directly after using USB device mode, too. If you have a backup of your boot.img and a way to cope with /system/lib/modules/bcm4329.ko, you could try to flash my boot.img and powercycle the N1 before using host mode.
[Nexus One General] mloverme:
I will try to do that and see if it helps. Is there a quick easy way to back up the original boot.img?
[Nexus One General] sonic74:
Nandroid in RA-passion.
[Nexus One General] sonic74:
You don't need additional kernel modules. You have to cross compile the libraries for the ARM architecture and either use a Debian overlay (where you could do the compilation) and the usual programs or write Android apps with a lot JNI.
[Nexus One General] sonic74:
I think it's easier and sufficient to just power down the N1 before doing fastboot boot ...
[Nexus One General] pengu1n:
cool instructions, nerd!
[Nexus One General] famou:
Thanks for your quick response! and sorry for my ignorance, do you mean I dont need to any kernal compilation or insmod thing or mount /dev/video thing, but simply use NDK to cross compile everything to ARM version and build a libkinect.so for jni usage...how about the USB rules that was used when installation in linux? I'm a bit unsure how one can command camera instead of motor if you dont do any device mounting etc (in this case 4 usb devices found), shouldn't they be registered as different device as in Linux case, thanks in advance for a bit more clarification.
[Nexus One General] sonic74:
Since all subdevices have Vendor Specific Class, there will be neither /dev/video nor /dev/audio.

They modify the access restrictions only.

All communication happens via libusb.
[Nexus One General] sonic74:
I added a Gamepad IME, a video and some Market links to the website.
[Nexus One General] yi07:
fail to insmod ehci-hcd.ko

I got a message when I tried to insmod ehci-hcd.ko driver, and the message says "device or resource busy".

The log from insmod usbcore.ko :

<6>[ 87.850128] usbcore: registered new interface driver usbfs

<6>[ 87.852050] usbcore: registered new interface driver hub

<6>[ 87.853546] usbcore: registered new device driver usb

<6>[ 116.281951] batt: 83%, 3996 mV, -120 mA (-137 avg), 27.0 C, 1128 mAh

<6>[ 121.817138] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver

<7>[ 121.817352] ehci_hcd: block sizes: qh 60 qtd 96 itd 160 sitd 96

<3>[ 121.818847] Error: Driver 'msm_hsusb' is already registered, aborting...

According to the log, I think the msm_hsusb driver should be initialized while insmod ehci-hcd.ko driver, but the driver has been built in kernel.

I tried to resolve this problem by using two methods, but it seems that the problem didn't be resolved.

First, I removed

&msm_device_hsusb

in board_mahimahi.c file and built kernel again, still the message says "device or resource busy".

Besides command adb devices can't find Nexus one (turn on USB debugging mode in nexus one)

The second method which removed

retval = platform_driver_register(&PLATFORM_DRIVER);

in ehci-hcd.c file.

I didn't get error message after insmod usbcore.ko, ehci-hcd.ko and usbhid.ko, but the usb keyboard can't work.

Have you ever meet this problem?:confused:
[Nexus One General] sonic74:
Sounds like my kernel isn't running. What does Settings/About phone/Kernel version show?

Device mode doesn't work with my kernel, so you have to use adb over TCP/IP.
[Nexus One General] yi07:
Kernel version:

2.6.32.9-27242-g4c0d547-dirty

(build from source)

I build the kernel and modules form source, beacuse I got an error message when ismod usbcore.ko under the pre-build kernel.

The message says "Exec format error".

Could you explain this step a little more. The cifs.ko is for ARM.

PC's

insmod fs/cifs/cifs.ko

mount -t cifs -o username=username //IP_address/share /mnt/sdcard/cifs
[Nexus One General] DasWoody:
Hi folks,

at first thanks Sven for sharing your work with us!

I am currently trying this and in my case i had the problem that the hostmodule didn't recognize the connected usb-devices. By now i figured out that the usb cable has to be connected to the phone while loading the usb-host module (ehci_hcd.ko). Otherwise, at least in my case, the host doesn't recognize the usb-devices. For me it seems that the hardware-port isn't configured correctly without a connected cable (maybe it has something to do with the id-pin). Thought this could be helpful for people who face the same problem. Correct me if my conclusion was wrong.

ok at last i wanted to know if you have already a kernel which includes those modules as built-in drivers and would share it with me?

kind regards, DasWoody
[Nexus One General] sonic74:
Thanks for that, I added it to the website!
[Nexus One General] DasWoody:
Hi,

while trying to understand the whole thing i'm currently dealing with the kernel. Is it just done with disabling the usb-device-drivers in the .config-file and change the usb-core, -host and device drivers as loadable kernel modules? Or is there more to do?

regards, DasWoody
[Nexus One General] kev1807:
hello folks :-o

fascinating to see what you can do :-o

for me as (even more than) a beginner (totally a noob ... ) it's absolutely unbelieveable ...

now, while reading your article some questions occured:

1. Any Chance to make this great stuff run on an Desire HD (with newest FW, CWM, rooted and S-off)

2. As I am not sure whether i understand it as it was meant ... you "simply" edited the usb-driver package to deal with all these things?

3.So the next question is: if it was only a new driver, why do you have to flash it, aren't there other ways to put a new/actualized driver to your android-phone?

4. You built a new Kernel, right? So it might be possible for a DHD-Kernel-maker to include this stuff to a DHD Kernel, right?

best wishes for this awesome project and hoping for some clarification,

Kevin
[Nexus One General] sonic74:
Since I once hit the size limit of the kernel partition, I try to modularize as much as possible. I'm also not sure about idle power consumption in host mode.
[Nexus One General] sonic74:
Sorry? .
[Nexus One General] sonic74:
Some progress for the Desire is going on here.

You can see the kernel changes here.

The standard device mode has to be disabled in the kernel.

That should be possible.
[Nexus One General] DasWoody:
Well that is what i also wanted to know. Sorry if my questioning is sometimes unclear ;)
[Nexus One General] kushtagi:
Nexus one USB Host : USB sound card not working

Hi,

I have enabled USB host as per the instructions mentioned by Sven (Sonic74)

Now, my N1 is able to detect USB sound card (XFI from creative lab)

I modified hardware/msm7k/libaudio-qsd8k/AudioHardware.cpp file to

open /dev/snd/dsp. When I playback any media, I hear only the noise.

I understand that snd-usb-audio works on ALSA interface, however as per

my knowledge, there is no ALSA support on N1.

Please suggest how to proceed

/Shivappa
[Nexus One General] hamachiaddict:
Is there anyway to make this great stuff run on a Droid-X? I searched through the forum and it doesn't look like there's any development for the DX.

Is this correct?
[Nexus One General] nurre:
Anyone looked into doing this on a tablet? I'm thinking with hdmi out and a bluetooth keyboard+mouse it shouldn't require any hacks at all really.

Got a thread on it here : http://forum.cyanogenmod.com/topic/...with-a-tablet/page__view__findpost__p__140937
[Nexus One General] robross0606:
Upstream powered hubs

The two hubs you list on the website documentation are both European:

TiVECO TM-UH710

Trust HU-5870V

I tried purchasing the MacAlly TRIHUB7 which appears to be identical to the HU-5870V. However, it apparently does NOT provide power to the upstream port.

Does anyone know of any hubs available in the United States with upstream power?
[Nexus One General] powerdev:
need help in initial steps

Hi,

I am interested in using my Nexus One as a USB host for a custom USB driver. I need some help with the instructions at the sven.killig.de page.

Once we do 'fastboot boot zImage', we lose USB connectivity (nothing shown on issuing 'adb devices') and Wireless too stops working. I know that to get Wireless working, I am supposed to backup and replace bcm4329.ko, and then I can connect to adb via TCP/IP.

Could you please shed some more light on 'copying and replacing wireless module'? Once I get this working, I can copy the image to flash, and avoid resets on boot.

My phone is rooted using the steps given on nexusoneforum. Please look for 'nexus-one-development-hacking/10940-simple-sdk-setup-manual-root-guide-windows'.

Sorry for the trouble. I am new, and not yet allowed to post links.

Thanks!!
[Nexus One General] sonic74:
Have a look at my scratchpad in the section "Replacing the WLAN module".
[Nexus One General] powerdev:
insmod failed - Exec format error

Hi,

We put the bcm4329.ko file downloaded from your page in the sdcard, booted the zImage, and tried to restore the module using insmod.

We got the 'Exec format error.'

We have the root access to the phone.

Could you please let us know what we might be doing wrong?

Thanks!
[Nexus One General] sonic74:
This means that the module doesn't match the kernel. See the output of dmesg.
[Nexus One General] strags:
CDC/ACM?

I'm using host mode for a project involving a Nexus One and a USB serial device.

The serial device works just fine on OSX and Linux machines, using the default CDC/ACM drivers.

I have USB CDC/ACM support enabled in the modified kernel, and indeed everything initially looks to be working. The device shows up as /dev/ttyACM0, as expected.

When I run an application that opens the device (and sets various serial parameters), then reads from it, I see this in the kernel logs:

<7>[ 132.340850] usb 1-1.4.4: link qh64-0601/c7243720 start 3 [1/2 us]

When I CTRL/C the application, I see this:

<7>[ 171.959777] usb 1-1.4.4: unlink qh64-0601/c7243720 start 3 [1/2 us]
<7>[ 172.097747] usb 1-1.4: clear tt buffer port 4, a4 ep4 t80808dc2

Unfortunately, from this point forward, although I can re-open the device and set parameters, I never receive any further data. (Doing the same thing on a Linux/OSX server works just fine).

Has anybody had any experience with using CDC/ACM devices on the Nexus One?

edit: I forgot to mention, that also, if the device is unplugged, any attempt to rmmod cdc_acm will hang.
[Nexus One General] RrOoSsSsOo:
Everything you need for your work! Thanks
[Nexus One General] NahhaB:
Well done and very interesting.

I have a 3g USB modem, can I use it the same way with my 2.2 galaxy s?
[Nexus One General] robross0606:
FYI, I also just purchased the Trust HU-5870V which is documented as providing power to the upstream port. However, this does NOT work. I have three of them here and they all do NOT provide power to the upstream port. Clearly we have some manufacturing inconsistency.
[Nexus One General] watabou117:
What galaxy s works?
[Nexus One General] robross0606:
fastboot options

I keep seeing reference to the "-b" option as shown on these instructions:

/android-sdk/platform-tools/fastboot -b 0x20000000 flash:raw boot arch/arm/boot/zImage /ramdisk.img

But that option does not appear to be available in my version of fastboot. When I try to run with that command line I simply get back the help indicating my command line was wrong. Where is everyone downloading the fastboot executable which has this option?
[Nexus One General] sonic74:
As the command line suggests, it's part of the SDK platform-tools which can be downloaded here, as the link on my website suggests.
[Nexus One General] hedpe:
Hi all,

I am trying to port this to the droid incredible, but I am having trouble with the very last step of inserting the EHCI module:

<6>[ 694.773345] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
<7>[ 694.773345] ehci_hcd: block sizes: qh 60 qtd 96 itd 160 sitd 96
<3>[ 694.773376] Error: Driver 'msm_hsusb' is already registered, aborting...

Everything else seems to have been inserted without an issue:

# lsmod
ftdi_sio 27060 0 - Live 0xbf0b5000
ifb 2719 0 - Live 0xbf0af000
usbserial 24729 1 ftdi_sio, Live 0xbf0a0000
usbhid 16849 0 - Live 0xbf083000
usbcore 120209 3 ftdi_sio,usbserial,usbhid, Live 0xbf045000
bcm4329 202775 0 - Live 0xbf000000

Does anyone know where I might have gone wrong?
[Nexus One General] sonic74:
It seems you haven't disabled all USB client mode config options.
[Nexus One General] hedpe:
thanks, i appreciate the help! I am going to dig around and try disabling something things. Here is my config, if anything stands out to you i'd appreciate the feedback!

http://pastebin.com/U21Lz0kd
[Nexus One General] sonic74:
It does:

CONFIG_USB_GADGET*

CONFIG_USB_MSM*
[Nexus One General] hedpe:
has anyone been able to find a USB hub that is powered that ships in the US? I have a Dlink DUB-H4, but it doesn't seem to provide power :\ It has an AC adapter even directly to the hub. I'm using a proper kernel, so I'm thinking power is the problem.
[Nexus One General] hedpe:
this worked, thank you!
[Nexus One General] hedpe:
OK, this can't be true. I took a voltmeter to my Dlink DUB-H4 and I am getting 5V from the hub ports:

I am running the kernel binaries from here:

http://linuxbeast.net/incredible_host/

and I built my own 2.6.37 kernel with USB host support for the incredible.

Here is a picture of my setup:

With either kernel running, I have all of the modules properly inserted:

# lsmod
usb_storage 33640 0 - Live 0xbf09f000
ehci_hcd 37870 0 - Live 0xbf08e000
ftdi_sio 29740 0 - Live 0xbf07c000
usbserial 25900 1 ftdi_sio, Live 0xbf06e000
usbhid 16379 0 - Live 0xbf064000
usbcore 124290 6 usb_storage,ehci_hcd,ftdi_sio,usbserial,usbhid, Live 0xbf036000
bcm4329 210278 0 - Live 0xbf000000

However, when I plug in a keyboard or flash drive in to the hub absolutely nothing happens and I get no output from dmesg.

if I mount usbfs, enable usbmod, and do 'cat /sys/kernel/debug/usb/usbmon/0u' I get absolutely nothing. Nothing when idle, nothing when I plug and unplug the hub. Nothing when I plug and unplug the flash drive from the hub.

I'm a little bit stuck at this point...
[Nexus One General] hedpe:
a-ha! I have USB host working on my Droid1 right now, I respliced another USB female cable to my USB micro and that started working. Seemed like I had a bad USB female. I have been able to mount a USB flash drive and connect a keyboard.

Now, I just need to get the droid incredible working :)
[Nexus One General] tphuc_ibc:
hi sonic74, first, sorry for my bad english.

i see your web many times but i cant understand your guide.

Connect the USB cable (else no devices are detected later), start ConnectBot, enable full screen and connect to Local
su
insmod drivers/usb/core/usbcore.ko
# Ignore the Unbalanced enabled for IRQ 58 stack trace for now
insmod drivers/usb/host/ehci-hcd.ko

1. i download two file: modules.tbz and zImage. I know how to use zImage, but file modules.tbz, i have to do what with this file? extract or copy this file modules.tbz to where?

2. when i open connectBot, there are 3 option: ssh, telnet and local, i choose local, and i have to write what in the textbox username@hostname:port?
[Nexus One General] hedpe:
I also have a question about the instructions. When you say:"connect the usb cable or no future devices will be detected" ... Do you mean just connect the female cable? Or connect the hub? Or a cable with a device attached?
[Nexus One General] tphuc_ibc:
Ah, why dont you create a nandroid backup of your nexus one which have all necessary to run host mode.

The instruction you give is very hard for me to follow.
[Nexus One General] Urool:
would this work for htc desire (bravo?) too ?
[Nexus One General] @seb:
USB Host and CM6

Hello

I have Cyanogenmod6 and the 2.6.32.9_gbca5320-dirty root@sonic #2 Kernel on my N1 and wlan, camera and the flashlight aren´t working.

The USB host works realy good. I have tested it with an usbstick and a wireless mouse.

1. How can i fix the wlan, cam and light?

2. Is it posible to use a NTFS formated Usb harddrive too?

3. Is it allready possible to switch between host and devicemode?

Sorry for my stupid questions, but i am not so good at softwarethings.

Sebastian
[Nexus One General] hedpe:
What hub are you using to power the USB devices to your N1?

1. All of these things *might* be related to kernel modules which you have not updated. Did you download and unpack the proper kernel modules from sven's cite? (http://sven.killig.de/android/N1/2.2/usb_host/modules.tbz)

2. You will probably have to reconfigure and rebuild the kernel with FUSE support, I'm not sure it's in there.

3. Not that I know of. The kernel is configured specifically for host mode.
[Nexus One General] tphuc_ibc:
Can you give me a nandroid backup of your rom and show me how to run it? I have all hardware but I dont know how to use it. I cant understand the instruction of sven.
[Nexus One General] @seb:
@hedpe

I flashed the zImage via "fastboot flash zImage" and inserted the kernelmodules usbcore.ko, ehci-hcd.ko, usb-storage.ko and usbhid.ko.

This works allready. I can mount a usbstick and use a usbmouse in android.

The Problem is that the camera, the flashlite and wlan aren´t working with the hostmode-kernel.

@tphuc_ibc

I could give you a nandroid backup, but I don´t know if it would helps you, but maybe i can descripe how to do it:

You need a rooted Phone with unlocked bootloader, otherwise you can´t flash the kernel.

Copy the zImage from svens site to the directory where you have fastboot.

Type: "fastboot flash zImage zImage"

reboot

unzip modules.tpz and copy drivers to your sdcard

open terminal emulator or something like that on your n1

Type: "su" and then insmode the kernelmodules wich you need via

insmod /sdcard/drivers/...
[Nexus One General] tphuc_ibc:
I try and I have 2.6.32.9_gbca5320-dirty root@sonic #2 Kernel on my N1.

after that, I type into terminal:

su

insmod drivers/usb/core/usbcore.ko

insmod drivers/usb/host/ehci-hcd.ko

insmod drivers/usb/storage/usb-storage.ko

(nothing happen)

mount -t vfat /dev/block/sda1 /mnt/sdcard/usb-storage

( I get error here)

So, this is my terminal code:

export PATH=/data/local/bin:$PATH
$ export PATH=/data/local/bin:$PATH
$su
#su
# insmod /sdcard/drivers/usb/core/usbcore.ko
# insmod /sdcard/drivers/usb/host/ehci-hcd.ko
# insmod /sdcard/drivers/usb/storage/usb-storage.ko
# mount -t vfat /dev/block/sda1 /mnt/sdcard/usb-storage
mount: mounting /dev/block/sda1 on /mnt/sdcard/usb-storage failed: No such file or directory
[Nexus One General] @seb:
You have to create the directory usb-storage on your sdcard.

PS: I made a .sh to insert the modules but it dosn´t work but if I type it it works. What could be the problem?
[Nexus One General] tphuc_ibc:
the thing I was wrong is that I dont have folder /dev/block/sda1 in my N1, I have folder usb-storage in my sdcard.

So, I think it better if you can give me a nandroid of your N1 so that I can try with my N1. Thank u so much.
[Nexus One General] @seb:
Thats not a normal folder, you only have to create the usb-storage directory on your sdcard, thats it.
[Nexus One General] tphuc_ibc:
Yes, I created folder usb-storage, same error, I check and I see that my N1 have no folder /dev/block/sda1. How to fix that?
[Nexus One General] @seb:
I have no sda1 folder too, because its not a folder. It is the location for new devices.

Try to type /sdcard/usb-storage instead of /mnt/sdcard/usb-storage. Then it should work.
[Nexus One General] tphuc_ibc:
Oh, I see, I just check all my step. May be my problem is I have no dual power cable. So, in Viet Nam, I cant find a dual power cable to use. I just have a OTG cable, a powered USB hub. I think that the dual power cable need for charge the N1. May be I will try to make a cable by myself to continue.

Thank u so much for your help.
[Nexus One General] @seb:
I connected the +5v inputpin in my hub with the vcc pin from the input usb port to power the n1. I can post some pictures later.
[Nexus One General] tphuc_ibc:
May be my Rom wrong version. I make a dual power cable, and try again, but till problem:

su
#su
# insmod /sdcard/drivers/usb/core/usbcore.ko
# insmod /sdcard/drivers/usb/host/ehci-hcd.ko
# insmod /sdcard/drivers/usb/storage/usb-storage.ko
# mount -t vfat /dev/block/sda1 /mnt/sdcard/usb-storage
mount: mounting /dev/block/sda1 on /mnt/sdcard/usb-storage failed: Invalid argument

How can I fix that ? Or may be you can give me a nandroid backup to try.

Thank so much
[Nexus One General] @seb:
Try "mount -t vfat /dev/block/sda1 /sdcard/usb/storage"

If you have a usb mouse insmod /sdcard/drivers/hid/usbhid/usbhid.ko
[Nexus One General] robross0606:
Strange wifi behavior

I have everything working fairly well and have created a ROM with all the features built-in, including auto-loading the modules at boot time.

However, when I do this with two USB ethernet adapters, I get some interesting behavior on the wifi adapter. The wifi resets over and over again, attempting to negotiate a connection.

Examining dmesg yields this:

<4>[ 231.058715] wifi_set_power = 1
<4>[ 231.058959] mahimahi_wifi_power: 1
<4>[ 231.434265] wifi_set_carddetect = 1
<6>[ 231.434417] mahimahi_wifi_set_carddetect: 1
<7>[ 231.434600] mmc0: card_present 1
<6>[ 231.434722] mmc0: Slot status change detected (0 -> 1)
<4>[ 231.435852]
<4>[ 231.435882] Dongle Host Driver, version 4.218.223.0
<7>[ 233.990203] mmc0: queuing CIS tuple 0x91 length 3
<6>[ 233.990661] mmc0: new high speed SDIO card at address 0001
<4>[ 233.999694] DHD: dongle ram size is set to 294912(orig 294912)
<4>[ 234.269836] eth2: Broadcom Dongle Host Driver mac=f8:db:7f:97:5e:48
<6>[ 235.562011] eth0: link down
<7>[ 235.564178] msm_hsusb msm_hsusb: reused qh c6e9bca0 schedule
<7>[ 235.564392] usb 1-1.1: link qh128-0001/c6e9bca0 start 3 [1/0 us]
<6>[ 235.566314] ADDRCONF(NETDEV_UP): eth0: link is not ready

As you can see, for some reason the Android device mistakenly tries to bring up "eth2" with the bcm4329 driver. It knows that this is "eth2" because the printk() spits that out. It then goes on to say that "eth0" is down.

If I temporarily disconnect eth2, the wifi will negotiate correctly and then I can reconnect the eth1 and eth2 adapter and everything works fine. However, I need this to work automatically without fiddling with connections like that.

Looks like some sort of bug or incorrect assumption is being made either in the kernel source or in a startup script (wpa_supplicant?). Perhaps assuming the wifi adapter is always the "last" device?

Anyone have any ideas where to look for this bug?
[Nexus One General] @seb:
Sorry, I can´t help you with your problems, but I would like to try your Rom, because I use CM6 and the camera, the flashlite and wlan aren´t working with the hostmode-kernel.