Skip to content

Commit

Permalink
Merge pull request #4260 from Be-ing/hid_apple_block
Browse files Browse the repository at this point in the history
HidEnumerator: skip all HID devices with Apple's vendor ID
  • Loading branch information
uklotzde committed Sep 5, 2021
2 parents 995a7de + adc13e6 commit 8a93f36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/controllers/hid/hiddenylist.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ typedef struct hid_denylist {

/// USB HID device that should not be recognized as controllers
hid_denylist_t hid_denylisted[] = {
{0x5ac, 0x253, 0xff00, 0x1, -1}, // Apple laptop chassis
{0x5ac, 0x8242, 0xc, 0x1, -1}, // Apple IR Remote Controller
{0x1157, 0x300, 0x1, 0x2, -1}, // EKS Otus mouse pad (OS/X,windows)
{0x1157, 0x300, 0x0, 0x0, 0x3}, // EKS Otus mouse pad (linux)
};

constexpr unsigned short kAppleVendorId = 0x5ac;

constexpr unsigned short kGenericDesktopUsagePage = 0x01;

constexpr unsigned short kGenericDesktopMouseUsage = 0x02;
Expand Down
10 changes: 10 additions & 0 deletions src/controllers/hid/hidenumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ bool recognizeDevice(const hid_device_info& device_info) {
return false;
}

// Apple includes a variety of HID devices in their computers, not all of which
// match the filter above for keyboards and mice, for example "Magic Trackpad",
// "Internal Keyboard", and "T1 Controller". Apple is likely to keep changing
// these devices in future computers and none of these devices are DJ controllers,
// so skip all Apple HID devices rather than maintaining a list of specific devices
// to skip.
if (device_info.vendor_id == kAppleVendorId) {
return false;
}

// Exclude specific devices from the denylist.
bool interface_number_valid = device_info.interface_number != -1;
const int denylist_len = sizeof(hid_denylisted) / sizeof(hid_denylisted[0]);
Expand Down

0 comments on commit 8a93f36

Please sign in to comment.