Skip to content

Commit

Permalink
WORKAROUND: Swap A/B buttons to match button label in right joycon
Browse files Browse the repository at this point in the history
Signed-off-by: 林博仁(Buo-ren Lin) <Buo.Ren.Lin@gmail.com>
  • Loading branch information
brlin-tw committed Sep 29, 2021
1 parent 83f28c8 commit e5a32b4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/virt_ctlr_combined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ void virt_ctlr_combined::relay_events(std::shared_ptr<phys_ctlr> phys)
libevdev_uinput_write_event(uidev, ev.type, ev.code == BTN_TL ? BTN_2: BTN_3, ev.value);
ret = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
continue;
} else if (phys == physr && ev.type == EV_KEY && (ev.code == BTN_A || ev.code == BTN_B)) {
/* Swap A, B buttons */
libevdev_uinput_write_event(uidev, ev.type, ev.code == BTN_A ? BTN_B: BTN_A, ev.value);
ret = libevdev_next_event(evdev, LIBEVDEV_READ_FLAG_NORMAL, &ev);
continue;
}
libevdev_uinput_write_event(uidev, ev.type, ev.code, ev.value);
}
Expand Down

0 comments on commit e5a32b4

Please sign in to comment.