usb: hid: boot protocol

Set_Protocol and Get_Protocol requests are handled now.
Tested with USB3CV.

Signed-off-by: Marcin Szymczyk <Marcin.Szymczyk@nordicsemi.no>
This commit is contained in:
Marcin Szymczyk 2018-12-12 13:53:16 +01:00 committed by Maureen Helm
commit 801b54edb9
5 changed files with 82 additions and 4 deletions

View file

@ -60,6 +60,7 @@ struct usb_hid_descriptor {
typedef int (*hid_cb_t)(struct usb_setup_packet *setup, s32_t *len,
u8_t **data);
typedef void (*hid_int_ready_callback)(void);
typedef void (*hid_protocol_cb_t)(u8_t protocol);
typedef void (*hid_idle_cb_t)(u16_t report_id);
struct hid_ops {
@ -69,6 +70,7 @@ struct hid_ops {
hid_cb_t set_report;
hid_cb_t set_idle;
hid_cb_t set_protocol;
hid_protocol_cb_t protocol_change;
hid_idle_cb_t on_idle;
/*
* int_in_ready is an optional callback that is called when
@ -162,6 +164,10 @@ struct hid_ops {
#define COLLECTION_PHYSICAL 0x00
#define COLLECTION_APPLICATION 0x01
/* Protocols */
#define HID_PROTOCOL_BOOT 0x00
#define HID_PROTOCOL_REPORT 0x01
/* Register HID device */
void usb_hid_register_device(const u8_t *desc, size_t size,
const struct hid_ops *op);