Last active
April 5, 2021 10:43
-
-
Save ivyl/cb92c7a7e4f5ec5babebca56ff6c1655 to your computer and use it in GitHub Desktop.
xpadneo 0.9 enum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ivyl@failcraft $ modinfo hid_xpadneo | head -n 2 | |
filename: /lib/modules/5.11.11-zen1-1-zen/kernel/drivers/hid/hid-xpadneo.ko.xz | |
version: v0.9-51-gfa41a04 | |
ivyl@failcraft $ SDL_JOYSTICK_HIDAPI=1 ./sdl-enum | |
Joystick 0: "Xbox One Series X Controller" | |
PIDVIDVER: 045e:0b13:0000 | |
IsGameController: 1 | |
Joystick 1: "Xbox One S Controller" | |
PIDVIDVER: 045e:02e0:0903 | |
IsGameController: 1 | |
ivyl@failcraft $ SDL_JOYSTICK_HIDAPI=0 ./sdl-enum | |
Joystick 0: "Xbox One S Controller" | |
PIDVIDVER: 045e:02e0:0903 | |
IsGameController: 1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* gcc sdl-enum.c -o sdl-enum `pkg-config --libs sdl2` */ | |
#include <SDL2/SDL.h> | |
#include <assert.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <inttypes.h> | |
SDL_Window *window; | |
SDL_Renderer *renderer; | |
SDL_GameController *controller; | |
int main(int argc, char *argv[]) | |
{ | |
int num_joysticks; | |
assert(0 == SDL_Init(SDL_INIT_GAMECONTROLLER)); | |
/* SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI, "0"); */ | |
num_joysticks = SDL_NumJoysticks(); | |
for (int i = 0; i < num_joysticks; ++i) | |
{ | |
SDL_Joystick *joystick = SDL_JoystickOpen(i); | |
assert(joystick); | |
printf("Joystick %d: \"%s\"\n", i, SDL_JoystickName(joystick)); | |
printf(" PIDVIDVER: %04hx:%04hx:%04hx\n", SDL_JoystickGetDeviceVendor(i), | |
SDL_JoystickGetDeviceProduct(i), | |
SDL_JoystickGetDeviceProductVersion(i)); | |
printf(" IsGameController: %d\n", (int)SDL_IsGameController(i)); | |
SDL_JoystickClose(joystick); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment