Tiny fixes: add support for second gen and fix building on old gcc
This commit is contained in:
parent
65daad3b13
commit
e371ef3ec4
4
Makefile
4
Makefile
|
@ -1,7 +1,7 @@
|
||||||
Q=@
|
Q=@
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=-g -Wall -Wno-format-truncation -pthread -lm
|
CFLAGS=-g -Wall -Wno-format-truncation -pthread -lm
|
||||||
LDFLAGS=
|
LDFLAGS=-lm
|
||||||
BUILD_DIR=./objects
|
BUILD_DIR=./objects
|
||||||
BIN=jsfw
|
BIN=jsfw
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ run: $(BIN)
|
||||||
|
|
||||||
$(BIN): $(OBJECTS)
|
$(BIN): $(OBJECTS)
|
||||||
@echo "LD $@"
|
@echo "LD $@"
|
||||||
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@
|
$(Q) $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)
|
$(BUILD_DIR)/%.o: %.c | $(BUILD_DIR)
|
||||||
@echo "CC $<"
|
@echo "CC $<"
|
||||||
|
|
4
hid.c
4
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];
|
uint16_t info[4];
|
||||||
ioctl(fd, EVIOCGID, info);
|
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
|
// Initialize vectors for polling
|
||||||
|
|
Loading…
Reference in New Issue