|
|
@ -51,6 +51,14 @@ const KeyboardReport& HIDState::Keyboard(size_t i) const {
|
|
|
|
return keyboard_reports_.at(i);
|
|
|
|
return keyboard_reports_.at(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const std::vector<MouseReport>& HIDState::Mouse() const {
|
|
|
|
|
|
|
|
return mouse_reports_;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const MouseReport& HIDState::Mouse(size_t i) const {
|
|
|
|
|
|
|
|
return mouse_reports_.at(i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const std::vector<SystemControlReport>& HIDState::SystemControl() const {
|
|
|
|
const std::vector<SystemControlReport>& HIDState::SystemControl() const {
|
|
|
|
return system_control_reports_;
|
|
|
|
return system_control_reports_;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -65,10 +73,6 @@ namespace internal {
|
|
|
|
void HIDStateBuilder::ProcessHidReport(
|
|
|
|
void HIDStateBuilder::ProcessHidReport(
|
|
|
|
uint8_t id, const void* data, int len, int result) {
|
|
|
|
uint8_t id, const void* data, int len, int result) {
|
|
|
|
switch (id) {
|
|
|
|
switch (id) {
|
|
|
|
case HID_REPORTID_MOUSE: {
|
|
|
|
|
|
|
|
LOG(ERROR) << "Dropped MouseReport: unimplemented";
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case HID_REPORTID_KEYBOARD: {
|
|
|
|
case HID_REPORTID_KEYBOARD: {
|
|
|
|
LOG(ERROR) << "Dropped BootKeyboardReport: unimplemented";
|
|
|
|
LOG(ERROR) << "Dropped BootKeyboardReport: unimplemented";
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -85,6 +89,10 @@ void HIDStateBuilder::ProcessHidReport(
|
|
|
|
ProcessSystemControlReport(SystemControlReport{data});
|
|
|
|
ProcessSystemControlReport(SystemControlReport{data});
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
case HID_REPORTID_MOUSE: {
|
|
|
|
|
|
|
|
ProcessMouseReport(MouseReport{data});
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
case HID_REPORTID_MOUSE_ABSOLUTE: {
|
|
|
|
case HID_REPORTID_MOUSE_ABSOLUTE: {
|
|
|
|
ProcessAbsoluteMouseReport(AbsoluteMouseReport{data});
|
|
|
|
ProcessAbsoluteMouseReport(AbsoluteMouseReport{data});
|
|
|
|
break;
|
|
|
|
break;
|
|
|
@ -107,6 +115,7 @@ std::unique_ptr<HIDState> HIDStateBuilder::Snapshot() {
|
|
|
|
hid_state->absolute_mouse_reports_ = std::move(absolute_mouse_reports_);
|
|
|
|
hid_state->absolute_mouse_reports_ = std::move(absolute_mouse_reports_);
|
|
|
|
hid_state->consumer_control_reports_ = std::move(consumer_control_reports_);
|
|
|
|
hid_state->consumer_control_reports_ = std::move(consumer_control_reports_);
|
|
|
|
hid_state->keyboard_reports_ = std::move(keyboard_reports_);
|
|
|
|
hid_state->keyboard_reports_ = std::move(keyboard_reports_);
|
|
|
|
|
|
|
|
hid_state->mouse_reports_ = std::move(mouse_reports_);
|
|
|
|
hid_state->system_control_reports_ = std::move(system_control_reports_);
|
|
|
|
hid_state->system_control_reports_ = std::move(system_control_reports_);
|
|
|
|
|
|
|
|
|
|
|
|
Clear(); // Clear global state.
|
|
|
|
Clear(); // Clear global state.
|
|
|
@ -118,6 +127,7 @@ void HIDStateBuilder::Clear() {
|
|
|
|
absolute_mouse_reports_.clear();
|
|
|
|
absolute_mouse_reports_.clear();
|
|
|
|
consumer_control_reports_.clear();
|
|
|
|
consumer_control_reports_.clear();
|
|
|
|
keyboard_reports_.clear();
|
|
|
|
keyboard_reports_.clear();
|
|
|
|
|
|
|
|
mouse_reports_.clear();
|
|
|
|
system_control_reports_.clear();
|
|
|
|
system_control_reports_.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -136,6 +146,11 @@ void HIDStateBuilder::ProcessKeyboardReport(const KeyboardReport& report) {
|
|
|
|
keyboard_reports_.push_back(report);
|
|
|
|
keyboard_reports_.push_back(report);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
|
|
|
|
void HIDStateBuilder::ProcessMouseReport(const MouseReport& report) {
|
|
|
|
|
|
|
|
mouse_reports_.push_back(report);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
// static
|
|
|
|
void HIDStateBuilder::ProcessSystemControlReport(const SystemControlReport& report) {
|
|
|
|
void HIDStateBuilder::ProcessSystemControlReport(const SystemControlReport& report) {
|
|
|
|
system_control_reports_.push_back(report);
|
|
|
|
system_control_reports_.push_back(report);
|
|
|
@ -148,6 +163,8 @@ std::vector<ConsumerControlReport> HIDStateBuilder::consumer_control_reports_;
|
|
|
|
// static
|
|
|
|
// static
|
|
|
|
std::vector<KeyboardReport> HIDStateBuilder::keyboard_reports_;
|
|
|
|
std::vector<KeyboardReport> HIDStateBuilder::keyboard_reports_;
|
|
|
|
// static
|
|
|
|
// static
|
|
|
|
|
|
|
|
std::vector<MouseReport> HIDStateBuilder::mouse_reports_;
|
|
|
|
|
|
|
|
// static
|
|
|
|
std::vector<SystemControlReport> HIDStateBuilder::system_control_reports_;
|
|
|
|
std::vector<SystemControlReport> HIDStateBuilder::system_control_reports_;
|
|
|
|
|
|
|
|
|
|
|
|
} // namesapce internal
|
|
|
|
} // namesapce internal
|
|
|
|