mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-01-01 14:29:58 +01:00
Will try to open the device for read/write first, if that fails, trys
read only and displays a message about not being enabled for force feedback
This commit is contained in:
parent
eac5380da4
commit
ab7bba58d6
|
|
@ -40,13 +40,21 @@ EventDevice::EventDevice(char *deviceFileName) {
|
|||
char tempName[Device::MAX_NAME_LENGTH-1] = "Unknown";
|
||||
int i;
|
||||
|
||||
fd = open(deviceFileName, O_RDONLY | O_NONBLOCK);
|
||||
fd = open(deviceFileName, O_RDWR | O_NONBLOCK);
|
||||
if(fd<0) {
|
||||
/*char errorMessage[512];
|
||||
sprintf(errorMessage, "Error opening device %s\n", deviceFileName);
|
||||
perror(errorMessage);*/
|
||||
inited = 0;
|
||||
return;
|
||||
|
||||
char errorMessage[512];
|
||||
sprintf(errorMessage, "Error opening device %s read/write, Force Feedback disabled for this device\n", deviceFileName);
|
||||
perror(errorMessage);
|
||||
|
||||
fd = open(deviceFileName, O_RDONLY | O_NONBLOCK);
|
||||
if(fd<0) {
|
||||
/*char errorMessage[512];
|
||||
sprintf(errorMessage, "Error opening device %s\n", deviceFileName);
|
||||
perror(errorMessage);*/
|
||||
inited = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(ioctl(fd, EVIOCGNAME(sizeof(tempName)), tempName) < 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue