Can a device pretend to be a USB keyboard?

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.


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, 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 was a paper published a couple of years ago (titled Exploiting smart-phone USB connectivity for fun and profit) that described using a phone to brute-force desktop login screens. The method they used involved making the phone appear as a USB keyboard.

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.

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.

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.

InputStick is a wireless USB receiver, designed for Android devices. It allows Android applications to emulate many different kinds of devices, for example: USB Keyboard, USB Mouse, USB Gamepad and many more. With InputStick, Android apps can do anything that a physical device can: type, move mouse pointer, control multimedia and games.

Information can be found at

Category: usb Time: 2012-02-28 Views: 1
Tags: usb keyboard

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.244 (s). 12 q(s)