summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-misc/ltunify/files')
-rw-r--r--app-misc/ltunify/files/ltunify-0.3-compiler-warning.patch26
-rw-r--r--app-misc/ltunify/files/ltunify-0.3-ldflags.patch19
2 files changed, 45 insertions, 0 deletions
diff --git a/app-misc/ltunify/files/ltunify-0.3-compiler-warning.patch b/app-misc/ltunify/files/ltunify-0.3-compiler-warning.patch
new file mode 100644
index 000000000000..d443114613e5
--- /dev/null
+++ b/app-misc/ltunify/files/ltunify-0.3-compiler-warning.patch
@@ -0,0 +1,26 @@
+commit b68dc9af6db53de231d5ac71f9b6ba2ff3057a68
+Author: Peter Wu <peter@lekensteyn.nl>
+Date: Sun Jun 14 22:59:19 2020 +0200
+
+ ltunify: fix harmless compiler warning
+
+ bInterfaceNumber is expected to return the `%02x` format according to
+ the current kernel sources. Even if that is not true, a user can always
+ manually specify the hidraw device if the wrong device is detected.
+
+diff --git a/ltunify.c b/ltunify.c
+index 1e685b4..9625776 100644
+--- a/ltunify.c
++++ b/ltunify.c
+@@ -1214,7 +1214,10 @@ int open_hidraw(void) {
+ if (pid == PID_NANO_RECEIVER_2) {
+ int iface = -1;
+ if ((fp = fopen_format("/sys/class/hidraw/%s/device/../bInterfaceNumber", dev_name))) {
+- fscanf(fp, "%02x", &iface);
++ int m = fscanf(fp, "%02x", &iface);
++ if (m != 1) {
++ iface = -1;
++ }
+ fclose(fp);
+ }
+ if (iface == 0) {
diff --git a/app-misc/ltunify/files/ltunify-0.3-ldflags.patch b/app-misc/ltunify/files/ltunify-0.3-ldflags.patch
new file mode 100644
index 000000000000..10a18b3e485e
--- /dev/null
+++ b/app-misc/ltunify/files/ltunify-0.3-ldflags.patch
@@ -0,0 +1,19 @@
+diff --git a/Makefile b/Makefile
+index 8116950..e8b4df9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,5 @@
+ CFLAGS ?= -g -O2 -Wall -Wextra -D_FORTIFY_SOURCE=2 -fstack-protector --param ssp-buffer-size=4
++LDFLAGS ?=
+ # for install-home
+ BINDIR ?= $(HOME)/bin
+
+@@ -24,7 +25,7 @@ all: ltunify read-dev-usbmon
+ read-dev-usbmon: read-dev-usbmon.c hidraw.c
+
+ ltunify: ltunify.c hidpp20.c
+- $(CC) $(CFLAGS) -o $(OUTDIR)$@ $< -lrt $(LTUNIFY_DEFINES)
++ $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTDIR)$@ $< -lrt $(LTUNIFY_DEFINES)
+
+ .PHONY: all clean install-home install install-udevrule uninstall
+ clean: