From e371ef3ec4053d83abad683289f91a447d9e92ed Mon Sep 17 00:00:00 2001 From: viandoxdev Date: Sat, 1 Oct 2022 18:36:57 +0200 Subject: [PATCH] Tiny fixes: add support for second gen and fix building on old gcc --- Makefile | 4 ++-- hid.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 7e3b7a2..320d1ae 100644 --- a/Makefile +++ b/Makefile @@ -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 $<" diff --git a/hid.c b/hid.c index 1edd9d7..0384e28 100644 --- a/hid.c +++ b/hid.c @@ -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