phone as usb keyboard

Al Johnson openmoko at
Wed Jul 16 19:12:41 CEST 2008

On Wednesday 16 July 2008, Nick Guenther wrote:
> On Wed, Jul 16, 2008 at 10:19 AM, Carl Karsten <carl at> 
> > I don't want to plug a keyboard into the phone, I want to plug the phone
> > into a laptop and use the phone as a 2nd keyboard.
> >
> > assuming it is, the goal is to use a web cam as a bar code scanner, app
> > on phone uses scan data to generate "keyboard" clicks that get send to
> > the laptop.
> >
> > (no, we can't just run the software on the laptop.  all we can do is hook
> > up an external HID like device.)
> >
> > Is this doable?
> Yes, in theory. You'd first need to set the moko into USB-endpoint
> (instead of USB-host) mode, and you'd need to write some mad kernel
> hax that make it show up as a keyboard, and you'd need to expose the
> mad kernel hax to userland on the moko so your barcode scanner can
> send data.
>'s really a whole lot simpler just to use TCP.
> Why can't you run software on the laptop? Some sort of locked down
> corporate situation?

As you say, being a USB HID should be possible if you write a new USB Gadget 
driver. However in the proposed scenario we need to attach to a webcam, 
presumably also by USB. In this case we need to be both host and client which 
AFAIK is impossible under USB.

I thought USB barcode scanners could behave as an HID anyway? If you really 
need to do something custom with the barcode data you could use a serial 
barcode scanner with a USB-capable microcontroller for a fraction of the 
price anyway - these often provide the HID stack as example code.

More information about the support mailing list