2

I'm looking to create a USB device that would be basically a HID keyboard. I am able to do that with Uno. I flash new firmware with a HID keyboard descriptor and on the arduino side I loop and check for button presses. Based on butotn presses I send the report.

What I would like to add to this is option to send some data from a PC and based on that data do something (like turn an LED on.)

Here is an example:

loop() {
 check_and_send_buttons();
 uint8_t inputByte = get_input(); //new
 handle_input(inputByte); //new
}

I'm on Linux and I tried sending some data via hidrawX but that did not work out. Any ideas?

I'm willing to also write new device driver for Linux if needed.

asked Sep 18, 2015 at 20:50

1 Answer 1

1

On UNO R3 the HID protocol is handled by the secondary AVR present on the board. Which is the one talking to the PC. So what you should modify is the code implementing the USB protocol on the secondary AVR.

The main (328p) AVR interacts with it through the serial port.

You do not need to alter the Linux driver, since it already supports the driving of the usual LEDs (CAPS, Num Lock, Scroll Lock), if these are enough for you.

So, to recap:

1) enhance the HID implementation to understand LED status commands coming from the PC

2) report such changes over serial

3) on the primary AVR, monitor for such messages coming over serial port from the secondary AVR and use them to drive the LEDs.

answered Sep 18, 2015 at 21:56

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.