[WIP] USB Host support (working)

Search This thread

ApokrifX

Senior Member
May 23, 2011
468
50
Went back to stock, all good.
Was it related to host mode? Well, I cannot say for sure as I haven't done any research on it.
Guys,
Sorry, I’m a little late.
I’m sure all “battery charging logic” has to be on the chip, not in software.
Not sure about why LED didn’t turn green on rooted nook until you went to stock firmware.
Might be all you have to do is reboot?
And about battery drain with host mode enabled.
I have a feeling (but no proof), it has to do with schematic.
Something was not thought over, not tested or omitted to reduce price...

BTW: What component supposes to prevent deep discharge even on stock firmware?
And what doesn’t let battery charge properly after deep discharge?
I guess it is faulty “charging logic” (which has to be on the chip)
What else could it be?

Roger,
Are you on stock still? ;)
 

Renate

Recognized Contributor / Inactive Recognized Dev
Do you know any 'working' app in the market that would automount a USB stick connected to NST?

Automount? No.

Code:
mount -o rw,remount rootfs /
mkdir /thumb
mount -t vfat /dev/block/uba1 /thumb

I can easily get a thumb drive to work on a hub, I've not gotten mine to work plugged directly into the Nook.
 

mrWax

Senior Member
Jan 31, 2012
147
24
good job! usb mouse?

Host mode works like charm! it is simply amazing!!! :) :)

I wonder if it is possible to somehow get mouse cursor working, possibly imbedding it into no-refresh enabler since it does dithering with screen anyway and mapping DPAD to changing cursor possition! that would be really * * mighty and magical * * :)

anyway have you tryed this linux installer on Market?
 

bisbal

Senior Member
Nov 19, 2011
64
13
Last edited:

Renate

Recognized Contributor / Inactive Recognized Dev
I picked up a USB audio adapter. It happens to have volume buttons on it.
It is recognized as an HID input device. Pressing the buttons causes speaker icons on the Nook.
However, it is not recognized as an audio device.

Code:
#cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.18a.

#cat /proc/asound/cards
 0 [Dummy          ]: Dummy - Dummy
                      Dummy 1
 
  • Like
Reactions: mrWax

ApokrifX

Senior Member
May 23, 2011
468
50
I picked up a USB audio adapter. It happens to have volume buttons on it.
It is recognized as an HID input device. Pressing the buttons causes speaker icons on the Nook.
However, it is not recognized as an audio device.

Code:
#cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.18a.

#cat /proc/asound/cards
 0 [Dummy          ]: Dummy - Dummy
                      Dummy 1
Wow! Are you building a media center from your nook? ;)
Sorry, cannot tell anything useful…
Yet I was wondering if there is an easy way to find out if a device (VEN_####&DEV_####) is supported on an android (OS version)?
Or if it’s supported on Linux (i.e. has drivers/sources), it’ll work on an android too? :confused:
 

mrWax

Senior Member
Jan 31, 2012
147
24
wow

I picked up a USB audio adapter. It happens to have volume buttons on it.
It is recognized as an HID input device. Pressing the buttons causes speaker icons on the Nook.
However, it is not recognized as an audio device.

Code:
#cat /proc/asound/version
Advanced Linux Sound Architecture Driver Version 1.0.18a.

#cat /proc/asound/cards
 0 [Dummy          ]: Dummy - Dummy
                      Dummy 1

sounds great! do you think that drivers will be needed. they maybe can downloaded somewhere. Since linux Ubuntu runs on nook and Puppy linux, which will be more usefull is comming up, it might be enought to down some driver for linux. btw check out update in a thread http://xdaforums.com/showthread.php?t=1583141
 
Last edited:

Renate

Recognized Contributor / Inactive Recognized Dev
There are reports of this exact device being used on Linux.
It's just a question of getting the drivers all in there.
I was waiting to hear from mali100... :rolleyes:

I am trying to put together a media center, but also a portable recording solution.

C-Media USB Audio Device
0D8C:0008

Note: If somebody really wanted a tiny two button remote, they could use this
and map the VolUp/VolDown (for just this device Id) to PageUp/PageDown.
 
Last edited:

mali100

Senior Member
Jun 3, 2007
209
140
Could you please post the dmesg output and tell me if the module snd_usb_audio gets loaded (lsmod)?
 

mrWax

Senior Member
Jan 31, 2012
147
24
all-mighty linux

If you manage to have usb sound through linux then it might be quite easy to connect even monitor (linux driver are in developement, i read somewhere exist or are in develpoment) http://www.displaylink.com/shop/monitors
And of course there should be huge number of other possibilities like GSM, GPS, Ethernet, printers......

hail to the
Aaaaaalll-mighty linux !!!

:)
 
Last edited:

Renate

Recognized Contributor / Inactive Recognized Dev
Code:
<6>[125451.132354] usb 1-1: new full speed USB device using musb_hdrc and address 16
<3>[125451.291656] usb 1-1: device v0d8c p0008 is not supported
<6>[125451.297332] usb 1-1: New USB device found, idVendor=0d8c, idProduct=0008
<6>[125451.319702] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
<6>[125451.327301] usb 1-1: Product: C-Media USB Audio Device
<6>[125451.344665] usb 1-1: configuration #1 chosen from 1 choice
<6>[125451.358154] input: C-Media USB Audio Device    as /devices/platform/musb_hdrc/usb1/1-1/1-1:1.3/input/input15
<6>[125451.377746] generic-usb 0003:0D8C:0008.000D: input: USB HID v1.00 Device [C-Media USB Audio Device   ] on usb-musb_hdrc-1/input3

That's all there was.
 

ApokrifX

Senior Member
May 23, 2011
468
50
Those are shipped from China and Hong Kong - 2 weeks min. to get them.
You can find similar stuff shipped from Cali for about the same price, depends where you want it shipped of course.

USB 2.0 Male To Female A Extension Cable + power supply
Does the cable come with power supply or not? It’s in title but not on image.
 

mrWax

Senior Member
Jan 31, 2012
147
24
no

Those are shipped from China and Hong Kong - 2 weeks min. to get them.
You can find similar stuff shipped from Cali for about the same price, depends where you want it shipped of course.

USB 2.0 Male To Female A Extension Cable + power supply
Does the cable come with power supply or not? It’s in title but not on image.

no, you have to provide power on one of the cables
 

mali100

Senior Member
Jun 3, 2007
209
140
I compiled a new kernel which should recognize usb-audio devices,. I also disabled the power consumption check during the configuration selection and enabled additional debugging infos for the usb-system.

dmesg:
Code:
<7>[121105.425384] twl4030_usb twl4030_usb: notifying gadget of connect
<7>[121105.615112] usb usb1: usb resume
<7>[121105.634643] hub 1-0:1.0: hub_resume
<7>[121105.638397] hub 1-0:1.0: port 1: status 0101 change 0001
<7>[121105.751861] hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000
<7>[121105.757751] hub 1-0:1.0: port 1, status 0101, change 0000, 12 Mb/s
<6>[121105.884674] usb 1-1: new full speed USB device using musb_hdrc and address 2
<7>[121106.040893] usb 1-1: ep0 maxpacket = 8
<7>[121106.064025] usb 1-1: skipped 7 descriptors after interface
<7>[121106.076477] usb 1-1: skipped 2 descriptors after interface
<7>[121106.082397] usb 1-1: skipped 1 descriptor after endpoint
<7>[121106.088073] usb 1-1: skipped 2 descriptors after interface
<7>[121106.093902] usb 1-1: skipped 1 descriptor after endpoint
<7>[121106.099609] usb 1-1: skipped 1 descriptor after interface
<7>[121106.105377] usb 1-1: skipped 1 descriptor after interface
<7>[121106.111480] usb 1-1: default language 0x0409
<3>[121106.117034] usb 1-1: device v1130 pf211 is not supported
<6>[121106.122711] usb 1-1: New USB device found, idVendor=1130, idProduct=f211
<6>[121106.129821] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
<6>[121106.137420] usb 1-1: Product: USB  AUDIO  
<7>[121106.142089] usb 1-1: uevent
<7>[121106.146423] usb 1-1: usb_probe_device
<6>[121106.150421] usb 1-1: configuration #1 chosen from 1 choice
<4>[121106.156250] usb 1-1: new config #1 exceeds power limit by 400mA
<7>[121106.162811] usb 1-1: adding 1-1:1.0 (config #1, interface 0)
<7>[121106.168975] usb 1-1:1.0: uevent
<7>[121106.173492] usbserial_generic 1-1:1.0: usb_probe_interface
<7>[121106.179382] usbserial_generic 1-1:1.0: usb_probe_interface - got id
<7>[121106.186370] usbtest 1-1:1.0: usb_probe_interface
<7>[121106.191345] usbtest 1-1:1.0: usb_probe_interface - got id
<7>[121106.197174] snd-usb-audio 1-1:1.0: usb_probe_interface
<7>[121106.202667] snd-usb-audio 1-1:1.0: usb_probe_interface - got id
<7>[121106.223419] usb 1-1: adding 1-1:1.1 (config #1, interface 1)
<7>[121106.229614] usb 1-1:1.1: uevent
<7>[121106.233673] usb 1-1: adding 1-1:1.2 (config #1, interface 2)
<7>[121106.239837] usb 1-1:1.2: uevent
<7>[121106.243988] usb 1-1: adding 1-1:1.3 (config #1, interface 3)
<7>[121106.250122] usb 1-1:1.3: uevent
<7>[121106.254272] usbserial_generic 1-1:1.3: usb_probe_interface
<7>[121106.260162] usbserial_generic 1-1:1.3: usb_probe_interface - got id
<7>[121106.267089] usbtest 1-1:1.3: usb_probe_interface
<7>[121106.272033] usbtest 1-1:1.3: usb_probe_interface - got id
<7>[121106.277862] usbhid 1-1:1.3: usb_probe_interface
<7>[121106.282684] usbhid 1-1:1.3: usb_probe_interface - got id
<6>[121106.292846] input: USB  AUDIO   as /devices/platform/musb_hdrc/usb1/1-1/1-1:1.3/input/input3
<6>[121106.314392] generic-usb 0003:1130:F211.0001: input: USB HID v1.10 Device [USB  AUDIO  ] on usb-musb_hdrc-1/input3
<7>[121106.354614] usb 1-1: adding 1-1:1.4 (config #1, interface 4)
<7>[121106.360839] usb 1-1:1.4: uevent
<7>[121106.377075] usbserial_generic 1-1:1.4: usb_probe_interface
<7>[121106.382934] usbserial_generic 1-1:1.4: usb_probe_interface - got id
<7>[121106.398468] usbtest 1-1:1.4: usb_probe_interface
<7>[121106.410125] usbtest 1-1:1.4: usb_probe_interface - got id
<7>[121106.416076] usbhid 1-1:1.4: usb_probe_interface
<7>[121106.420928] usbhid 1-1:1.4: usb_probe_interface - got id
<6>[121106.460327] input: USB  AUDIO   as /devices/platform/musb_hdrc/usb1/1-1/1-1:1.4/input/input4
<6>[121106.479858] generic-usb 0003:1130:F211.0002: input: USB HID v1.10 Device [USB  AUDIO  ] on usb-musb_hdrc-1/input4
<7>[121106.491760] drivers/usb/core/inode.c: creating file '002'
<4>[121106.502441] usb 1-1: 500mA is over 100mA budget for port 1!
<4>[121106.508392] hub 1-0:1.0: 400mA over power budget!
<7>[121106.526153] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
<7>[121106.532012] hub 1-0:1.0: port 1 enable change, status 00000103

cat /proc/asound/cards
Code:
 0 [Dummy          ]: Dummy - Dummy
                      Dummy 1
 1 [default        ]: USB-Audio - USB  AUDIO  
                      USB  AUDIO   at usb-musb_hdrc-1, full speed
/edit:
Working download on google code:
uImage_usb_audio_test.zip
 
Last edited:

Renate

Recognized Contributor / Inactive Recognized Dev
Something appears to be wrong with that link for the attachment. I only get 554 bytes. Ok, the other link works.

Code:
<3>[108267.215332] usb 1-1.4: device v0d8c p0008 is not supported
<6>[108267.221221] usb 1-1.4: New USB device found, idVendor=0d8c, idProduct=0008
<6>[108267.242401] usb 1-1.4: New USB device strings: Mfr=0, Product=1, SerialNumber=0
<6>[108267.250396] usb 1-1.4: Product: C-Media USB Audio Device
<7>[108267.256896] usb 1-1.4: uevent
<7>[108267.267669] usb 1-1.4: usb_probe_device
<6>[108267.271850] usb 1-1.4: configuration #1 chosen from 1 choice
<7>[108267.305175] usb 1-1.4: adding 1-1.4:1.0 (config #1, interface 0)
<7>[108267.311798] usb 1-1.4:1.0: uevent
<7>[108267.326721] usbserial_generic 1-1.4:1.0: usb_probe_interface
<7>[108267.336181] usbserial_generic 1-1.4:1.0: usb_probe_interface - got id
<7>[108267.343658] usbtest 1-1.4:1.0: usb_probe_interface
<7>[108267.359558] usbtest 1-1.4:1.0: usb_probe_interface - got id
<7>[108267.365600] snd-usb-audio 1-1.4:1.0: usb_probe_interface
<7>[108267.375152] snd-usb-audio 1-1.4:1.0: usb_probe_interface - got id
<7>[108267.418151] usb 1-1.4: adding 1-1.4:1.1 (config #1, interface 1)
<7>[108267.424713] usb 1-1.4:1.1: uevent
<7>[108267.429016] usb 1-1.4: adding 1-1.4:1.2 (config #1, interface 2)
<7>[108267.435577] usb 1-1.4:1.2: uevent
<7>[108267.439849] usb 1-1.4: adding 1-1.4:1.3 (config #1, interface 3)
<7>[108267.446411] usb 1-1.4:1.3: uevent
<7>[108267.450714] usbserial_generic 1-1.4:1.3: usb_probe_interface
<7>[108267.456756] usbserial_generic 1-1.4:1.3: usb_probe_interface - got id
<7>[108267.463928] usbtest 1-1.4:1.3: usb_probe_interface
<7>[108267.469055] usbtest 1-1.4:1.3: usb_probe_interface - got id
<7>[108267.475158] usbhid 1-1.4:1.3: usb_probe_interface
<7>[108267.480194] usbhid 1-1.4:1.3: usb_probe_interface - got id
<6>[108267.490661] input: C-Media USB Audio Device    as /devices/platform/musb_hdrc/usb1/1-1/1-1.4/1-1.4:1.3/input/input3
<6>[108267.503082] generic-usb 0003:0D8C:0008.0001: input: USB HID v1.00 Device [C-Media USB Audio Device   ] on usb-musb_hdrc-1.4/input3
Code:
cat /proc/asound/cards
 0 [Dummy          ]: Dummy - Dummy
                      Dummy 1
 1 [default        ]: USB-Audio - C-Media USB Audio Device
                      C-Media USB Audio Device    at usb-musb_hdrc-1.4, full speed

But there's no sound and it doesn't look like it's streaming. The LEDs flash when playing when connected to my PC.

Here's a new page on my app that shows USB:
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 18
    Hello!

    I have been asked into looking for usb host support for nook touch. The hardware appears to be pretty similar to Nook Color, so there were no troubles in that area.


    The kernel used by B&N for the Nook Touch is somewhat older than .32 kernel used for Nook Color, so the patch itself required some massage. Surprisingly B&N kernel already has usb host support compiled in, so you don't even need to change anything in kernel config, just apply the patch.

    Just like in Nook Color, the id pin in the usb receptacle is not connected anywhere, so a special app is needed to switch the host mode on and off. The Nook Color usbhost switcher should work: https://github.com/verygreen/Nook-Color-usbhost-switcher though I cannot compile it for eclair, so I guess that needs some more massage and help here would be appreciated.

    Meanwhile you can simply switch the mode from adb, type
    Code:
    echo host > /sys/devices/platform/musb_hdrc/mode
    to enable usb host mode and type
    Code:
    echo peripheral > /sys/devices/platform/musb_hdrc/mode
    to disable it.
    The LED at the bottom that usually indicates charging status will light up in usb host mode even if the power is not connected.

    The upside is you don't need a special OTG cable and can just use gender changer on your existing nook cable if you so desire.

    Now, problems ;)
    • I have not tracked why yet, but self powered mode only works when you try to enable it first with external power plugged in first.
    • The user-friendly tool for usbhost mode switching needs to be compiled for eclair
    • The self-powered mode is very faint. Keeps up with my keyboard, but not even with a simple usb hub.
    • Battery drain is significant, though not sure what part of it is attributed to the usbhost mode and what to adb over wifi
    • Eclair init is buggy so input devices are unusable without a patch, see commit 6405c6953fa02d41d9f6377f4cdb947604f481c4 in google tree to sytem/core/init. I am attaching recompiled init binary that works.

    Attachments: binary.zip contains:
    • uImage - prebuilt 1.1 kernel with the patch
    • uRamdisk - root ramdisk with fixed init, adb over wifi
    • init - just recompiled init binary for those who might need it
    usbhost_patch.zip - just the patch itself in it's current form.

    THANKS TO:
    andrewed, who asked me to do this and also provided me with a device. He is on a quest to touchtype on e-paper with a USB physical keyboard, all described here: Project: E-Paper Tablet (typable!)
    7
    This is chinese for me again, sorry...

    Ni hao ma?

    Ok, no problem.

    Here is the official (interim, hacked) way to get your Nook to be an MP3 player.

    1. Root
    2. Install mali100's uImage with USB host mode and audio drivers
    3. Install superuser.apk and su
    4. Install UsbMode-1.4.apk (see below)
    5. Install AudioCtl-1.0.apk (see below)
    6. Create the text file /system/etc/asound.conf as shown here
    7. Plug in USB audio adapter through a special OTG cable adapter
    8. Using UsbMode, set in host mode
    9. Run AudioCtl, it should make beeping noises
    10. Go to your file manager and select a suitable song to play
    11. Goto step #10

    AudioCtl is very much a version 1.0
    It is necessary to use now as a workaround due to problems with mediaserver.
    You only need to run it once after each time of turning on the USB audio adapter.
    In the future, AudioCtl will have useful features.

    Note: Ignore all that stuff about ps, kill, mediaserver, etc. AudioCtl obviates all that.
    5
    USB Host Mode Swicth for Nook Simple Touch

    Attached is a Nook Simple Touch version of verygreens USB Host Mode switching app.

    Requires properly installed "su" in /system/bin

    Let me know if there are problems.
    5
    Ok, here's a summary.
    Depending on what you want to do not all of this may be required.

    For basic playback
    For basic recording or Skype
    • Modify /system/lib/hw/libaudio.so
      Code:
      [00009188] B1 F5 FA 54 => 70 BD 00 BF
      [000091EC] 6C 33 => 00 05
    • Patch /system/framework/framework.jar with AudioRecord.smali using mergesmali, in signature, in Nook121patch
    For recording directly through ALSA
    • Recorder.apk, in signature
    • Modify /system/etc/permissions
      Code:
         <permission name="android.permission.WRITE_EXTERNAL_STORAGE" >
             <group gid="sdcard_rw" />
             [b]<group gid="audio" />[/b]
         </permission>
    Jeez, it seems like a lot.
    4
    Is it possible to change the keyboard layout?

    Of course.

    There are two levels of processing turning a key press into a character.
    The first is mapping of the scan code into a key code.
    The second is mapping the key code and meta keys (shift, alt, etc) into a character.

    The first mapping is done using files like /system/usr/keylayout/qwerty.kl
    The second mapping is done using files like /system/usr/keychars/qwerty.kcm.bin
    The first file is conveniently in plain text, the second is a simple binary file.

    If you are simply swapping keys around you only need to change the .kl file
    If you want to make it so that shift 4 is Euro instead of dollar you need to change the kcm.bin file.

    You can just edit the .kl file. Before:
    Code:
      key  21  Y
    After:
    Code:
      key  21  Z
    This would make the key layout more "German-like" by making the center key in the top alpha row be considered the 'Z' key.

    The .kcm.bin are compiled files from source.
    I haven't looked into where the compiler comes from, I just modify the stock kcm.bin by hand.

    The file is broken down into 16 byte chunks with a 16 byte header.
    Here is the chunk for C (on my modified version):
    Code:
    000100 1F 00 00 00 43 00 32 00 63 00 43 00 E7 00 C7 00
    This means:
    • This chunk is about KEYCODE_C (0x1f) (uses Android key codes)
    • The visual for this key is 'C' (0x0043)
    • On a numeric keypad this would dial a 2 (0x0032) as in ABC on a phone
    • The unshifted UTF-16 value is 'c' (0x0063)
    • The shifted UTF-16 value is 'C' (0x0043)
    • The alt modified UTF-16 value 'ç' (0x00e7)
    • The alt-shift modified UTF-16 value is 'Ç' (0x00c7)

    You can also use alt combos for combining diacritics:
    • 0x0300 grave accent
    • 0x0301 acute accent
    • 0x0302 circumflex accent
    • 0x0303 tilde accent
    • 0x0308 umlaut accent

    To replace these files on your Nook, you will need to remount your system as R/W:
    Code:
    mount -o rw,remount /dev/block/mmcblk0p5 /system

    You can get fancier if you want to have some USB keyboards US and some Belgian.

    I await my shipment of Belgian chocolates. :D