Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
Td8f4
Old
#1  
Td8f4's Avatar
Junior Member - OP
Thanks Meter 33
Posts: 24
Join Date: Jul 2011
Lightbulb USB OTG host mode (ANY USB keyboard support!) TUT

USE ANY USB KEYBOARD WITH YOUR USB OTG SUPPORTED ANDROID DEVICE!!!!

I've been experimenting with Wifi cards and the samsung galaxy sII
and realized people where having the same problem as i was having with plugging in usb keyboards.

turns out it all has to do with a vendors permission issue. if your device is not in the list, it will seen as "unknown".

As it turns out you can simply add your device and it'll work. mind you it was to be a simple input device and will have the power constraints of 100mW. But if u can compile a driver and splice in dc power.... skies the limit!

steps:

1. Android must be rooted (not going over that) and must support USB OTG (on-the-go)


2. You can either buy a USB OTG micro to female adapter on ebay for like 4 bucks. i decided to make one myself since i have lots of spare parts.
Heads up: a simple micro usb to female usb connector IS NOT THE SAME AS A USB OTG CABLE, they may look the same but the OTG cable has Pin 4 grounded to pin 5 on the micro usb side. This is how the device distinguishes aach type of cable. WARNING: IF MAKING THIS YOURSELF DO NOT CROSS BLACK AND RED, this WILL fry your PHONE.if you don't know you rway around a soldering iron, just buy one


3. Check what manufacturer your device is on this chart, if it's not there, check on the internet or plug the usb device into a linux box and run "lsusb" in the command promt and look for your device, the number will look like this:

Bus ### Device ###:ID <THIS ONE!>:<more numbers> " Company"

here's the chart: (taken from here :http://developer.android.com/guide/d...ng/device.html)

Code:
Company	USB Vendor ID
Acer			0502
ASUS			0b05
Dell			413c
Foxconn		0489
Garmin-Asus	091E
Google		18d1
HTC			0bb4
Huawei		12d1
K-Touch		24e3
KT Tech		2116
Kyocera		0482
Lenevo		17EF
LG			1004
Motorola		22b8
NEC			0409
Nook			2080
Nvidia			0955
OTGV			2257
Pantech		10A9
Philips		0471
PMC-Sierra		04da
Qualcomm		05c6
SK Telesys		1f53
Samsung		04e8
Sharp			04dd
Sony Ericsson	0fce
Toshiba		0930
ZTE			19D2
eg my keyboard is lenovo , so code is 17EF, you get it

4. log in as root, mount system as read-writeable, Create this file: /etc/udev/rules.d/51-android.rules
if its already there, then just append the command you want after.

if you dont have root explorer or otherwise installed here is how to in bash:

Code:
su
su
mount -o remount,rw system /system
mkdir -p /etc/udev/rules.d/
cd /etc/udev/rules.d/

now in the "51-android.rules" file add this line (or more for more device support):

SUBSYSTEM=="usb_device", SYSFS{idVendor}=="<VENDOR CODE>", MODE "0666", NAME=="<VENDOR>"


my example with my lenovo keyboard:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="17EF", MODE "0666", NAME=="lenovo"

save.

5. plug in the USB OTG cable and plug in your keyboard or other device. it sould say "usb host cable" then "usb device".

on some keyboards the numlock light wont work, due to the fact of power contraints on the phone, you can add support by plicing in 5v DC in to the line (soldering needed) or you can probably jsut attach a powered usb hub



And thats IT, now you can actually type documents at a reasonable pace, without paying an arm and a leg for a supported bluetooth keyboard!!!

-td8f4

* to moderators i know i have less than 50 posts hopefully i dont get banned, i thought this was considered dev*

My stuff:
Samsung Galaxy SII -
overclocked and running Backtrack 5
Alienware M15X
Sony HDR-FX7
5TB server running Vmware ESXi gigabit lan

Computerboost.ca
The Following 20 Users Say Thank You to Td8f4 For This Useful Post: [ Click to Expand ]
 
NZtechfreak
Old
#2  
Senior Member
Thanks Meter 716
Posts: 2,205
Join Date: Sep 2008
Wow, really nice work - I wonder if some kindly ROM devs could just bake in support for all in their ROMs?
Twitter: @nztechfreak
Blogs: androidnz.net, blog.clove.co.uk
Facebook: http://goo.gl/baZHQ


 
karl999999
Old
#3  
Senior Member
Thanks Meter 53
Posts: 257
Join Date: Oct 2010
Quote:
Originally Posted by NZtechfreak View Post
Wow, really nice work - I wonder if some kindly ROM devs could just bake in support for all in their ROMs?
wow really good work.

just another info on the price of an BT keyboard:

http://www.amazon.de/s?ie=UTF8&searc...rds=CHIN%20FAI

40 euro are not an arm and a leg :)
and this i ok to type on
 
NZtechfreak
Old
#4  
Senior Member
Thanks Meter 716
Posts: 2,205
Join Date: Sep 2008
Indeed, you can get some BT keyboards quite cheaply. I already have one, but I'd still like full USB keyboard support (I don't always have my keyboard on me, but lots of people have USB keyboards).
Twitter: @nztechfreak
Blogs: androidnz.net, blog.clove.co.uk
Facebook: http://goo.gl/baZHQ


 
Sleepycat3
Old
#5  
Sleepycat3's Avatar
Senior Member
Thanks Meter 73
Posts: 520
Join Date: May 2011
I tested this on an unrooted SGS (Logitech K340 unifying keyboard) and it worked fine without having to change any settings. Just plugged it into the USB OTG adapter and then plugged the adapter into the phone. It said the device was unknown but the keyboard worked when I went to type in the apps. Mice also worked. The logitech MX Performance worked fine. A bit weird seeing a mouse pointer on the phone though.
Nokia 6110 -> Nokia 6210 -> Nokia 6510 -> SGS2 -> SGS3
 
azzinder
Old
#6  
Member
Thanks Meter 1
Posts: 38
Join Date: Oct 2007
How about keyboard remapping?

Sent from my GT-I9100 using XDA Premium App
 
HellcatDroid
Old
#7  
HellcatDroid's Avatar
Senior Member
Thanks Meter 730
Posts: 1,006
Join Date: Jul 2011
Location: Cologne Area

 
DONATE TO ME
At first I thought:

"1) plug in OTG cable, 2) plug in USB keyb., 3) use"

*lol*

No, seriously, this information is VERY usefull and might open up the way not only for keyboard (as the OP stated, "get a driver compiled and the sky is the limit".

Will definitaly bookmark this thread and when I'm done with some other tinkerings try to "get the drivers compiled"

*clicksthanks*
Quote:
The process com.xda.forum.signature has stopped unexpectedly. Please try again.
Quote:
[ Force Close ]
 
Td8f4
Old
#8  
Td8f4's Avatar
Junior Member - OP
Thanks Meter 33
Posts: 24
Join Date: Jul 2011
Arrow reply

my ultimate goal is to have a external usb wifi adapter plugged into my phone so i can use it to pentest with a Backtrack 5 chroot session.

i'm working on cross compiling the RTL8187 driver for the ARM architecture.
look here for updates
HTML Code:
http://forum.xda-developers.com/showthread.php?p=16333147
and @ karl999999

Quote:
40 euro are not an arm and a leg :)
and this i ok to type on
i know it's not expensive, but i'd really rather use something i already have, i've got a small flexible usb keyboard which works great.

My stuff:
Samsung Galaxy SII -
overclocked and running Backtrack 5
Alienware M15X
Sony HDR-FX7
5TB server running Vmware ESXi gigabit lan

Computerboost.ca
 
alx5962
Old
#9  
Senior Member
Thanks Meter 89
Posts: 241
Join Date: Jun 2007
Location: Lille
As I'm trying to add joystick support on SGSII, I tried to add an xbox 360 controller and my device was not recognized. I tried this method and added "045E" as vendor but no luck, still not recognized... Any idea ?

Thanks
Samsung Galaxy S II
Acer Iconia A700

I don't ask for donation, but at least fill my thanks meter
 
Teio
Old
#10  
Senior Member
Thanks Meter 66
Posts: 317
Join Date: Sep 2009
Location: London

 
DONATE TO ME
Quote:
Originally Posted by alx5962 View Post
As I'm trying to add joystick support on SGSII, I tried to add an xbox 360 controller and my device was not recognized. I tried this method and added "045E" as vendor but no luck, still not recognized... Any idea ?

Thanks
Also interested in this... Sadly I dont have the skills to compile a driver myself...

Sent from my GT-I9100 using XDA Premium App

 
Post Reply+
Tags
android, keyboard, otg, support, usb
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...

XDA PORTAL POSTS

Open Source CPU Info App for Windows

So you’re playing with your shiny new Windows 8 tablet PC, when one of your like-minded geeky … more

Guide to Using Adobe Air on Android

When writing an app with performance in mind, you most likely want to write it native code using the … more