diff options
-rw-r--r-- | 99-marsond.rules.in | 2 | ||||
-rw-r--r-- | Makefile | 21 | ||||
-rw-r--r-- | marsond.c | 2 |
3 files changed, 21 insertions, 4 deletions
diff --git a/99-marsond.rules.in b/99-marsond.rules.in index 5a81b59..dcc060e 100644 --- a/99-marsond.rules.in +++ b/99-marsond.rules.in @@ -13,4 +13,4 @@ # if you need extra arguments to marsond, you can put them in # the RUN string. -ACTION=="add", ATTRS{idVendor}=="04b4", ATTRS{idProduct}=="0101", RUN+="@SBINDIR@/marsond" +ACTION=="add", ATTRS{idVendor}=="@VENDOR_ID@", ATTRS{idProduct}=="@PRODUCT_ID@", RUN+="@SBINDIR@/marsond" @@ -9,13 +9,25 @@ PROJ=marsond VERSION=0.3.0 +### Compile-time option. + +# If you change this, yse the full path. It changes the +# default for the -k option. +DEFAULT_KBD=/dev/input/by-id/usb-Marson_Marson_Keyboard_and_Mouse_Link_Ver:ps2120L-event-kbd + +# USB vendor and product IDs don't get baked into the binary, +# they only affect the udev rule. +VENDOR_ID=04b4 +PRODUCT_ID=0101 + ### Compiler and options. CC=gcc # CC=clang works, too COPT=-O2 CWARN=-Wall -CFLAGS=-std=c99 $(COPT) $(CWARN) -DVERSION='"$(VERSION)"' +CDEFS=-DVERSION='"$(VERSION)"' -D DEFAULT_KBD='"$(DEFAULT_KBD)"' +CFLAGS=-std=c99 $(COPT) $(CWARN) $(CDEFS) ### Install paths. Not compiled into the binary. @@ -53,13 +65,16 @@ $(PROJ).8: $(PROJ).rst rst2man $(PROJ).rst > $(PROJ).8 99-$(PROJ).rules: - sed 's,@SBINDIR@,$(SBINDIR),' < 99-$(PROJ).rules.in > 99-$(PROJ).rules + sed -e 's,@SBINDIR@,$(SBINDIR),' \ + -e 's,@VENDOR_ID@,$(VENDOR_ID),' \ + -e 's,@PRODUCT_ID@,$(PRODUCT_ID),' \ + < 99-$(PROJ).rules.in > 99-$(PROJ).rules clean: rm -f $(PROJ) core *.o realclean: clean - rm -f $(PROJ).8 usage.c + rm -f $(PROJ).8 usage.c 99-marsond.rules # this is a "private" target, not expected to work on random systems. # It specifically works on Slackware 15.0, if the system/musl package @@ -24,7 +24,9 @@ #define DEFAULT_DELAY_MS 30 +#ifndef DEFAULT_KBD #define DEFAULT_KBD "/dev/input/by-id/usb-Marson_Marson_Keyboard_and_Mouse_Link_Ver:ps2120L-event-kbd" +#endif #define DEFAULT_USER "nobody" #define DEFAULT_GROUP "nobody" |