Skip to content

Conversation

slouken
Copy link
Contributor

@slouken slouken commented May 26, 2023

No description provided.

Signed-off-by: Sam Lantinga <slouken@libsdl.org>
@mcuee mcuee added the Windows Related to Windows backend label May 27, 2023
@slouken slouken marked this pull request as draft May 27, 2023 15:16
@slouken slouken marked this pull request as ready for review May 27, 2023 16:00
@@ -756,6 +756,28 @@ static struct hid_device_info *hid_internal_get_device_info(const wchar_t *path,
return dev;
}

static int hid_blacklist(unsigned short vendor_id, unsigned short product_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use also such a denylist in our app. But we use more filter criteria: USB-Interface-Number, Usage-Page, Usage and Bus-Type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that logic could be moved into SDL, but since we've definitely run into problems with those devices I thought it would be worth sharing upstream.

@Youw
Copy link
Member

Youw commented May 31, 2023

Interesting - does it hang only on Windows, what about other platforms?
Does it hang regardless of the Windows/driver version?

@slouken
Copy link
Contributor Author

slouken commented May 31, 2023

These are mostly from Steam customer reports, running Windows. I'm not sure whether they vary based on OS or driver version. There was one device which I observed hanging on Linux, and it was the device itself that was hanging while processing a string request, not the driver. Unfortunately this was years ago and I don't remember which one it was.

@slouken
Copy link
Contributor Author

slouken commented May 31, 2023

The Speedlink Competition Pro was one I observed myself, and it was the strangest behavior. The controller actually disconnected and re-enumerated as a different (non-functional) device when queried.

@Youw
Copy link
Member

Youw commented May 31, 2023

What I am afraid in hard-coded lists like this is that it makes it really difficult to support and reason about, e.g.:

  • what if the device/driver/OS got fixed over time and someone really needs to use it?
  • what if it was never a device/driver problem (but a cable/HUB/etc.)?
  • what if all of it works since Windoes 11 vXXXX, and none of it is needed anymore?
  • what if all of those are valid broken devices and we should filter them out on all platforms?

I've very scepticaly of having it as part of HIDAPI implementation.


I'd like to hear/investigate from someone who has one of those faulty devices.

@slouken
Copy link
Contributor Author

slouken commented May 31, 2023

These are all reasonable concerns. I'll go ahead and leave this in SDL and close this PR.

@slouken slouken closed this May 31, 2023
@Youw
Copy link
Member

Youw commented May 31, 2023

We could do both: allow SDL filter out devices like this, and avoid patching HIDAPI sources if we would introduce something like:

typedef int (*HID_API_CALL hidapi_ven_dev_filter_func)(unsigned short vendor_id, unsigned short product_id);
struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate_ven_dev_filter(hidapi_ven_dev_filter_func);

But that is a different effort, and would definitely need an implementation on all platforms.

@slouken
Copy link
Contributor Author

slouken commented May 31, 2023

Yup, agreed. And for what it's worth the SDL filter also uses the usage page and usage, so that might be useful in this model.

Let me know if you'd like me to create a PR for this approach?

@Youw
Copy link
Member

Youw commented May 31, 2023

If you're up to it - the improvements are always welcome.
You've already introduced a lot of those, thank you for that.
Would be great to finish up the existing PRs first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Related to Windows backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants