Created
February 23, 2015 11:43
-
-
Save kingosticks/4057a662422276e8ee6c to your computer and use it in GitHub Desktop.
Alternative reicast SetupInput
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
#ifdef TARGET_PANDORA | |
#define DEFAULT_KEYBOARD_DEVICE "/dev/input/event4" | |
#else | |
#define DEFAULT_KEYBOARD_DEVICE "/dev/event2" | |
#endif | |
void SetupInput() | |
{ | |
for (int port=0;port<4;port++) | |
{ | |
kcode[port]=0xFFFF; | |
rt[port]=0; | |
lt[port]=0; | |
} | |
cfgLoadStr("config","system.keyboard",settings.system.keyboard,"null"); | |
if(strcmp(settings.system.keyboard,"null")!=0) | |
{ | |
const char* device = settings.system.keyboard; | |
} | |
else | |
{ | |
const char* device = DEFAULT_KEYBOARD_DEVICE; | |
} | |
printf("Keyboard using device %s\n", device); | |
char name[256]= "Unknown"; | |
if ((kbfd = open(device, O_RDONLY)) > 0) | |
{ | |
fcntl(kbfd,F_SETFL,O_NONBLOCK); | |
if(ioctl(kbfd, EVIOCGNAME(sizeof(name)), name) < 0) | |
{ | |
perror("evdev ioctl"); | |
} | |
printf("The device on %s says its name is %s\n",device, name); | |
} | |
else | |
{ | |
perror("evdev open"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment