passthrough from usb host to hid acting as a keyboard

hi, I'm completely new to arduino and setting up my first project! reading http://hunt.net.nz/users/darran/weblog/c6f35/Arduino_USB_Keyboard_Passthrough.html it appears that adding another usb host to the arduino can allow it to act as a host to a usb keyboard and forward keypresses via its usb hid.

i'd like to modify an existing library that runs on an arduino uno and forwards stuff corresponding to keypresses to some i2c thing from a computer, which is connected via usb to the arduino and grabs some java SerialPort object corresponding to /dev/ttyACM0 and communicates with the arduino via said SerialPort's InputStream/OutputStream objects. i want to maintain this pc-arduino interface but have the uno pretend to be a usb keyboard (with its usb hic right?) and send keypresses to another computer (rather than sending to i2c) for testing purposes.

questions: 1) the uno built-in usb dude is functioning as a usb host in this situation, right? 2) if i add a usb host shield to an uno and free up its main port to function as the fake keyboard, could the communication described above still occur via the add-on host interface? 3) if so, can i do this with just an arduino uno, a usb host shield, and some a-a and a-b usb cables?

thanks for reading!

1) the uno built-in usb dude is functioning as a usb host in this situation, right?

Wrong, it is not.

2) if i add a usb host shield to an uno and free up its main port to function as the fake keyboard, could the communication described above still occur via the add-on host interface?

No.

3) if so, can i do this with just an arduino uno, a usb host shield, and some a-a and a-b usb cables?

No.

I think you need to read that page again.

thanks for the helpful and informative response!

having read again, my understanding of the passthrough setup from the link: * the built-in atmega8u2 USB, flashed to look like a USB Keyboard HID, is connected to a host controller on the computer receiving the keystrokes * the add-on USB host shield is connected to the keyboard that's sending the keystrokes * the "sketch" running on the arduino is forwarding/mangling what is received via the host controller on the shield out the built-in controller

my updated guess regarding what i'd need to build to accomplish my goals: * 2 USB controllers on the arduino, both of which can function as USB devices * one is set up to look however the uno's included controller typically looks, and is connected to a host controller on the laptop, receiving data from the library described * one is flashed to look like a USB Keyboard HID, and is connected to a host controller on the computer receiving keystrokes * a modified version of the sketch i've been provided with running on the arduino is sending keystroke events via the controller acting as a USB Keyboard HID based on the messages it receives from the laptop connected to the other USB controller

what is correct/incorrect in this iteration? thanks for reading!

for instance, could I wire this http://www.sparkfun.com/products/10277 to an uno and use it as i described?

Yes I think that is possible, that board should make life much easer for you. Are you thinking of using two of them. That way you don't have to mess about with the one on board and you can still upload sketches.

does the built-in usb port on the uno not typically appear as a serial device, e.g. /dev/ttyACM0, i.e. i'd have to flash the firmware to make this happen, and this would mean that i couldn't upload sketches? or is it just that while the program that receives data from the laptop is running it would hog the port and i'd have to reset the uno or something to get it to let me upload again? if i got 2 of these atmega8u2 boards, there're enough pins or whatever to have both connected at the same time?

i'd have to flash the firmware to make this happen, and this would mean that i couldn't upload sketches?

Yes that is why I said two boards.

if i got 2 of these atmega8u2 boards, there're enough pins or whatever to have both connected at the same time?

The output is a simple TTL serial interface so just two lines per board are all you need. You also need ways of reading these say with the ports on a Mega or a software serial library.

thanks, duly noted. ordered an uno (a while back), two of those boards, and some a-b usb cables.

alright, plan v1 for the USB HID one:

is this coherent? are there obvious problems with it? i'll update as i make progress