summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/usb/hid-logitech-dj.c16
-rw-r--r--hw/usb/hid-logitech-dj.h1
2 files changed, 17 insertions, 0 deletions
diff --git a/hw/usb/hid-logitech-dj.c b/hw/usb/hid-logitech-dj.c
index dddc5027f4..551ed768ee 100644
--- a/hw/usb/hid-logitech-dj.c
+++ b/hw/usb/hid-logitech-dj.c
@@ -157,6 +157,7 @@ static bool hidpp_process_receiver_report(USBLtunifyState *s, HidppMsg *msg)
} else if (msg->report_id == HIDPP_SHORT || msg->report_id == HIDPP_LONG) {
LHidReceiver *rcvr = &s->receiver;
HidppMsgShort *ms = &msg->hidpp_s;
+ HidppMsgLong *ml = &msg->hidpp_l;
unsigned req = (ms->report_id << 16) | (ms->sub_id << 8) | ms->address;
switch (req) {
@@ -180,6 +181,16 @@ static bool hidpp_process_receiver_report(USBLtunifyState *s, HidppMsg *msg)
}
hidpp_queue_output_report(s, msg);
break;
+ case GET_LONG_REG(0xB3): /* Device Activity */
+ memset(ml->value, 0, sizeof(ml->value));
+ ml->report_id = HIDPP_LONG;
+ for (i = 0; i < MAX_DEVICES; i++) {
+ if (s->devices[i].info.device_type) {
+ ml->value[i] = s->devices[i].activity_counter;
+ }
+ }
+ hidpp_queue_output_report(s, msg);
+ break;
default:
/* unknown request, return error */
switch (req & ~0xFF) {
@@ -354,6 +365,11 @@ void usb_ltunify_handle_datain_hidpp(USBDevice *dev, USBPacket *p)
if (msg != NULL) {
len = msg_report_length(msg);
assert(len > 0);
+
+ if (hidpp_device_available(s, msg->device_index)) {
+ s->devices[msg->device_index - 1].activity_counter++;
+ }
+
usb_dump_complete_data(s->usb_dump_state, p, (uint8_t *) msg, len);
usb_packet_copy(p, (uint8_t *) msg, len);
usb_dump_submit(s->usb_dump_state, p);
diff --git a/hw/usb/hid-logitech-dj.h b/hw/usb/hid-logitech-dj.h
index 6518c39fba..0ba7a5f61b 100644
--- a/hw/usb/hid-logitech-dj.h
+++ b/hw/usb/hid-logitech-dj.h
@@ -184,6 +184,7 @@ typedef struct {
/* TODO: charging, discharging, etc. */
} status;
} battery;
+ uint8_t activity_counter;
} LHidDevice;
/* helper macros for handling the report and error queue */