Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/jslisten.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,10 +417,15 @@ void listenJoy (void) {
sysPath = udev_device_get_syspath(mydev);
devPath = udev_device_get_devnode(mydev);

if (sysPath != NULL && devPath != NULL && strstr(sysPath, myDevPath) != 0) {
syslog(LOG_NOTICE, "Found Device: %s\n", devPath);
if ((joyFD = open(devPath, O_RDONLY)) < 0) { // Open the file descriptor
syslog(LOG_INFO, "error: failed to open fd\n");
if (sysPath != NULL && devPath != NULL && strstr(sysPath, "/js") != 0) {
syslog (LOG_NOTICE, "Found Device: %s\n", devPath);
if (joyFD < 0 || strcmp(devPath, myDevPath) == 0) {
// Open the file descriptor
if ((joyFD = open(devPath, O_RDONLY)) < 0) {
syslog (LOG_INFO, "error: failed to open fd\n");
} else {
syslog (LOG_NOTICE, "Watching: %s\n", devPath);
}
}
}

Expand Down Expand Up @@ -649,12 +654,10 @@ void parse_command_line(int argc, char* argv[]) {
case 'm':
if (strncmp(optarg, MODE_HOLD_STR, strlen(MODE_HOLD_STR)) == 0) {
mode = HOLD;
}
if (strncmp(optarg, MODE_PLAIN_STR, strlen(MODE_PLAIN_STR)) == 0) {
} else if (strncmp(optarg, MODE_PLAIN_STR, strlen(MODE_PLAIN_STR)) == 0) {
mode = PLAIN;
} else {
syslog(LOG_WARNING, "--mode %s parameter unknown. Using default.\n", optarg);

}
break;
case '?':
Expand Down