Skip to content

Added a rudimentary mechanism for reacting to messages from the host #6392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions hardware/arduino/avr/libraries/HID/src/HID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,9 @@ bool HID_::setup(USBSetup& setup)

if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE)
{
if (request == HID_GET_REPORT) {
// TODO: HID_GetReport();
if (request == HID_GET_REPORT || request == HID_GET_PROTOCOL) {
return true;
}
if (request == HID_GET_PROTOCOL) {
// TODO: Send8(protocol);
return true;
}
if (request == HID_GET_IDLE) {
// TODO: Send8(idle);
}
}

if (requestType == REQUEST_HOSTTODEVICE_CLASS_INTERFACE)
Expand All @@ -131,16 +123,6 @@ bool HID_::setup(USBSetup& setup)
idle = setup.wValueL;
return true;
}
if (request == HID_SET_REPORT)
{
//uint8_t reportID = setup.wValueL;
//uint16_t length = setup.wLength;
//uint8_t data[length];
// Make sure to not read more data than USB_EP_SIZE.
// You can read multiple times through a loop.
// The first byte (may!) contain the reportID on a multreport.
//USB_RecvControl(data, length);
}
}

return false;
Expand Down
8 changes: 8 additions & 0 deletions hardware/arduino/avr/libraries/HID/src/HID.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
#include <Arduino.h>
#include "PluggableUSB.h"

// The HID class provided in this library is a basic mechanism, designed to let enthusiasts get
// a quick start with their projects. If you need more than what's implemented here (such as
// bi-directional communication with the host), then you should investigate other user-contributed
// libraries. In particular, have a look at: https://github.com/NicoHood/HID/wiki.
// This library contains a number of implementations for Mice, Keyboards and game controllers,
// perhaps one will work directly for you. If not, there are also base classes that you can use
// to get a jump-start on your design.

#if defined(USBCON)

#define _USING_HID
Expand Down