Tiny fixes: add support for second gen and fix building on old gcc

This commit is contained in:
viandoxdev 2022-10-01 18:36:57 +02:00
parent 65daad3b13
commit e371ef3ec4
No known key found for this signature in database
GPG Key ID: AF1410C5BC10AA25
2 changed files with 4 additions and 4 deletions

View File

@ -1,7 +1,7 @@
Q=@
CC=gcc
CFLAGS=-g -Wall -Wno-format-truncation -pthread -lm
LDFLAGS=
LDFLAGS=-lm
BUILD_DIR=./objects
BIN=jsfw
@ -19,7 +19,7 @@ run: $(BIN)
$(BIN): $(OBJECTS)
@echo "LD $@"
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
$(Q) $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)
@echo "CC $<"

4
hid.c
View File

@ -144,10 +144,10 @@ bool filter_event(int fd, char *event) {
}
}
// Check product and vendor id 054c:05c4 => Dualshock 4
// Check product and vendor id 054c:05c4 => Dualshock 4 (09cc is for the second generation)
uint16_t info[4];
ioctl(fd, EVIOCGID, info);
return info[1] == 0x054c && info[2] == 0x05c4;
return info[1] == 0x054c && (info[2] == 0x05c4 || info[2] == 0x09cc);
}
// Initialize vectors for polling