macOS: DJ Hero Turntable support (deck buttons, passthrough conflict) (#18957)

This commit is contained in:
silvatyrant 2026-06-30 20:21:49 +02:00 committed by GitHub
parent bec42ea93e
commit 8c89adf177
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 1 deletions

View File

@ -391,6 +391,17 @@ void usb_handler_thread::perform_scan()
&& desc.idProduct >= entry.id_product_min
&& desc.idProduct <= entry.id_product_max)
{
#ifdef __APPLE__
// On macOS, libusb cannot claim HID interfaces, so passing through a real
// controller that also has an emulated implementation yields a non-functional
// device and silently overrides the user's emulated-device setting (the emulated
// setup below only fills slots not already passed through). Prefer the emulated
// implementation whenever the user has enabled it. (e.g. DJ Hero Turntable)
if (entry.make_instance && entry.max_device_count && entry.max_device_count() > 0)
{
continue;
}
#endif
sys_usbd.success("Found device: %s", std::basic_string(entry.device_name));
libusb_ref_device(dev);
std::shared_ptr<usb_device_passthrough> usb_dev = std::make_shared<usb_device_passthrough>(dev, desc, get_new_location());

View File

@ -341,7 +341,13 @@ SDLDevice::sdl_info sdl_pad_handler::get_sdl_info(SDL_JoystickID id)
const int num_axes = SDL_GetNumJoystickAxes(joystick);
const int num_buttons = SDL_GetNumJoystickButtons(joystick);
info.is_ds3_with_pressure_buttons = num_axes == 16 && num_buttons == 11;
// The DJ Hero Turntable (VID 0x12BA, PID 0x0140) coincidentally matches the
// DS3 axis/button counts (16 axes, 11 buttons) but is NOT a pressure-sensitive
// DS3. Routing its face buttons through the pressure axes drops the green (Cross)
// and blue (Square) deck buttons, so exclude it and read its buttons digitally.
const bool is_dj_hero_turntable = info.vid == 0x12BA && info.pid == 0x0140;
info.is_ds3_with_pressure_buttons = num_axes == 16 && num_buttons == 11 && !is_dj_hero_turntable;
sdl_log.notice("DS3 device %d has %d axis and %d buttons (has_pressure_buttons=%d)", id, num_axes, num_buttons, info.is_ds3_with_pressure_buttons);