summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-03-19 21:56:09 +0100
committerPeter Wu <peter@lekensteyn.nl>2014-03-19 21:56:09 +0100
commitd320b593b55739db798047b1623eaf228524f5ed (patch)
tree3c9497b76565fdf0d3768b85e7663f25843ca35b
parent8f818c2670838ff841c2979f13b787fff33c8654 (diff)
downloadqemu-d320b593b55739db798047b1623eaf228524f5ed.tar.gz
unifying: fix mixup of reporting flags, HidppMsg tweaks
The "address" and "value" split for short and long HID++ messages only make sense for HID++ 1.0 register accesses. For others, use "params". Also fix a mixup of reporting flags. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--hw/usb/hid-logitech-dj.c10
-rw-r--r--hw/usb/hid-logitech-dj.h30
2 files changed, 25 insertions, 15 deletions
diff --git a/hw/usb/hid-logitech-dj.c b/hw/usb/hid-logitech-dj.c
index 551ed768ee..d8bcbb06d7 100644
--- a/hw/usb/hid-logitech-dj.c
+++ b/hw/usb/hid-logitech-dj.c
@@ -73,10 +73,10 @@ static void hidpp_queue_error(USBLtunifyState *s, HidppMsg *msg, uint8_t err)
report->report_id = HIDPP_SHORT;
report->device_index = msg->device_index;
report->sub_id = 0x8F;
- report->address = msg->hidpp_s.sub_id;
- report->value[0] = msg->hidpp_s.address;
- report->value[1] = err;
- report->value[2] = 0;
+ report->params[0] = msg->hidpp_s.sub_id;
+ report->params[1] = msg->hidpp_s.address;
+ report->params[2] = err;
+ report->params[3] = 0;
}
}
@@ -168,7 +168,7 @@ static bool hidpp_process_receiver_report(USBLtunifyState *s, HidppMsg *msg)
break;
case SET_REG(0x00): /* Enable HID++ notifs */
rcvr->reporting_flags = ms->value[1];
- rcvr->reporting_flags &= REPORTING_FLAG_RECV_MASK;
+ rcvr->reporting_flags &= REPORTING_FLAG_RCV_MASK;
memset(ms->value, 0, 3);
hidpp_queue_output_report(s, msg);
break;
diff --git a/hw/usb/hid-logitech-dj.h b/hw/usb/hid-logitech-dj.h
index 0ba7a5f61b..fae86b8d19 100644
--- a/hw/usb/hid-logitech-dj.h
+++ b/hw/usb/hid-logitech-dj.h
@@ -49,16 +49,26 @@ typedef struct {
uint8_t report_id;
uint8_t device_index;
uint8_t sub_id;
- uint8_t address;
- uint8_t value[3];
+ union {
+ uint8_t params[4];
+ struct {
+ uint8_t address;
+ uint8_t value[3];
+ }; /* for register queries */
+ };
} HidppMsgShort;
typedef struct {
uint8_t report_id;
uint8_t device_index;
uint8_t sub_id;
- uint8_t address;
- uint8_t value[16];
+ union {
+ uint8_t params[17];
+ struct {
+ uint8_t address;
+ uint8_t value[16];
+ }; /* for register queries */
+ };
} HidppMsgLong;
typedef struct {
@@ -127,10 +137,8 @@ typedef struct {
struct firmware_version version;
} info; /* static information */
-#define REPORTING_FLAG_DEV_WIRELESS_NOTIFS 1
-#define REPORTING_FLAG_DEV_SOFTWARE_PRESENT (1 << 3)
-#define REPORTING_FLAG_DEV_MASK (REPORTING_FLAG_WIRELESS_NOTIFS | \
- REPORTING_FLAG_SOFTWARE_PRESENT)
+#define REPORTING_FLAG_DEV_BATTERY_STATUS (1 << 4)
+#define REPORTING_FLAG_DEV_MASK REPORTING_FLAG_DEV_BATTERY_STATUS
int reporting_flags;
uint8_t activity_counter[MAX_DEVICES];
/* TODO: pairing lock open or closed (+ timeout) */
@@ -172,8 +180,10 @@ typedef struct {
} mode;
bool powered_on;
uint8_t report_interval;
-#define REPORTING_FLAG_RECV_BATTERY_STATUS (1 << 4)
-#define REPORTING_FLAG_RECV_MASK REPORTING_FLAG_RECV_BATTERY_STATUS
+#define REPORTING_FLAG_RCV_WIRELESS_NOTIFS 1
+#define REPORTING_FLAG_RCV_SOFTWARE_PRESENT (1 << 3)
+#define REPORTING_FLAG_RCV_MASK (REPORTING_FLAG_RCV_WIRELESS_NOTIFS | \
+ REPORTING_FLAG_RCV_SOFTWARE_PRESENT)
int reporting_flags;
/* TODO: status (device seen or not, encrypted link) */