-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Modernize Hid/Bulk Lists #13622
base: main
Are you sure you want to change the base?
Modernize Hid/Bulk Lists #13622
Changes from 15 commits
3e2b8e9
2355ace
2c2b47f
4f4c424
14f0ea8
7b712fa
4d58f6b
a914b05
c29c42e
8b7c661
7420032
564a318
46cf164
4df2508
18c8ce4
cc182df
60541eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <optional> | ||
|
||
struct bulk_device_id { | ||
std::uint16_t vendor_id; | ||
daschuer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::uint16_t product_id; | ||
}; | ||
|
||
// A list of supported USB bulk devices | ||
|
||
#pragma once | ||
struct bulk_device_endpoints { | ||
std::uint8_t in_epaddr; | ||
std::uint8_t out_epaddr; | ||
daschuer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// we may not know the interface, in which case we should not try to claim it. | ||
std::optional<std::uint8_t> interface_number = std::nullopt; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The initializer is redundant. I would rather make it explicit in the table, that the value is unknown and we need to fill it to make it work on Windows and macOs. In addition a brief to-do comment in the table is useful. We may also file a bug as a reminder that these devices are not yet usable with windows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we sure they only don't work under windows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know. But it looks like @acolombier as added the claiming to enable the controllers in windows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I saw that. but maybe it also just didn't work under windows because libusb didn't claim the right interface automatically (since from what I could tell an interface needs to be claimed anyways in order to do any operation on it). Do we want to rely on the automatic claiming (if it exists across all backends at all)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like libusb is not able to automatically claim an interface. The auto feature is regarding detaching the kernel driver which is not supported on Windows. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guessed so because I saw There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting libusb running under Windows requires further changes. It is not functional yet, as we need to register a device driver (e.g. the generic WinUSB driver that comes with Windows) for the particular device type. This could be done using https://github.com/pbatard/libwdi but requires elevated user rights. Either in the Mixxx installer or at runtime of Mixxx itself with temporary elevated rights. |
||
}; | ||
|
||
typedef struct bulk_supported { | ||
unsigned short vendor_id; | ||
unsigned short product_id; | ||
unsigned char in_epaddr; | ||
unsigned char out_epaddr; | ||
unsigned int interface_number; | ||
} bulk_supported_t; | ||
struct bulk_support_lookup { | ||
bulk_device_id key; | ||
bulk_device_endpoints endpoints; | ||
}; | ||
|
||
static bulk_supported_t bulk_supported[] = { | ||
{0x06f8, 0xb105, 0x82, 0x03, 0}, // Hercules MP3e2 | ||
{0x06f8, 0xb107, 0x83, 0x03, 0}, // Hercules Mk4 | ||
{0x06f8, 0xb100, 0x86, 0x06, 0}, // Hercules Mk2 | ||
{0x06f8, 0xb120, 0x82, 0x03, 0}, // Hercules MP3 LE / Glow | ||
{0, 0, 0, 0, 0}}; | ||
constexpr static bulk_support_lookup bulk_supported[] = { | ||
{{0x06f8, 0xb105}, {0x82, 0x03}}, // Hercules MP3e2 | ||
{{0x06f8, 0xb107}, {0x83, 0x03}}, // Hercules Mk4 | ||
{{0x06f8, 0xb100}, {0x86, 0x06}}, // Hercules Mk2 | ||
{{0x06f8, 0xb120}, {0x82, 0x03}}, // Hercules MP3 LE / Glow | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,35 @@ | ||
#pragma once | ||
|
||
typedef struct hid_denylist { | ||
// TODO: unify this with the invalid interfacenumber from the bulkenumerator | ||
constexpr static int kInvalidInterfaceNumber = -1; | ||
constexpr static unsigned short kAnyValue = 0x0; | ||
|
||
struct hid_denylist_t { | ||
unsigned short vendor_id; | ||
unsigned short product_id; | ||
unsigned short usage_page; | ||
unsigned short usage; | ||
int interface_number; | ||
daschuer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} hid_denylist_t; | ||
int interface_number = kInvalidInterfaceNumber; | ||
}; | ||
|
||
/// USB HID device that should not be recognized as controllers | ||
constexpr hid_denylist_t hid_denylisted[] = { | ||
{0x1157, 0x300, 0x1, 0x2, -1}, // EKS Otus mouse pad (OS/X,windows) | ||
{0x1157, 0x300, 0x0, 0x0, 0x3}, // EKS Otus mouse pad (linux) | ||
{0x04f3, 0x2d26, 0x0, 0x0, -1}, // ELAN2D26:00 Touch screen | ||
{0x046d, 0xc539, 0x0, 0x0, -1}, // Logitech G Pro Wireless | ||
constexpr static hid_denylist_t hid_denylisted[] = { | ||
{0x1157, 0x300, 0x1, 0x2}, // EKS Otus mouse pad (OS/X,windows) | ||
{0x1157, 0x300, kAnyValue, kAnyValue, 0x3}, // EKS Otus mouse pad (linux) | ||
{0x04f3, 0x2d26, kAnyValue, kAnyValue}, // ELAN2D26:00 Touch screen | ||
{0x046d, 0xc539, kAnyValue, kAnyValue}, // Logitech G Pro Wireless | ||
// The following rules have been created using the official USB HID page | ||
// spec as specified at https://usb.org/sites/default/files/hut1_4.pdf | ||
{0x0, 0x0, 0x0D, 0x04, -1}, // Touch Screen | ||
{0x0, 0x0, 0x0D, 0x22, -1}, // Finger | ||
{ | ||
kAnyValue, | ||
kAnyValue, | ||
0x0D, | ||
0x04, | ||
}, // Touch Screen | ||
{ | ||
kAnyValue, | ||
kAnyValue, | ||
0x0D, | ||
0x22, | ||
}, // Finger | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be moved to the inner scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops of course. fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, of course. done