Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
vm_tools: add logging for gamepads
Browse files Browse the repository at this point in the history
Added a basic log for when gamepads are added.
Example messages:
info: Gamepad added: name=Xbox, bus=1, vendor_id=45e, product_id=2fd, version=903, input_mapping=XboxOneS2016MappingV1
info: Gamepad removed: name=Xbox, bus=1, vendor_id=45e, product_id=2fd, version=903, input_mapping=XboxOneS2016MappingV1

BUG=b:288358582
TEST=on DUT

Change-Id: I6c9defd8004af6e2559818522e3151ffb366e1d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/4653089
Reviewed-by: Nic Hollingum <[email protected]>
Commit-Queue: Daniel Ng <[email protected]>
Tested-by: Daniel Ng <[email protected]>
  • Loading branch information
BipBopBoop authored and Chromeos LUCI committed Jul 10, 2023
1 parent e327ad7 commit b6b3fd4
Show file tree
Hide file tree
Showing 3 changed files with 257 additions and 219 deletions.
8 changes: 4 additions & 4 deletions sommelier-gaming-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ TEST_F(GamepadTest, MappingsWorkCorrectly) {

EXPECT_EQ(host_gamepads.size(), 1);

for (auto& input : *it.second) {
for (auto& input : it.second->mapping) {
EXPECT_CALL(libevdevshim, enable_event_code(ev_dev, EV_ABS, input.second,
::testing::_));

Expand All @@ -332,7 +332,7 @@ TEST_F(GamepadTest, MappingsWorkCorrectly) {

host_gamepads[0]->state = kStateActivated;

for (auto& input : *it.second) {
for (auto& input : it.second->mapping) {
EXPECT_CALL(libevdevshim,
uinput_write_event(host_gamepads[0]->uinput_dev, EV_ABS,
input.second, wl_fixed_to_double(250)));
Expand All @@ -346,7 +346,7 @@ TEST_F(GamepadTest, MappingsWorkCorrectly) {
ZCR_GAMEPAD_V2_BUTTON_STATE_RELEASED, 0);
}

EXPECT_EQ(host_gamepads[0]->mapping, it.second);
EXPECT_EQ(host_gamepads[0]->input_mapping, it.second);
EXPECT_CALL(libevdevshim, free(host_gamepads[0]->ev_dev));

HostEventHandler(gamepad)->removed(host_gamepads[0], gamepad);
Expand Down Expand Up @@ -375,7 +375,7 @@ TEST_F(GamepadTest, DualShock3MappingWorksCorrectly) {
std::vector<struct sl_host_gamepad*> host_gamepads = GetHostGamepads(&ctx);

EXPECT_EQ(host_gamepads.size(), 1);
EXPECT_EQ(host_gamepads[0]->mapping, &kDualShock3Mapping);
EXPECT_EQ(host_gamepads[0]->input_mapping, &kDualShock3Mapping);

// This object forces all EXPECT_CALLs to occur in the order they are
// declared. This insures expectations are paired to the correct
Expand Down
Loading

0 comments on commit b6b3fd4

Please sign in to comment.