What I'm looking for:

Is there a way to make the device claim to be a keyboard/HID when plugged into a USB port and "type in" the contents of the clipboard? More accurately; What would it take to make it happen?

Motivating use case:

I have a password keeper program on my phone but it's annoying to have to read the password off the device and try to type it into another computer.


I have an Android device that was built before MTP was supported for transferring file but, with recent upgrades, now supports it. Based on this, the USB class that it claims to be can't be hardware defined and must be defined in software.

IIRC, this project has Android devices (with what I think is a stock kernel) talking as some USB class that was definitively not built in. This indicate to me that you might be able to control what USB classes it support without kernel work but I don't know for sure.

As for the Host side (i.e. the PC), I've never seen a PC, Mac or Linux box need special drives for keyboards, even for some rather esoteric devices that claim to be keyboards (bar-code scanners, credit card and smart card readers, etc.) so the generic drivers should be good enough for what I'm wanting.

All that argues that what I'm looking for can be done from a hardware point of view, but says very little about what software support exists and nothing about if there is an app for it.

  • 2
    You might try using KeePass (KeePassDroid on android, keepassx on linux, etc.) on both your phone and your computer, and just sync the database file between them, or access the database file on the phone via USB from the computer. Other password managers may also have "real computer" counterparts.
    – TREE
    Feb 28, 2012 at 16:02
  • @TREE: That might work for some cases, but one of the the specific target usages is where I don't have the ability to install something on the PC (either no access or a chicken/egg problem like system log-in passwords).
    – BCS
    Feb 28, 2012 at 16:34
  • there is also a portable version of KeePass that can run from a USB stick. This might work from a mounted android USB Storage device, but certainly doesn't address all possible use cases.
    – TREE
    Feb 28, 2012 at 20:20

6 Answers 6


Yes. This is definitely possible, requiring no modifications or drivers on the PC. As the OP mentions, the USB identification on the phone end is ultimately done in software (in this file https://github.com/android/kernel_msm/blob/android-msm-2.6.35/drivers/usb/gadget/composite.c), and it could be modified to identify itself as a standard USB keyboard.

This change would require a couple of things.

  1. A modified kernel with a patched USB driver
  2. An Android app that could talk to some interface exposed by the modified USB driver.

There is a paper that was published in 2010 titled Exploiting smart-phone USB connectivity for fun and profit. It describes using a phone to brute-force desktop login screens. The method they used involved making the phone appear as a USB keyboard.


This doesn't exactly answer your question, but it might help in your use case.

Maybe you want to have a look at InputStick. It'll be a USB thumb drive that you pair to Android via Bluetooth. Plugged into a computer it emulates a generic USB HID to send keyboard strokes. An advanced Java API will also allow to specify i.e. device descriptors to emulate non-standard functions. It could provide a nice example that it's defined in software rather than hardware.

For reference, the developer also is working on example programs, such as a Demo Password Manager.


At a minimum, this would require both software on the phone and on the PC. The 2 pieces of software would have to communicate with each other. Nothing like this, that I know of currently, exists.

And for the PC to think that the device is truly a keyboard, it would require a new driver that would tell the PC that the device is a keyboard, and how "to use it as a keyboard".

I am not saying that it is not possible, because just about anything is possible when it comes to things like this. What I am saying though, is that nothing like this exists, currently.

USB is both hardware and software, if it was software alone, then the same USB driver would work for all android devices on Windows, and this is not the case. USB mass-storage and MTP are handled by the drivers on the PC, not the device. What devices support both MTP and USB mass-storage and at the same time? I have found articles stating that devices can support UMS and MTP, but only support UMS if there is an external sdcard. You cannot mount the external sdcard with MTP and with UMS. MTP is for the internal storage. And I haven't read anything that can confirm or deny that you can use both at the same time.

You don't have to install drivers for keyboards, if they follow the "default" spec because windows already has the drivers for it. There are keyboards that come with their own drivers. As I said, it would be possible. I am not sure about how it would be done. It would, almost certainly, require a custom kernel at the very least for it to act like a keyboard and no additional drivers to be needed on the PC side.

Additionally, I agree with @davidbb that it is possible and I have already said that it is. The problem with a question asking if something is possible, does not ever solve the problem. It would be like me saying "is it possible for me to run ios applications natively on windows?". This is theoretically possible, but there is nothing that does this now and there is not something that a "normal user" (or even an advanced user) can do to make this happen. This site is geared for users, so saying you just need to write a modified kernel is not an answer that is going to benefit anyone. So the real answer to the question is no, because there is not a modified kernel out there.

  • IIRC, the android end of the USB connection is done in software (it has to be to some extent for the same hardware to act as both a USB mass-storage device as well as MTP). Based on that, what is to prevent a device side only driver from make the device announce it's self as a generic HID? If that can be done, then the same PC side drivers that handle any other keyboard will handle it (just like is done for things like bar-code scanners and credit card readers).
    – BCS
    Feb 28, 2012 at 15:49
  • Android devices (hardware) that were built before MTP was being used now operate as the MTP USB class, thus the classes that the device claims to operate as must be defined in software. I can't remember if I have ever installed a driver for a keyboard (or for that matter a non-generic driver for connecting an Android device) thus nothing should need to be installed PC side. Combine those and I'm almost sure that the hardware can do it. The only question left is: does stock Android provide access to the needed knobs, or would this take building a custom kernel?
    – BCS
    Feb 28, 2012 at 16:50
  • Re: 2nd edit. I guess I'm looking for someone who knows definitively what it would take. (Can you move that last paragraph to the top?)
    – BCS
    Feb 28, 2012 at 17:19
  • This answer is wrong, no software is required on the PC side. Different phones require different drivers because the manufacturers don't all use the same vendor ID number. Keyboards however fall in a different category of device where they are recognized by the host by type, so the vendor ID doesn't really matter. The VID/PID, device type, protocols, etc are all implemented in software on the android side, and changeable by anyone with kernel source and a way to install the compiled result. Jul 11, 2012 at 3:27

Have you tried Unified Remote. This is a great tool to use phone as keyboard and mouse. It doesn't use USB but wifi instead. There is an app on phone and computer that work together. Works great for me. Also if you get full version you get integration with many common applications.

  • I'm looking for a solution for cases that include things like typing passwords into BIOS boot prompts so I can't really install any kind of client.
    – BCS
    Feb 18, 2014 at 21:56

It's now >six years later and somewhere in between someone created the Keepass2 USB Keyboard Plugin for Keepass2Android.

Wanted to add this information here for the sake of completeness and because I found this question unanswered and the aforementioned plugin while searching for exactly something like that.

I haven't tested it myself yet...


I was searching for something similar and found https://github.com/pelya/android-keyboard-gadget. Seems the same thing can be used in your case.

In brief, what I got is you have to write the USB driver in the Android kernel to detect the device as HID.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .