[14 Apr 2012][USER/DEV] USB Host Support & Development [CM7/CM9]

Search This thread

Dj-Gutz

Senior Member
Sep 1, 2010
198
83
Tel Aviv
Nook Color USB Host Support & Development Thread

What is USB Host mode?
The ability to connect your day-to-day USB devices to your Nook Color

Is it the same as OTG ( On-The-Go )?
Principally YES , Technically NO
USB OTG has an id-pin that allows the host to detect automatically the state it should be and enable charging & hosting
On the nook , the id-pin is not connected so we have to control the states ourselves ( Nook Color Tweaks )
This is why an OTG cable is not needed ( but should work as well )

Purpose of this thread
As you might know , dalingrin and verygreen brought us USB Host support some time ago
This thread will rely on that original thread , but will bring some order so we can continue explore & develop.
CM9 ( ICS ) introduced us the USB HOST API , and much more support based on Honeycomb
I personally moved completely to CM9 since it's far superior IMO ( even at the current state of development )
so CM7 info is based on my own past experience & user experiences posted.

Current Status​

please share your experience here
Nook Color USB HOST Device Compatibility List
Standard Support
  • External Storage ( Disk-On-Key / Card-Reader / HDD )
  • Keyboards & Mice
  • Game Controllers
  • Custom HID Input Controllers
  • DSLR & VDSLR Cameras
  • Audio Output

For detailed info & other devices go to post 2 - Possibilities include : Webcams , GPS , BT , 3G , DVB-T and more...

MUST READ!
Before posting an issue please SEARCH both this & the original thread​

Tools Needed
  • microUSB to USB Female adapter / USB Gender Changer
  • Generic microUSB cable ( same as your other android )

  • z7zUD9NtEmh3ZJqKQEK2vCe8a9C8l4Izrz4ZQi0pfT50X9Bx_VNUJzsvAgCV7r6Q3Q=w78-h78

    Nook Color Tweaks
  • USB Hub ( Optional for some , Required for others )
External VBus
External VBus mode will enable you to use an external power source to charge the nook while using USB Host mode
This mode is quite buggy but still usable - READ before using a powered hub
When you make it to ON, the battery charger pump is opened and connected to vbus terminals. In this state it is safe to connect nook to a power source, usb host will work and the battery should be charging at the same time.
Using the OEM cable to enable 2A charge
As far as I know , the OEM cable doesn't seem to work with USB Host mode
And as a result of this ( & most if not all usb hubs specs ) - you can't charge the nook with 2A using External VBus

Why do some devices REQUIRE an external hub?
The maximum current the nook can supply is 100mA
If your usb device require more than 100mA , External hub is REQUIRED
Read post 3 to find out how to diagnose power requirements

Important : Using a non-powered hub can mask the power requirements for some devices!

Tested Hubs
Testimonials : Belkin 4 Port Hub | Belkin FSU237 7 Port Powered Hub
degORPehtgW4BWvodkITOUs1bDBsclJ2fge6lUcHcxznEA2s-WhoUnJoAf1fzldWEcFL1ceyqZpDv2UwWyln8L2RtaaPnQur_JE_-rdOlMkFwVAyeIuZ9qHDQIWeCapo62qAHDci_ITInM-IdgmTle95Ut3p

^ That is what I use ( Link for ex. )

Needs Attention
  • Charger code bugs involving External VBus
  • "Charging" status while using External VBus
  • Home-Screen Widget
  • Audio Input

This is a Work-In-Progress
since I don't have much time , I'll be glad to see this as a community effort , so if you have any info to share feel free to do so​
 
Last edited:

Dj-Gutz

Senior Member
Sep 1, 2010
198
83
Tel Aviv
USB Devices Support Extended Info

USB Devices Support Extended Info
There are Countless possible uses , Currently only 6 known to work
please share your experience here
Nook Color USB HOST Device Compatibility List
Standard Support​
  • External Storage - Disk-On-Key / Card-Reader / HDD

    CM7 - FAT32 ( should Auto-Mount , CM7 users please confirm )
    CM9 - FAT32 / NTFS ( Mount using StickMount / Drive Mount )

    *NTFS support is not native , so keep reading this post if you plan to use it

  • Keyboards & Mice
    Most should be supported - Re-Mapping how-to on post 3

  • Game Controllers
    CM7 - Try Gamepad IME , no reports on successful attempts
    Testimonials : Link 1 | Link 2 | Link 3 | Link 4 | Link 5 | Link 6

    CM9
    hK62pab0jAutK45wsmZV0ljdp5ncKx-4dJ4Syn-YbkOLKPqeA-Q8PZ0LChZ69NL10w=w78-h78

    USB/BT Joystick Center
    USB Joystick Center has Driver-Settings included for these Devices (ready to use, others you can create at your own):
    Wireless:
    - PS3 Controller without root (* CSR Bluetooth 2.x/EDR+ USB Stick is needed)
    - X360 Controller ("Microsoft Wireless Gaming Receiver for PC" USB is needed)
    - Bluetooth Keyboards
    - iCade
    - iControlPad (SPP Mode)
    - PhoneJoy
    - Wii Remotes 1-4 + Nunchuck + Classic
    - Zeemote
    * Please read the Sixaxis pairing instructions on the help site of the app!

    USB:
    - X360 Controller - Wired
    - PS3 Sixaxis - Wired
    - Hyperkin N64 Moonlight Controller
    - Logitech (Rumble, F310, F710)
    - Microsoft Sidewinder 2 Precision
    - Trust GXT 24
    - X360 Rockband: USB Guitars + Drums
    - N64 "Controller Adapter for PC USB" (for 2 Controllers)
    - PSX 1/2 "USB Gamepad Converter Dualschock" with 2 Player support
    - PSX + N64 USB Dual Converter
    - SNES "Controller Adapter for PC USB"
    - C64/Atari/Amiga "Donalds USB-Joystickadapter" for 2 Players
    - C64/128/A600 "Keyrah" USB Keyboard + 2 Joysticks Adapter
    - Stelladapter 2600 to USB
    - "PC/Gamepad/Joystick Adapter" (15 Pin D-Sub)
    - PSX - USB 4 "Buzz Junior" Wired Controllers
    - PSX 1/2 (EAXUS) "Super Dual Box Advanced" Adapter for PC USB

    If you have an adapter that is not natively supported and you have trouble to use it, enter the support forum.

  • Custom HID Input Controllers
    You can try to make a custom "driver" in USB/BT Joystick Center ( see Game Controllers ^ )
    Or , Go to post 3 which describes the manual way using the key layout file if your input controller contain mainly buttons

  • DSLR & VDSLR Cameras
    Many apps on Google Play , Here is what I could find
    -Rr0Uz1jS0pWcgg6VtP4XRVlXl-ip48R7SAivbA1GahojNUBCE_kBIb5y34TKYbw82I=w78-h78

    DSLR Controller (BETA) - Known to work

    Remote Your Cam USB Lite
    ML Controller
    DslrDashboard 0.25.3 beta

  • Audio Output
    If your device doesn't require special drivers , and recognized as a USB Audio on your PC - It should work
    Testimonials : Logitech DAC A-5572A | Beresford TC-7520SE Caiman | FiiO E7
Ready For User Testing

Research & Development
USB Host is a bit of a challenge , Since it lives in both the kernel & userspace
Some devices require kernel "attention" , but some can use USB Host API

My advice is to try the API route first since it's native to ICS in general and it's cross-device
USB Host API is pretty much the same as libusb , so linux devs should be comfortable with it
Linux
Android
External Storage
To use NTFS file-system on CM9 you need to do the following :

  • Download the attached zip @ the bottom of this post
  • Extract fuse.ko ( credits : fattire ) & Place it in your sdcard ( eg. /sdcard/fuse.ko )
  • Open terminal session
    Code:
    insmod /sdcard/fuse.ko
  • Mount
*I can picture a fuse kernel module "injector" as an option in Nook Tweaks - if you up for it you can find the source in post 3

Audio Output
Although audio output is hard-wired in the kernel , There is still room for improvement
Once it's connected it takes control over all audio output
Novo7 Advanced devs for example have made a software mod to allow basic control via userspace
Drivers and libraries for NOVO7A (with usb audio)

Also , You can support google making it mainstream by starring this issue
Enable USB audio on the Galaxy Nexus (or any Android 4.0 device)

Audio Input
Relevant Info : Link 1 | Link 2 | Link 3 | Link 4
Testimonials : usb audio 7.1 | generic USB audio dongle | Logitech USB Headset 360 , More Info | MS Lifecam cinema | USB2.0 7.1CH Sound Adapter | Plantronics USB headset

I've been experimenting with my MicMate + ECM8000 combo on CM9 not long ago
I was able to use RTA apps to some extent , But recording apps FC
This needs further research

Webcams & Video Input
Last Update: 09/05/12
CM7 Relevant Info : Link 1 | Link 2 | Link 3

Kernel support is present already :
CONFIG_V4L_USB_DRIVERS=y
CONFIG_USB_VIDEO_CLASS=y
CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

Here is a source for an app that would allow you to view the video feed through JNI - Usage of USB webcam with customized Galaxy Nexus & Iconia Tab A500
You can download it compiled SimpleWebCam.apk ( Credits : bigrushdog )

Camera App/Skype/Etc. shouldn't work , For that we need something that will emulate the output as internal camera
9/5 - Camera HAL on the works


GPS
CM7 Relevant Info : Link 1
Testimonials : GlobalSat BU-353 , More Info

CM9 Relevant Info : Link 1

DVB-T
Last Update: 06/05/12
  • Android DVB-T - I can't download this app from Google Play ( This item is not compatible with your device ) , So I can't test it.
  • DroidTV ( In Development ) - Follow the git for progress , APK ( Still needs compiled modules )
Related Modules : dvb-core.ko , dvb-usb.ko , dvb-pll.ko , mxl5005s.ko , tda18271.ko , qt1010.ko , mt2060.ko , af9013.ko , tda18218.ko , dvb-usb-af9015.ko

Microsoft Kinect
Last Update: 02/05/12
There is a lot of "hidden" potential using Kinect
Here is an interesting project , he has plans for Android as well.
Reverse Parking Assist Using Microsoft Kinect

3G
Iconia A500 | Archos Gen8

BT
Relevant Info : Link 1

Related Modules : bluetooth.ko , btusb.ko , rfcomm.ko , bnep.ko , sco.ko

Phone Tether
Tether Android Phone (Desire) to Android Tablet (Iconia A500) via USB Cable

Video Output
Last Update: 02/05/12

Serial Port
Last Update: 06/05/12

Midi Controller
Last Update: 06/05/12

Scanners
Build native GNU/Linux applications: the easy way

Pico Projectors
An Open Source driver for USB pico projectors

IR
Last Update: 02/05/12
Does USB IR Transciever work with Android?
 

Attachments

  • fuse.zip
    32.3 KB · Views: 266
Last edited:

Dj-Gutz

Senior Member
Sep 1, 2010
198
83
Tel Aviv
Diagnostics & Development

Diagnostics & Development

I take no responsibility.............. DO IT ON YOUR OWN RISK!

This part of the thread will be dedicated to reading and diagnosing logs , and more advanced stuff for developers
most of the usb-related stuff are using kernel messages to let us know their status
to read kernel messages we can use Android Debug Bridge ( or ADB )
the original protocol is used via USB , but we already use it to connect our usb devices so we need a different route

So , you should basically know 2 apps :
9JM87niVPnMAubhTHyq_kNXUlDT2HQHD-16Pi2avKrSQXCX28erLu93hc2jL8gakPuz9=w78-h78

adbWireless enables a wireless ADB connection , just like USB so you can view logs on your PC
VLNgVg-y2w7KJ_E9Ta6Mddr5HcYGqDod94fMjbWmuR7f6WrCrrqnMRRRluVlNPnv08s=w78-h78

Android Terminal Emulator will let you use Android's built-in Linux command line shell right on the nook itself.

It doesn't matter what you choose , those are just 2 different ways to view the same thing - and you will know more by the end of this post
I'll try to make this post appeal to both the command-line and GUI guys

Command-Line
You can use the following on both CM7 & CM9
So , open your app of choice ( adbWireless / Terminal Emulator / Whatever ) and establish a connection ( shell ) if needed

First you should start with
Code:
su

Since we are dealing with kernel stuff , you need superuser permissions.
this command will give you root access till the end of the session.
If you see ‘#’ - you already got root access
If you see ‘$’ - type ’su’ to get root access.

Now that we got root permissions we have read&write access to the system
Here is a list of relevant commands and their actions

Code:
[B]logcat[/B] - view the internal log of the Android system
[B]dmesg[/B] - view the message buffer of the kernel 
[B]cat /proc/kmsg[/B] - continuous dmesg ( to stop the log use ctrl+c )
[B]echo host > /sys/devices/platform/musb_hdrc/mode[/B] - usb host ON
[B]echo peripheral > /sys/devices/platform/musb_hdrc/mode[/B] - usb host OFF
[B]echo external > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus ON
[B]echo internal > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus OFF
[B]lsusb[/B] - list usb devices
[B]cat /proc/asound/cards[/B] - list audio devices

GUI
General :

HdL2tKsZlp8srVBKPL8q8eIpXXeCkhsbHqIKDQcfG2FY469f66Vo-DtVDsCCL5Xd4HY=w78-h78

Lumberjack - Log export and viewer
459Pn-5x-yPovWymi5KuPwEjuXZ3yTo-LuOR7nwESPXnMZNAMSsAdyPtf6OF-bIc8HY=h230


bLP0ea7V3kjLwJ9n8pxYZHb8Bgqpvn2XEu9JNi8vrv8eVDA5OWfryM5ZpnoP4ckyrF5A=w78-h78

CommandCenter - CM7 Support

USB HOST :

13D1Dh2Jjely0Onks8ScGd_TclHpd3lNqokeQ8tSpnVjcX0ZZjDTl9bo9RnidOHXMBY=w78-h78

USB Host Viewer
jgx8pEbhHkO4M13j3Z7TOoIpp1oxJxiWNV-dQ9OhkE8PQDwkfs1dwBM-KrYa_4UNIg=h230


xEBzcNdpy0iC4RtcJENvQrwGfzdovUjC9E5olaUGU99YMA2HWzHcF8-Qyr-aRFPg4_vA=w78-h78

USB Device Info

Y272D5fk7XtVwqM9H8RZUP-WW1slp-WCXRgT7ytheJKKCEbPu0UcE98BkbeEvsQ--J8=w78-h78

USB Host Diagnostics - CM7 Support

SEjNe6NaE325YTIQUtwzlQdHbjiiQeiAIh5fxXxcLTUHfXi_O7yk1h6P4lIPzuoPsQ=w78-h78

Usb Host Controller - CM7 Support

How To Diagnose Power Requirements ( 100mA limit )

As I stated earlier some devices require more than 100mA to become functional
in that case this can be easily spotted by looking at the logs ,
Enter cat /proc/kmsg on adb/terminal or watch dmesg log on lumberjack
Connect your usb device and look for the RED line :
Code:
<6>usb 1-1: Product: U3 Cruzer Micro
<6>usb 1-1: Manufacturer: SanDisk
<6>usb 1-1: SerialNumber: 0572710F0A803B8A
<7>usb 1-1: uevent
<7>usb 1-1: usb_probe_device
[B][COLOR="Red"]<6>usb 1-1: rejected 1 configuration due to insufficient available bus power[/COLOR][/B]
<4>usb 1-1: no configuration chosen from 1 choice
If you see it that means you need to connect an external power source ( hub for example )

Re-Mapping Input Buttons/Keys

Let's say you are using a full keyboard with Multimedia/Function keys or some kind of an HID device with buttons
And you want to map/re-map specific keys to do other functions in the system such as controlling volume , play/pause , go to home etc..

This is how you do it
  • Install KeyEvent Display
  • Connect your usb input device
  • Press the key you want to re-map and look for its scancode ( key code )
    406250441.jpg

    Here you can see I pressed FN+Print Screen keys on my logitech keyboard , and found out the their scancode is 127
  • Open your favorite file browser ( I use Root Explorer )
  • Navigate to /system/usr/keylayout
  • backup Generic.kl file!
  • Edit Generic.kl , look for the keycode you found and change it's command
    My original layout :
    259994947.jpg

    As you can see it's mapped as a menu key
    Now let's say for example I wanted this combination to trigger default music app , all I need is to change the highlighted line to
    Code:
    key 127    MUSIC
    If you see '#' in the start of the line , delete it to make the key active
    If your keycode doesn't exist - you can add it in a new line ( make sure it doesn't exist before you create a new line )
  • Save and Reboot! ( you must reboot for changes to take effect )

Since we are changing Generic.kl , almost every input device that is connected or present on the nook will be effected by the change
If at any step you find the hardware keys / keyboard not working properly - restore to your backup and reboot.

If you have more than 1 device with the same keycode and you need them to perform different actions you will have to create a specific key layout
More info can be found @ Key Layout Files

NOTE : This was tested on CM9 , I'm not sure this works on CM7 as well ( although probably not as generic.kl was introduced in HC )

Controlling USB Host & External VBus via Tasker
  • Install "Locale Execute" plug-in from the Market
  • In Tasker open "Tasks" and make a new one (e.g. "USB Host ON")
  • Category: Plugin Action: Execute
  • Give it a name on the label and push the edit button
  • Insert the command
    Code:
    @! echo host > /sys/devices/platform/musb_hdrc/mode
  • Apply

You can now test it , or use it in a profile of your choice.
Superuser App will ask for permission for *every single new command* you use in Locale Execute. No workaround.

221348553.png
997917157.png


Use these commands to control usb host & external vbus state
Code:
[B]@! echo host > /sys/devices/platform/musb_hdrc/mode[/B] - usb host ON
[B]@! echo peripheral > /sys/devices/platform/musb_hdrc/mode[/B] - usb host OFF
[B]@! echo external > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus ON
[B]@! echo internal > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus OFF

Control App Development
Nook Tweaks : Source
Nook-Color-usbhost-switcher ( verygreen's old app ) : Source

My Focus
  • GPS
  • Audio Input
  • DVB-T
  • Home-Screen Widget
 
Last edited:

Dj-Gutz

Senior Member
Sep 1, 2010
198
83
Tel Aviv
Yeah probably just the keylayout , the app will just make it easier I don't see why not give it a try , you can refund if it doesn't work
Or you can find a cracked version and if it works buy the app

If you want a "free" way use KeynrTracker.apk from this Thread
see if you can capture the key codes of the buttons
 

martian21

Senior Member
Sep 12, 2010
308
42
Fort Wayne, IN
I just tried it and the same... it lights but after half a second it just turns off... will it need external power?? I checked behind the controller and it says 5v - 400mA

Almost certainly will require external power. 400mA > 100 mA. Standard USB ports can source up to 500 mA so there are going to be a LOT of USB devices that don't work without external power on the NOOK.
 

ToiletDuck555

Senior Member
Sep 21, 2010
51
5
picture.php


Hacked this together from stuff I had on hand. Made gender changer from two travel usb kits for the female ends and the left over usb cable is soldered to the 5v+ and ground wires and connected to stock nook charger.

I can get the nook to charge or connect to devices like mouse or phone but not charge and connect at the same time. original goal was to use a mouse and charge simultaneously but for some reason I cant get it to work.

Also I can transfer files back and forth between nook and phone. Would like to be able to usb tether internet from phone to nook but doubt that is possible.
 
  • Like
Reactions: Dj-Gutz

ToiletDuck555

Senior Member
Sep 21, 2010
51
5
I don't remember if I ever tried charging without using a hub
can you try a powered hub with upstream port?

about usb tethering it might be possible , take a look at this
Tether Android Phone (Desire) to Android Tablet (Iconia A500) via USB Cable

Bought a powered hub and tried on the upstream ports, can get it to charge but not connect to mouse. I need to mess with it more, its kinda tricky to figure out what works.


Thanks for the link! lots of good info but alot of that is beyond me, I guess now is a good time to learn :p

---------- Post added 2nd February 2012 at 12:26 AM ---------- Previous post was 1st February 2012 at 11:50 PM ----------

USB Host Controller app- http://xdaforums.com/showthread.php?t=1468531

Shows info about what is connected and logs, I haven't tried using it to mount anything.
 

Dj-Gutz

Senior Member
Sep 1, 2010
198
83
Tel Aviv
Thread UPDATED

Post 1 & 2 - Minor updates
Post 3 -
  • LOG Reading & Diagnosing
  • How To Diagnose Power Requirements ( 100mA limit )
  • Controlling USB Host & External VBus via Tasker
  • Re-Mapping Input Buttons/Keys
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 8
    Nook Color USB Host Support & Development Thread

    What is USB Host mode?
    The ability to connect your day-to-day USB devices to your Nook Color

    Is it the same as OTG ( On-The-Go )?
    Principally YES , Technically NO
    USB OTG has an id-pin that allows the host to detect automatically the state it should be and enable charging & hosting
    On the nook , the id-pin is not connected so we have to control the states ourselves ( Nook Color Tweaks )
    This is why an OTG cable is not needed ( but should work as well )

    Purpose of this thread
    As you might know , dalingrin and verygreen brought us USB Host support some time ago
    This thread will rely on that original thread , but will bring some order so we can continue explore & develop.
    CM9 ( ICS ) introduced us the USB HOST API , and much more support based on Honeycomb
    I personally moved completely to CM9 since it's far superior IMO ( even at the current state of development )
    so CM7 info is based on my own past experience & user experiences posted.

    Current Status​

    please share your experience here
    Nook Color USB HOST Device Compatibility List
    Standard Support
    • External Storage ( Disk-On-Key / Card-Reader / HDD )
    • Keyboards & Mice
    • Game Controllers
    • Custom HID Input Controllers
    • DSLR & VDSLR Cameras
    • Audio Output

    For detailed info & other devices go to post 2 - Possibilities include : Webcams , GPS , BT , 3G , DVB-T and more...

    MUST READ!
    Before posting an issue please SEARCH both this & the original thread​

    Tools Needed
    External VBus
    External VBus mode will enable you to use an external power source to charge the nook while using USB Host mode
    This mode is quite buggy but still usable - READ before using a powered hub
    When you make it to ON, the battery charger pump is opened and connected to vbus terminals. In this state it is safe to connect nook to a power source, usb host will work and the battery should be charging at the same time.
    Using the OEM cable to enable 2A charge
    As far as I know , the OEM cable doesn't seem to work with USB Host mode
    And as a result of this ( & most if not all usb hubs specs ) - you can't charge the nook with 2A using External VBus

    Why do some devices REQUIRE an external hub?
    The maximum current the nook can supply is 100mA
    If your usb device require more than 100mA , External hub is REQUIRED
    Read post 3 to find out how to diagnose power requirements

    Important : Using a non-powered hub can mask the power requirements for some devices!

    Tested Hubs
    Testimonials : Belkin 4 Port Hub | Belkin FSU237 7 Port Powered Hub
    degORPehtgW4BWvodkITOUs1bDBsclJ2fge6lUcHcxznEA2s-WhoUnJoAf1fzldWEcFL1ceyqZpDv2UwWyln8L2RtaaPnQur_JE_-rdOlMkFwVAyeIuZ9qHDQIWeCapo62qAHDci_ITInM-IdgmTle95Ut3p

    ^ That is what I use ( Link for ex. )

    Needs Attention
    • Charger code bugs involving External VBus
    • "Charging" status while using External VBus
    • Home-Screen Widget
    • Audio Input

    This is a Work-In-Progress
    since I don't have much time , I'll be glad to see this as a community effort , so if you have any info to share feel free to do so​
    6
    USB Devices Support Extended Info

    USB Devices Support Extended Info
    There are Countless possible uses , Currently only 6 known to work
    please share your experience here
    Nook Color USB HOST Device Compatibility List
    Standard Support​
    • External Storage - Disk-On-Key / Card-Reader / HDD

      CM7 - FAT32 ( should Auto-Mount , CM7 users please confirm )
      CM9 - FAT32 / NTFS ( Mount using StickMount / Drive Mount )

      *NTFS support is not native , so keep reading this post if you plan to use it

    • Keyboards & Mice
      Most should be supported - Re-Mapping how-to on post 3

    • Game Controllers
      CM7 - Try Gamepad IME , no reports on successful attempts
      Testimonials : Link 1 | Link 2 | Link 3 | Link 4 | Link 5 | Link 6

      CM9
      hK62pab0jAutK45wsmZV0ljdp5ncKx-4dJ4Syn-YbkOLKPqeA-Q8PZ0LChZ69NL10w=w78-h78

      USB/BT Joystick Center
      USB Joystick Center has Driver-Settings included for these Devices (ready to use, others you can create at your own):
      Wireless:
      - PS3 Controller without root (* CSR Bluetooth 2.x/EDR+ USB Stick is needed)
      - X360 Controller ("Microsoft Wireless Gaming Receiver for PC" USB is needed)
      - Bluetooth Keyboards
      - iCade
      - iControlPad (SPP Mode)
      - PhoneJoy
      - Wii Remotes 1-4 + Nunchuck + Classic
      - Zeemote
      * Please read the Sixaxis pairing instructions on the help site of the app!

      USB:
      - X360 Controller - Wired
      - PS3 Sixaxis - Wired
      - Hyperkin N64 Moonlight Controller
      - Logitech (Rumble, F310, F710)
      - Microsoft Sidewinder 2 Precision
      - Trust GXT 24
      - X360 Rockband: USB Guitars + Drums
      - N64 "Controller Adapter for PC USB" (for 2 Controllers)
      - PSX 1/2 "USB Gamepad Converter Dualschock" with 2 Player support
      - PSX + N64 USB Dual Converter
      - SNES "Controller Adapter for PC USB"
      - C64/Atari/Amiga "Donalds USB-Joystickadapter" for 2 Players
      - C64/128/A600 "Keyrah" USB Keyboard + 2 Joysticks Adapter
      - Stelladapter 2600 to USB
      - "PC/Gamepad/Joystick Adapter" (15 Pin D-Sub)
      - PSX - USB 4 "Buzz Junior" Wired Controllers
      - PSX 1/2 (EAXUS) "Super Dual Box Advanced" Adapter for PC USB

      If you have an adapter that is not natively supported and you have trouble to use it, enter the support forum.

    • Custom HID Input Controllers
      You can try to make a custom "driver" in USB/BT Joystick Center ( see Game Controllers ^ )
      Or , Go to post 3 which describes the manual way using the key layout file if your input controller contain mainly buttons

    • DSLR & VDSLR Cameras
      Many apps on Google Play , Here is what I could find
      -Rr0Uz1jS0pWcgg6VtP4XRVlXl-ip48R7SAivbA1GahojNUBCE_kBIb5y34TKYbw82I=w78-h78

      DSLR Controller (BETA) - Known to work

      Remote Your Cam USB Lite
      ML Controller
      DslrDashboard 0.25.3 beta

    • Audio Output
      If your device doesn't require special drivers , and recognized as a USB Audio on your PC - It should work
      Testimonials : Logitech DAC A-5572A | Beresford TC-7520SE Caiman | FiiO E7
    Ready For User Testing

    Research & Development
    USB Host is a bit of a challenge , Since it lives in both the kernel & userspace
    Some devices require kernel "attention" , but some can use USB Host API

    My advice is to try the API route first since it's native to ICS in general and it's cross-device
    USB Host API is pretty much the same as libusb , so linux devs should be comfortable with it
    Linux
    Android
    External Storage
    To use NTFS file-system on CM9 you need to do the following :

    • Download the attached zip @ the bottom of this post
    • Extract fuse.ko ( credits : fattire ) & Place it in your sdcard ( eg. /sdcard/fuse.ko )
    • Open terminal session
      Code:
      insmod /sdcard/fuse.ko
    • Mount
    *I can picture a fuse kernel module "injector" as an option in Nook Tweaks - if you up for it you can find the source in post 3

    Audio Output
    Although audio output is hard-wired in the kernel , There is still room for improvement
    Once it's connected it takes control over all audio output
    Novo7 Advanced devs for example have made a software mod to allow basic control via userspace
    Drivers and libraries for NOVO7A (with usb audio)

    Also , You can support google making it mainstream by starring this issue
    Enable USB audio on the Galaxy Nexus (or any Android 4.0 device)

    Audio Input
    Relevant Info : Link 1 | Link 2 | Link 3 | Link 4
    Testimonials : usb audio 7.1 | generic USB audio dongle | Logitech USB Headset 360 , More Info | MS Lifecam cinema | USB2.0 7.1CH Sound Adapter | Plantronics USB headset

    I've been experimenting with my MicMate + ECM8000 combo on CM9 not long ago
    I was able to use RTA apps to some extent , But recording apps FC
    This needs further research

    Webcams & Video Input
    Last Update: 09/05/12
    CM7 Relevant Info : Link 1 | Link 2 | Link 3

    Kernel support is present already :
    CONFIG_V4L_USB_DRIVERS=y
    CONFIG_USB_VIDEO_CLASS=y
    CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

    Here is a source for an app that would allow you to view the video feed through JNI - Usage of USB webcam with customized Galaxy Nexus & Iconia Tab A500
    You can download it compiled SimpleWebCam.apk ( Credits : bigrushdog )

    Camera App/Skype/Etc. shouldn't work , For that we need something that will emulate the output as internal camera
    9/5 - Camera HAL on the works


    GPS
    CM7 Relevant Info : Link 1
    Testimonials : GlobalSat BU-353 , More Info

    CM9 Relevant Info : Link 1

    DVB-T
    Last Update: 06/05/12
    • Android DVB-T - I can't download this app from Google Play ( This item is not compatible with your device ) , So I can't test it.
    • DroidTV ( In Development ) - Follow the git for progress , APK ( Still needs compiled modules )
    Related Modules : dvb-core.ko , dvb-usb.ko , dvb-pll.ko , mxl5005s.ko , tda18271.ko , qt1010.ko , mt2060.ko , af9013.ko , tda18218.ko , dvb-usb-af9015.ko

    Microsoft Kinect
    Last Update: 02/05/12
    There is a lot of "hidden" potential using Kinect
    Here is an interesting project , he has plans for Android as well.
    Reverse Parking Assist Using Microsoft Kinect

    3G
    Iconia A500 | Archos Gen8

    BT
    Relevant Info : Link 1

    Related Modules : bluetooth.ko , btusb.ko , rfcomm.ko , bnep.ko , sco.ko

    Phone Tether
    Tether Android Phone (Desire) to Android Tablet (Iconia A500) via USB Cable

    Video Output
    Last Update: 02/05/12

    Serial Port
    Last Update: 06/05/12

    Midi Controller
    Last Update: 06/05/12

    Scanners
    Build native GNU/Linux applications: the easy way

    Pico Projectors
    An Open Source driver for USB pico projectors

    IR
    Last Update: 02/05/12
    Does USB IR Transciever work with Android?
    4
    Diagnostics & Development

    Diagnostics & Development

    I take no responsibility.............. DO IT ON YOUR OWN RISK!

    This part of the thread will be dedicated to reading and diagnosing logs , and more advanced stuff for developers
    most of the usb-related stuff are using kernel messages to let us know their status
    to read kernel messages we can use Android Debug Bridge ( or ADB )
    the original protocol is used via USB , but we already use it to connect our usb devices so we need a different route

    So , you should basically know 2 apps :
    9JM87niVPnMAubhTHyq_kNXUlDT2HQHD-16Pi2avKrSQXCX28erLu93hc2jL8gakPuz9=w78-h78

    adbWireless enables a wireless ADB connection , just like USB so you can view logs on your PC
    VLNgVg-y2w7KJ_E9Ta6Mddr5HcYGqDod94fMjbWmuR7f6WrCrrqnMRRRluVlNPnv08s=w78-h78

    Android Terminal Emulator will let you use Android's built-in Linux command line shell right on the nook itself.

    It doesn't matter what you choose , those are just 2 different ways to view the same thing - and you will know more by the end of this post
    I'll try to make this post appeal to both the command-line and GUI guys

    Command-Line
    You can use the following on both CM7 & CM9
    So , open your app of choice ( adbWireless / Terminal Emulator / Whatever ) and establish a connection ( shell ) if needed

    First you should start with
    Code:
    su

    Since we are dealing with kernel stuff , you need superuser permissions.
    this command will give you root access till the end of the session.
    If you see ‘#’ - you already got root access
    If you see ‘$’ - type ’su’ to get root access.

    Now that we got root permissions we have read&write access to the system
    Here is a list of relevant commands and their actions

    Code:
    [B]logcat[/B] - view the internal log of the Android system
    [B]dmesg[/B] - view the message buffer of the kernel 
    [B]cat /proc/kmsg[/B] - continuous dmesg ( to stop the log use ctrl+c )
    [B]echo host > /sys/devices/platform/musb_hdrc/mode[/B] - usb host ON
    [B]echo peripheral > /sys/devices/platform/musb_hdrc/mode[/B] - usb host OFF
    [B]echo external > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus ON
    [B]echo internal > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus OFF
    [B]lsusb[/B] - list usb devices
    [B]cat /proc/asound/cards[/B] - list audio devices

    GUI
    General :

    HdL2tKsZlp8srVBKPL8q8eIpXXeCkhsbHqIKDQcfG2FY469f66Vo-DtVDsCCL5Xd4HY=w78-h78

    Lumberjack - Log export and viewer
    459Pn-5x-yPovWymi5KuPwEjuXZ3yTo-LuOR7nwESPXnMZNAMSsAdyPtf6OF-bIc8HY=h230


    bLP0ea7V3kjLwJ9n8pxYZHb8Bgqpvn2XEu9JNi8vrv8eVDA5OWfryM5ZpnoP4ckyrF5A=w78-h78

    CommandCenter - CM7 Support

    USB HOST :

    13D1Dh2Jjely0Onks8ScGd_TclHpd3lNqokeQ8tSpnVjcX0ZZjDTl9bo9RnidOHXMBY=w78-h78

    USB Host Viewer
    jgx8pEbhHkO4M13j3Z7TOoIpp1oxJxiWNV-dQ9OhkE8PQDwkfs1dwBM-KrYa_4UNIg=h230


    xEBzcNdpy0iC4RtcJENvQrwGfzdovUjC9E5olaUGU99YMA2HWzHcF8-Qyr-aRFPg4_vA=w78-h78

    USB Device Info

    Y272D5fk7XtVwqM9H8RZUP-WW1slp-WCXRgT7ytheJKKCEbPu0UcE98BkbeEvsQ--J8=w78-h78

    USB Host Diagnostics - CM7 Support

    SEjNe6NaE325YTIQUtwzlQdHbjiiQeiAIh5fxXxcLTUHfXi_O7yk1h6P4lIPzuoPsQ=w78-h78

    Usb Host Controller - CM7 Support

    How To Diagnose Power Requirements ( 100mA limit )

    As I stated earlier some devices require more than 100mA to become functional
    in that case this can be easily spotted by looking at the logs ,
    Enter cat /proc/kmsg on adb/terminal or watch dmesg log on lumberjack
    Connect your usb device and look for the RED line :
    Code:
    <6>usb 1-1: Product: U3 Cruzer Micro
    <6>usb 1-1: Manufacturer: SanDisk
    <6>usb 1-1: SerialNumber: 0572710F0A803B8A
    <7>usb 1-1: uevent
    <7>usb 1-1: usb_probe_device
    [B][COLOR="Red"]<6>usb 1-1: rejected 1 configuration due to insufficient available bus power[/COLOR][/B]
    <4>usb 1-1: no configuration chosen from 1 choice
    If you see it that means you need to connect an external power source ( hub for example )

    Re-Mapping Input Buttons/Keys

    Let's say you are using a full keyboard with Multimedia/Function keys or some kind of an HID device with buttons
    And you want to map/re-map specific keys to do other functions in the system such as controlling volume , play/pause , go to home etc..

    This is how you do it
    • Install KeyEvent Display
    • Connect your usb input device
    • Press the key you want to re-map and look for its scancode ( key code )
      406250441.jpg

      Here you can see I pressed FN+Print Screen keys on my logitech keyboard , and found out the their scancode is 127
    • Open your favorite file browser ( I use Root Explorer )
    • Navigate to /system/usr/keylayout
    • backup Generic.kl file!
    • Edit Generic.kl , look for the keycode you found and change it's command
      My original layout :
      259994947.jpg

      As you can see it's mapped as a menu key
      Now let's say for example I wanted this combination to trigger default music app , all I need is to change the highlighted line to
      Code:
      key 127    MUSIC
      If you see '#' in the start of the line , delete it to make the key active
      If your keycode doesn't exist - you can add it in a new line ( make sure it doesn't exist before you create a new line )
    • Save and Reboot! ( you must reboot for changes to take effect )

    Since we are changing Generic.kl , almost every input device that is connected or present on the nook will be effected by the change
    If at any step you find the hardware keys / keyboard not working properly - restore to your backup and reboot.

    If you have more than 1 device with the same keycode and you need them to perform different actions you will have to create a specific key layout
    More info can be found @ Key Layout Files

    NOTE : This was tested on CM9 , I'm not sure this works on CM7 as well ( although probably not as generic.kl was introduced in HC )

    Controlling USB Host & External VBus via Tasker
    • Install "Locale Execute" plug-in from the Market
    • In Tasker open "Tasks" and make a new one (e.g. "USB Host ON")
    • Category: Plugin Action: Execute
    • Give it a name on the label and push the edit button
    • Insert the command
      Code:
      @! echo host > /sys/devices/platform/musb_hdrc/mode
    • Apply

    You can now test it , or use it in a profile of your choice.
    Superuser App will ask for permission for *every single new command* you use in Locale Execute. No workaround.

    221348553.png
    997917157.png


    Use these commands to control usb host & external vbus state
    Code:
    [B]@! echo host > /sys/devices/platform/musb_hdrc/mode[/B] - usb host ON
    [B]@! echo peripheral > /sys/devices/platform/musb_hdrc/mode[/B] - usb host OFF
    [B]@! echo external > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus ON
    [B]@! echo internal > /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbussrc[/B] - external vbus OFF

    Control App Development
    Nook Tweaks : Source
    Nook-Color-usbhost-switcher ( verygreen's old app ) : Source

    My Focus
    • GPS
    • Audio Input
    • DVB-T
    • Home-Screen Widget
    3
    Updates

    • As of the latest nightlies , CM9 USB Audio stutter is GONE - I'm not sure exactly what fixed it but I'm glad it's gone so big props to the devs ( I haven't updated my nook for about a month )

      I tested the stutter with CPU usage , and it did break a little on high loads
      BUT , normal usage isn't really effected by it
      Also , GPU load seems to make no difference since I had ProjectM doing its thing and it didn't stutter once
      This needs further testing , Although I'm not sure that anything can be done till google mainstreams USB Audio & I'm sure that once H/W acceleration will be fixed it will be much less pronounced


    • USB GPS - I was hoping to come back with success , but I couldn't get my Globalsat BU-353 working
      I already emailed the dev with logs , And I'll update when there will be progress


    • One last note :
      I'm revising the structure of the thread a little bit , since I don't have much time to do everything I want lately
      So if other devs are interested in something they will find a good starting point here
      I'll post as much information as I can on different USB Host usages
      Some will be common stuff like webcams , and some are pretty exotic that only a few will find interesting ( if at all )
      I hope it will help to expand the usability of usb hosting in android as a system , since I know that in some point , not very far in the future , it will be the replacement for our PC.
    2
    The SQ was pretty good compared to my Car-PC ( E-MU 0404 PCI )
    From a quick comparison it was a little lacking on the low end and the preout was also lower
    But channel seperation , stage width and depth were pretty identical as far as I recall

    I'll test it more when I'll get ready to install the NC in my car ( As soon as CM9 will be close to daily usage )

    Glitches and crackles might be related to buffer size ,
    But on CM7 I can't remember a single glitch that happend me - and I tested it quite thoroughly
    When I'll figure out exactly whats wrong on CM9 I'll check it and see if it is effected by CPU load or whatever