Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put mouse before gamepad due to MacOS being finicky #4558

Merged
merged 1 commit into from
Apr 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tools/gen_usb_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
ALL_DEVICES_SET = frozenset(ALL_DEVICES.split())
DEFAULT_DEVICES = "CDC MSC AUDIO HID"

# This list is in preferred order. MacOS does not like GAMEPAD coming before MOUSE.
ALL_HID_DEVICES = (
"KEYBOARD MOUSE CONSUMER SYS_CONTROL GAMEPAD DIGITIZER XAC_COMPATIBLE_GAMEPAD RAW"
)
ALL_HID_DEVICES_ORDER = dict((name, idx) for (idx, name) in enumerate(ALL_HID_DEVICES.split()))
ALL_HID_DEVICES_SET = frozenset(ALL_HID_DEVICES.split())
# Digitizer works on Linux but conflicts with mouse, so omit it.
DEFAULT_HID_DEVICES = "KEYBOARD MOUSE CONSUMER GAMEPAD"
Expand Down Expand Up @@ -352,7 +354,8 @@ def make_cdc_data_interface(name, cdc_ep_num_data_in, cdc_ep_num_data_out):
else:
report_id = 1
concatenated_descriptors = bytearray()
for name in args.hid_devices:
# Sort HID devices by preferred order.
for name in sorted(args.hid_devices, key=ALL_HID_DEVICES_ORDER.get):
concatenated_descriptors.extend(
bytes(hid_report_descriptors.REPORT_DESCRIPTOR_FUNCTIONS[name](report_id))
)
Expand Down