Jump to content

External USB Devices


Guest forforum

Recommended Posts

Guest forforum

I have started an attempt to connect external USB devices to the V9 and had some success. There are still some issues and I hope someone with more Android/Linux experience can help to resolve them.

The story so far is

  • I recompiled the kernel (pulled from Kallt_Kaffe's github) with USB host/OTG support, flashed on the V9 with no problems
  • It will not work with non-powered USB devices, looks like the V9 is not supplying power to the micro USB port
  • If I plugged a powered device in after booting, the V9 reboots
  • I need to connect a powered USB hub (I guess any powered USB devices will do) and restart the V9 for it to use any of the devices plugged into the hub. So far USB flash stick, USB hard disk mouse, and keyboard worked.
  • I used the Q5_USB_Memory_Manager.apk to mount USB disks. It works with FAT32 drives. To mount NTFS drive, i need to mount it in terminal (and I can use an USB keyborad to type) because the umask wasn't set correctly by the app.
  • I also have the Huawei S7 (a similar grade device), Other than the NTFS mounting issue, it does not have the other problems.

Any help or suggestions will be much appreciated.

Edit: Now, I can use a powered device without re-starting the tab. All I have to do is to plug the hub in first and then supply power to the hub. Main hurdle now is how to get the V9 to supply power to the USB devices.

Edited by forforum
Link to comment
Share on other sites

Guest solidtudor

Nice to hear. I really want to test this out

So.. are you going to post the modified files?

Edited by solidtudor
Link to comment
Share on other sites

Guest forforum

Nice to hear. I really want to test this out

So.. are you going to post the modified files?

I was trying to sort out the power issue first. I still have intermittent reboot problem when plugging power into the USB hub. You are welcome to try, but, I am not responsible for any problem this kernel may cause. To be safe, i would recommend you to plug the USB hub with power prior to power on the tab. Of course, you will need an OTG cable to connect the USB hub to the tab.

The kernel is based on Kallt_Kaffe's kernel source as at 17/7/2011, therefore, you must have his CM7 20110711 or later installed for this to work. You should have clock work recovery (4.0.0.8 or later) installed and KK's latest kernel on your SD card, in case you need to load KK's original kernel. Thanks to KK for his work and his help when I started on this.

The kernel install file is here.

You can find Q5 USB Memory Manger here.

To use the mouse

left click - press the screen

right click - back button

middle click - menu button

scroll wheel - up/down button

Enjoy!

Edited by forforum
Link to comment
Share on other sites

Guest solidtudor

I was trying to sort out the power issue first. I still have intermittent reboot problem when plugging power into the USB hub. You are welcome to try, but, I am not responsible for any problem this kernel may cause. To be safe, i would recommend you to plug the USB hub with power prior to power on the tab. Of course, you will need an OTG cable to connect the USB hub to the tab.

The kernel is based on Kallt_Kaffe's kernel source as at 17/7/2011, therefore, you must have his CM7 20110711 or later installed for this to work. You should have clock work recovery (4.0.0.8 or later) installed and KK's latest kernel on your SD card, in case you need to load KK's original kernel. Thanks to KK for his work and his help when I started on this.

The kernel install file is here.

You can find Q5 USB Memory Manger here.

To use the mouse

left click - press the screen

right click - back button

middle click - menu button

scroll wheel - up/down button

Enjoy!

Thanks foforum! I installed the modified kernel files without any problem. As you said, the device reboots when plugging power into the USB hub..

I will try my USB mouse and USB memory when I get time to do that, thanks again foforum I've been waiting long time for thiscool.gif

Link to comment
Share on other sites

Guest larsanders

Thanks for working on this. I just bought a battery powered USB hub (http://www.dealextreme.com/p/cable-style-dual-power-1000ma-usb-2-0-4-port-hub-13526 and an external battery) in addition to a host cable (http://cgi.ebay.com/Micro-USB-Host-Cable-MID-OTG-Left-Angled-/130543361525?pt=LH_DefaultDomain_0&hash=item1e64fd9df5) in case you don't get power-out working.

Link to comment
Share on other sites

  • 3 weeks later...
Guest kallt_kaffe
I have started an attempt to connect external USB devices to the V9 and had some success. There are still some issues and I hope someone with more Android/Linux experience can help to resolve them

I've now bought two different OTG adapters and a powered USB hub and I will start experiment with USB host mode when time allows.

Would you mind sharing the source files on what you've done so far?

EDIT: Nevermind. Just realized our source has what is needed allready and borrowed the config from your kernel... Looking good so far. :)

Link to comment
Share on other sites

Guest kallt_kaffe

Edit: Now, I can use a powered device without re-starting the tab. All I have to do is to plug the hub in first and then supply power to the hub. Main hurdle now is how to get the V9 to supply power to the USB devices.

I used your config on the latest kernel source and it works without reboots for me. There was an usb rebooting issue on the ZTE Blade that Tom solved by removed some cdrom emulation code and I added those change to the kernel repo 2011-07-15. It's possible that those changes fixed this issue.
Link to comment
Share on other sites

Guest forforum

I used your config on the latest kernel source and it works without reboots for me. There was an usb rebooting issue on the ZTE Blade that Tom solved by removed some cdrom emulation code and I added those change to the kernel repo 2011-07-15. It's possible that those changes fixed this issue.

You are right, the v9 kernel has built in otg support. The config file I used basically is borrowed from the Huawei S7. You may also noticed that I leave most of the driver in the kernel rather than compile them as modules, this was just for quick upload of the kernel for testing. At 4MB, it is a bit big.

I've been comparing the otg driver (msm72kotg.c) sources between the V9, the Blade and Huawei S7 to try to work out how the various bits work. My kernel hacking skill is very basic at best. So far, the changes I made did not make improve the situation a lot. The blade otg driver also works with the v9, no rebooting problem, but, you lost the USB peripheral mode. I haven't try your 2011-7-15 kernel, so not too sure whether it has the same issue. Hope you can work it out.

Link to comment
Share on other sites

Guest kallt_kaffe

I've only tested (and only added support for) usb hid and storage support and seems to work fine. The keyboard layout is US (or perhaps GB) but other than that it works as it should. I also tested to mount an USB flash drive.

Sometimes the tablet freezes when I insert the USB HUB or a device to the HUB but disconnecting and reconnecting usually helps. No reboots so far. The batterymeter got pretty much badword up once and claimed it only had 1% battery left (which wasn't true) and not even a restart resolved it so I was a bit worried that I had fried something but removing the battery and then booting into clockwork to wipe batterystats seems to have resolved it.

Any suggested uses for this other than storage and mouse/keyboard? What are you using on your tablets?

Link to comment
Share on other sites

Guest forforum

Sometimes the tablet freezes when I insert the USB HUB or a device to the HUB but disconnecting and reconnecting usually helps. No reboots so far. The batterymeter got pretty much badword up once and claimed it only had 1% battery left (which wasn't true) and not even a restart resolved it so I was a bit worried that I had fried something but removing the battery and then booting into clockwork to wipe batterystats seems to have resolved it.

I do not have battery issues. Actually, the powered hub charges the V9! I read that some powered hub does not pass power back to the host, may be that's why you did not have the rebooting issue. Can you check whether yours does? When I get a chance, I may disable the power from the USB A cable to see if I can duplicate your results. Also, do you have the peripheral mode back once you unplug the OTG cable?

Any suggested uses for this other than storage and mouse/keyboard? What are you using on your tablets?

As you know, the sound output of the V9 leaves a lot to be desired, the other thing I was trying to get working is USB sound. I have a Creative USB sound card, it half worked. The control knob on the sound card controls the volume of the V9, but, sound still comes out of the 3.5mm jack. May be the standard class 1 sound driver is not compatible or may be it is not possible. I've been busy lately with work and haven't look at it again.

The V9 is essentially a toy, to learn more about Android. Does get a bit of use when I am out and about or lying in bed, GPS, RDP, email, video, web browsing etc.

Edit: Un-soldered the power from the USB A side of the hub, and the V9 is not restarting when plugging and unpluging t he hub. But, the V9 won't be charged anymore! May be it is better to have the charging facility?

Edited by forforum
Link to comment
Share on other sites

Guest kallt_kaffe

I do not have battery issues. Actually, the powered hub charges the V9! I read that some powered hub does not pass power back to the host, may be that's why you did not have the rebooting issue. Can you check whether yours does? When I get a chance, I may disable the power from the USB A cable to see if I can duplicate your results. Also, do you have the peripheral mode back once you unplug the OTG cable?

Yes, my HUB does not power the tablet. Found a USB harddisk cable with an extra USB connect (for extra power) that I was able to use to get it to charge the tablet and with this I get reboots on connect too.

And yes, when I unplug the cable it switches back to peripheral mode automaticly.

As you know, the sound output of the V9 leaves a lot to be desired, the other thing I was trying to get working is USB sound. I have a Creative USB sound card, it half worked. The control knob on the sound card controls the volume of the V9, but, sound still comes out of the 3.5mm jack. May be the standard class 1 sound driver is not compatible or may be it is not possible. I've been busy lately with work and haven't look at it again.
The control knob propably uses USB HID but I doubt Android supports USB Audio out-of-the-box. That would propably need some tweaking in the audio libs.

But yes, the internal speakers are painfully bad. I bought a Creative D80 (BT speaker) and while the D80 likely isn't the best BT speaker it sure beats using the internal sound.

EDIT: I've managed to get USB disks to automount by looking at how it is setup for the Nook Color and the Advent Vega in CM7. Only tried with FAT32 so far. Going to compile a flash disk with NTFS and try that too.

Link to comment
Share on other sites

Guest forforum

Yes, my HUB does not power the tablet. Found a USB harddisk cable with an extra USB connect (for extra power) that I was able to use to get it to charge the tablet and with this I get reboots on connect too.

May be you can replace the msm72k_otg.c with the one from blade, it stops the reboot, but, I seemed to have lost peripheral mode. In the V9 driver, it handles the connection differently to the blade and those mods were done only late last year. May be you can look at the few routines at the end of the driver source to see if you can tweak it.

EDIT: I've managed to get USB disks to automount by looking at how it is setup for the Nook Color and the Advent Vega in CM7. Only tried with FAT32 so far. Going to compile a flash disk with NTFS and try that too.

When you mount ntfs, make sure you use the -o umask=000 option, otherwise, you can only see the files in terminal with su. File explorers won't see the disk without that option.

Link to comment
Share on other sites

Guest kallt_kaffe

Here's what I'm using right now: http://www.mediafire...cmy93ncr4no9fso

This is a complete CM7 install as it has changes also to vold.fstab, init.v9.rc and build.prop.

USB disks (FAT) are automaticly mounted to /mnt/usbdisk. They can also be safely unmounted in Settings->Storage.

USB-storage and HID support are compiled into the kernel. NTFS is also supported by the kernel but not by vold.

EDIT: Attached a vold where I've added support for automounting NTFS. Just replace /system/bin/vold with the new version.

vold.zip

Link to comment
Share on other sites

Guest forforum

New version using the new vold (se above) and also codepage i kernel has been changed to UTF8 (fixes swedish character problems with both NTFS and also CIFS mounts for me, not sure if it messes up something else for others?)

http://www.mediafire...4v7mcdgjb5bfqy7

Fantastic, will give it a try tonight..

BTW, is this kernel still having the reboot problem when plugging in a powered hub?

Link to comment
Share on other sites

Guest kallt_kaffe
BTW, is this kernel still having the reboot problem when plugging in a powered hub?

Yes it still does that, haven't changed anything except the kernel config so far. It also seems to freeze when recovering from suspend. A workaround is to go into the development settings and check "always on" to make sure it doesn't go into sleep while recieving power.

Btw, your Huawei S7, does it provide power through the USB-port. In other words, can it use USB devices directly without using a self-powered HUB?

Link to comment
Share on other sites

Guest forforum

Yes it still does that, haven't changed anything except the kernel config so far. It also seems to freeze when recovering from suspend. A workaround is to go into the development settings and check "always on" to make sure it doesn't go into sleep while recieving power.

Btw, your Huawei S7, does it provide power through the USB-port. In other words, can it use USB devices directly without using a self-powered HUB?

I noticed that too, if you have devices connected, it freezes everynow and then if the device goes to sleep. Please try the ZTE Blade msm72k_otg.c from here. It fixes reboot and freeze problems for me, but as I said before, I lost peripherals mode completely. Here is the compiled kernel based on your latest kernel soruce I always make sure I have your standard kernel on my SD card to recover from.

The Huawei S7 supplies enough power to drive keyboard, mouse and USB sticks. USB hard disks need to be powered. I think the OTG spec says power out should be between 8MA and 100MA. The difference between the Huawei S7 and the ZTE V9 is that the S7 has a dedicated charge port (a 2.5mm jack), therefore it can safely supply power to micro USB port when host mode is enabled. At the moment, my S7 is mounted in my car, I can play media easily by plugging in a FAT formatted USB stick.

Link to comment
Share on other sites

Guest kallt_kaffe

The freezing after suspend is propably the biggest show-stopper right now. I'll do some source comparing to see what I can find. One solution could be to add a wakelock when it switches to OTG mode to prevent it from going to sleep when host mode is active.

I've posted the NTFS vold patch up for review here: http://review.cyanogenmod.com/#change,7457

Link to comment
Share on other sites

But yes, the internal speakers are painfully bad. I bought a Creative D80 (BT speaker) and while the D80 likely isn't the best BT speaker it sure beats using the internal sound.

Just a quick note for the those in Australia (where most MyTab owners will be). Aldi will be doing the Creative Bluetooth Speaker (D100 I think) for $49.99 next Thursday. Seems like a good price in comparison with other Oz prices for the unit.

http://www.aldi.com.au/au/html/offers/2827_18836.htm

I now return you to your regularly scheduled ROM hacking discussions...

Link to comment
Share on other sites

Guest kallt_kaffe

I noticed that too, if you have devices connected, it freezes everynow and then if the device goes to sleep. Please try the ZTE Blade msm72k_otg.c from here.

Reboot problem seems to be fixed (mostly) by using that version, however the suspend problem remained but I added a wake lock to prevent suspend when in host mode and it seems to do the trick.

I did not lose peripheral mode using the older msms72k_otg.c. It still happily accepts adb and usb mounting through normal USB connection if I switch cables.

I'll compile a new, complete, cm7 with the new changes for you to try.

Link to comment
Share on other sites

Guest kallt_kaffe

Please try this build: http://www.mediafire...c7mht854v79l08t

I very seldoms reboot when inserting cable and suspend problems should be gone (as it doesn't enter suspend while in usb host mode).

For me the USB peripheral mode is still working fine when I switch cables.

Let me know how it works for you.

EDIT: With lockscreen enabled the UI still freezes on suspend/resume although it should be possible for it to suspend. It seems it is just the UI that freezes (adb still works) so maybe it has something to do with having a mouse attached. I'l try with just an flash disk to see if it changes it's behaviour.

Link to comment
Share on other sites

Guest kallt_kaffe

It seems the UI freezes happens only when mouse is attached and only in portrait mode. Doesn't matter if lockscreen is enabled or not but since the lockscreen forces portrait it triggers the bug.

USB Storage and USB Keyboard doesn't cause this. Propably a bug in the input system.

So basicly, it works quite OK right now apart from the mouse-ui-freeze-thing.

Link to comment
Share on other sites

Guest forforum

Here's the latest version (without the not needed wakelock): http://www.mediafire...k5y6l08ynq0rnbh

WOW, you've been working hard!!

Installed the 2011-08-19 built, works fine. Peripheral mode works. However, OTG mode sometimes doesn't come on. Plug in hub first and then power helps, as you said in the Swedish forum.

Which OTG driver did you use? If it is the Blade driver, it must be the extra drivers I loaded with my config that cause the peripheral mode problem.

Link to comment
Share on other sites

Guest kallt_kaffe

WOW, you've been working hard!!

Installed the 2011-08-19 built, works fine. Peripheral mode works. However, OTG mode sometimes doesn't come on. Plug in hub first and then power helps, as you said in the Swedish forum.

Which OTG driver did you use? If it is the Blade driver, it must be the extra drivers I loaded with my config that cause the peripheral mode problem.

I used the V9 driver but in the end I removed all the differences so it ended up to be identical to the Blade driver. Not sure why you lost peripheral mode.
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.