Artifact 3b09a9b74fcacb8bbf4dcef43b31d9543309d5c8767bb830b8becc3e3507b6cd:
- File
src/hid/platform/Linux/OFGameController.m
— part of check-in
[5fdf28dd29]
at
2024-05-15 19:34:12
on branch gamecontroller
— OFGameController: Undo the last commit
It seems that just checking for the Xbox 360 controller VID/PID is not
sufficient, as there are a lot of controllers that are compatible with
it, but have a different VID/PID. However, they all use the xpad driver,
which returns BTN_X and BTN_Y, which in the Linux headers are equal to
BTN_NORTH and BTN_WEST - which is incorrect for an Xbox 360 controller.
It seems the Linux kernel is a huge mess where some drivers return what
is written on the button (such as Xbox 360 via the xpad driver, which
returns BTN_X/BTN_Y) and others where they are located (Sony, Nintendo,
which return BTN_NORTH/BTN_WEST). However, since Linux also maps
BTN_X/BTN_NORTH and BTN_Y/BTN_WEST to the same code, it's impossible to
figure out what the driver meant to do.As grepping the kernel code for BTN_NORTH has revealed that not a lot of
drivers use it and given that most controllers these days are XInput
controllers (which are handled by the xpad driver), it makes more sense
to assume that a controller is an XInput controller and map the Xbox 360
buttons to their locations. It's much easier to keep a list of
controllers with drivers that actually return BTN_NORTH/BTN_WEST instead
of what's written on the button (so far it seems to be only Nintendo and
Sony) than to keep a list of all XInput controllers. (user: js, size: 15216) [annotate] [blame] [check-ins using]
A hex dump of this file is not available. Please download the raw binary file and generate a hex dump yourself.