mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-03-26 19:56:30 +00:00
Only open HID devices that might have a HIDAPI driver available
This prevents an OS prompt for every connected device when running on Android
This commit is contained in:
parent
31991ab851
commit
33050fea39
|
@ -194,7 +194,7 @@ HIDAPI_DriverPS4_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SONY_THIRDPARTY_VENDOR(vendor_id)) {
|
if (SONY_THIRDPARTY_VENDOR(vendor_id)) {
|
||||||
if (device) {
|
if (device && device->dev) {
|
||||||
if ((size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
|
if ((size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
|
||||||
data[2] == 0x27) {
|
data[2] == 0x27) {
|
||||||
/* Supported third party controller */
|
/* Supported third party controller */
|
||||||
|
|
|
@ -277,7 +277,7 @@ HIDAPI_DriverPS5_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SONY_THIRDPARTY_VENDOR(vendor_id)) {
|
if (SONY_THIRDPARTY_VENDOR(vendor_id)) {
|
||||||
if (device) {
|
if (device && device->dev) {
|
||||||
if ((size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
|
if ((size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
|
||||||
data[2] == 0x28) {
|
data[2] == 0x28) {
|
||||||
/* Supported third party controller */
|
/* Supported third party controller */
|
||||||
|
|
|
@ -1106,7 +1106,7 @@ static SDL_bool
|
||||||
HIDAPI_DriverJoyCons_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
HIDAPI_DriverJoyCons_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name, SDL_GameControllerType type, Uint16 vendor_id, Uint16 product_id, Uint16 version, int interface_number, int interface_class, int interface_subclass, int interface_protocol)
|
||||||
{
|
{
|
||||||
if (vendor_id == USB_VENDOR_NINTENDO) {
|
if (vendor_id == USB_VENDOR_NINTENDO) {
|
||||||
if (product_id == USB_PRODUCT_NINTENDO_SWITCH_PRO && device) {
|
if (product_id == USB_PRODUCT_NINTENDO_SWITCH_PRO && device && device->dev) {
|
||||||
/* This might be a Kinvoca Joy-Con that reports VID/PID as a Switch Pro controller */
|
/* This might be a Kinvoca Joy-Con that reports VID/PID as a Switch Pro controller */
|
||||||
ESwitchDeviceInfoControllerType eControllerType = ReadJoyConControllerType(device);
|
ESwitchDeviceInfoControllerType eControllerType = ReadJoyConControllerType(device);
|
||||||
if (eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft ||
|
if (eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft ||
|
||||||
|
|
|
@ -359,7 +359,8 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
|
||||||
return; /* Already setup */
|
return; /* Already setup */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure we can open the device and leave it open for the driver */
|
if (HIDAPI_GetDeviceDriver(device)) {
|
||||||
|
/* We might have a device driver for this device, try opening it and see */
|
||||||
if (device->num_children == 0) {
|
if (device->num_children == 0) {
|
||||||
/* On Android we need to leave joysticks unlocked because it calls
|
/* On Android we need to leave joysticks unlocked because it calls
|
||||||
* out to the main thread for permissions and the main thread can
|
* out to the main thread for permissions and the main thread can
|
||||||
|
@ -413,6 +414,7 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
|
||||||
SDL_hid_close(device->dev);
|
SDL_hid_close(device->dev);
|
||||||
device->dev = NULL;
|
device->dev = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue