From dde2211bc51d61e52065788bf521e53f04259f51 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Thu, 20 Mar 2014 01:07:06 +0100 Subject: unifying: start implementing HID++ 2.0 for devices New Hidpp20Msg type helps reading the HID++ 2.0 function format. Implemented error responses (undocumented), and IRoot.GetProtocol(). Signed-off-by: Peter Wu --- hw/usb/hid-logitech-dj.h | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'hw/usb/hid-logitech-dj.h') diff --git a/hw/usb/hid-logitech-dj.h b/hw/usb/hid-logitech-dj.h index 04a31c95a3..6a2ca18413 100644 --- a/hw/usb/hid-logitech-dj.h +++ b/hw/usb/hid-logitech-dj.h @@ -71,6 +71,18 @@ typedef struct { }; } HidppMsgLong; +typedef struct { + uint8_t report_id; + const uint8_t device_index; + const uint8_t feat_index; + const uint8_t func; /* function/ASE ID | sw ID */ + union { + uint8_t params[16]; + uint8_t params_s[3]; + }; +} Hidpp20Msg; + + typedef struct { uint8_t report_id; uint8_t device_index; @@ -99,11 +111,7 @@ typedef struct { }; } HidppMsg; -/* information to generate an error output report */ -typedef struct { - uint8_t device_index; - uint8_t sub_id; - uint8_t address; +/* HID++ 1.0 error codes */ #define HIDPP_ERR_SUCCESS 0x00 #define HIDPP_ERR_INVALID_SUBID 0x01 #define HIDPP_ERR_INVALID_ADDRESS 0x02 @@ -117,8 +125,17 @@ typedef struct { #define HIDPP_ERR_REQUEST_UNAVAILABLE 0x0A #define HIDPP_ERR_INVALID_PARAM_VALUE 0x0B #define HIDPP_ERR_WRONG_PIN_CODE 0x0C - uint8_t error; -} HidppError; +/* HID++ 2.0 error codes */ +#define HIDPP20_ERR_CODE_NOERROR 0x00 +#define HIDPP20_ERR_CODE_UNKNOWN 0x01 +#define HIDPP20_ERR_CODE_INVALIDARGUMENT 0x02 +#define HIDPP20_ERR_CODE_OUTOFRANGE 0x03 +#define HIDPP20_ERR_CODE_HWERROR 0x04 +#define HIDPP20_ERR_CODE_LOGITECH_INTERNAL 0x05 +#define HIDPP20_ERR_CODE_INVALID_FEATURE_INDEX 0x06 +#define HIDPP20_ERR_CODE_INVALID_FUNCTION_ID 0x07 +#define HIDPP20_ERR_CODE_BUSY 0x08 +#define HIDPP20_ERR_CODE_UNSUPPORTED 0x09 /* device and receiver info */ -- cgit v1.2.1