Category: tools
Posted by: cyclonite
Untitled document We created a tool to generate any kind off BB-code or HTML-code data for images.
Category: General
Posted by: cyclonite
Untitled document The Diecyde website has been restyled
CMS - 1.11.9 - Bartolome

USB HID device prank

Untitled document After a long time, not doing any pranks I told myself it was time for a new prank on my colleagues (just because I can)

I just didn't know what to do.
After I started on a new project for the company involving USB devices, it came to me:

Create an USB HID device which reports itself to the host as an keyboard.
This keyboard should send one key press every 2 minutes or so (the CAPS LOCK key).
For a proof of concept I connected a second keyboard to my PC and pressed the CAPS key, I noticed this key pressing did not change the state of the CAPS-light on the other keyboard.
Thus making this a perfect prank as someone probably blames himself for pressing the caps button and wouldn't notice a small USB device in the back of the pc.

After some thinking how I could acomplish this I remembered a bookmark of V-USB this is a library which can bit-bang USB devices OR hosts.
This library runs on practically every AVR with more than 2 K flash.
It also needs just a few resistors and a stable clock.

I ripped open an old usb memory stick:

And EUREKA : It holds an 12Mhz clock, just the one I need.
Using my hot air soldering iron I removed the old memory chip and processor.

After removal I found a nice place where my Tiny2313 could be attached to the pcb.
I placed a drop of glue to hold it in place.

You can tell this device really likes its new home:

next step was to replace the old resistors (usb 2.0) by the ones needed for usb1.1 (the library only supports usb1.1).
So I removed the old ones and placed new 68 ohm resistors and a 1k5 resistor as an D- pull-up.

This had to be wired too naturally, so the D+ ,D- and VCC wires are now running to its new processor.

I still needed to debug my software ( and program the chip naturally) so I added an ISP connector.
This connector sadly doesn't fit in the old housing.
So when I am done I would have to remove it to keep the stick completely stealthy.

Next up was the software:

After some debugging I managed to get it working.
May  2 22:40:59 sebastiaan-desktop kernel: [713789.801407] usb 1- new low speed USB device using ehci_hcd and address 36
May  2 22:40:59 sebastiaan-desktop kernel: [713789.900763] usb 1- configuration #1 chosen from 1 choice
May  2 22:40:59 sebastiaan-desktop kernel: [713789.905360] input: KP USBkey as /devices/pci0000:00/0000:00:1a.7/usb1/1-6/1-6.4/1-6.4.1/1-
May  2 22:40:59 sebastiaan-desktop kernel: [713789.905483] generic-usb 0003:4242:E131.001C: input,hidraw3: USB HID v1.01 Keyboard [KP USBkey] on usb-0000:00:1a.7-

It nicely reports itself as an keyboard with the name "USBkey"

Next up was some testing, after some typing the whole thing becaume pretty annoying. So it is doing its job pretty well.
Can you see the difference?
To me it still looks like an older (bit worn out) usb memory stick :P

This is a small movie I created, showing how it works on a windows PC:

I made I schematic for anyone who wants to reproduce this :P

As you can see it is a pretty simple schematic.
I also drew a PCB (this PCB can also be used for debugging purposes or development purposes of other PCB or possibly It can be used as an replacement of an expensive FTDI chip.)

The PCB is only 17 x42 mm large so It should fit most (older) usb housings.

The schematics can be downloaded here

The software can be downloaded here

Both are released under GPL V2

Previous page: Generator controller  Next page: Mechanics