aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile36
-rw-r--r--TODO3
-rw-r--r--marsond.c4
-rw-r--r--marsond.rst5
4 files changed, 27 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index d7420d2..06b7d5a 100644
--- a/Makefile
+++ b/Makefile
@@ -5,13 +5,17 @@
# make CC=clang CFLAGS=-O3
# make install PREFIX=/usr/local
+### Project information.
+PROJ=marsond
+VERSION=0.1
+
### Compiler and options.
CC=gcc
# CC=clang works, too
COPT=-O2
CWARN=-Wall
-CFLAGS=-std=c99 $(COPT) $(CWARN)
+CFLAGS=-std=c99 $(COPT) $(CWARN) -DVERSION='"$(VERSION)"'
### Install paths. Not compiled into the binary.
@@ -21,7 +25,7 @@ PREFIX=/usr
SBINDIR=$(PREFIX)/sbin
MANDIR=$(PREFIX)/man
MAN8DIR=$(PREFIX)/man8
-DOCDIR=/usr/doc/marsond-$(VERSION)
+DOCDIR=/usr/doc/$(PROJ)-$(VERSION)
UDEVDIR=/etc/udev/rules.d
INSTALL=install
@@ -37,29 +41,29 @@ GZIP=gzip -9
RULESUFFIX=
### No user-serviceable parts below (I hope).
-all: marsond marsond.1 99-marsond.rules
+all: $(PROJ) $(PROJ).1 99-$(PROJ).rules
-marsond: marsond.c usage.c
+$(PROJ): $(PROJ).c usage.c
-usage.c: mkusage.pl marsond.1
- perl mkusage.pl marsond.rst > usage.c
+usage.c: mkusage.pl $(PROJ).1
+ perl mkusage.pl $(PROJ).rst > usage.c
-marsond.1: marsond.rst
- rst2man marsond.rst > marsond.1
+$(PROJ).1: $(PROJ).rst
+ rst2man $(PROJ).rst > $(PROJ).1
-99-marsond.rules:
- sed 's,@SBINDIR@,$(SBINDIR),' < 99-marsond.rules.in > 99-marsond.rules
+99-$(PROJ).rules:
+ sed 's,@SBINDIR@,$(SBINDIR),' < 99-$(PROJ).rules.in > 99-$(PROJ).rules
clean:
- rm -f marsond core *.o
+ rm -f $(PROJ) core *.o
realclean: clean
- rm -f marsond.1 usage.c
+ rm -f $(PROJ).1 usage.c
install: all
mkdir -p $(DESTDIR)/$(SBINDIR) $(DESTDIR)/$(MAN8DIR) $(DESTDIR)/$(UDEVDIR) $(DESTDIR)/$(DOCDIR)
- $(INSTALL_BIN) marsond $(DESTDIR)/$(SBINDIR)
- $(INSTALL_MAN) marsond.1 $(DESTDIR)/$(MAN8DIR)
- $(GZIP) $(DESTDIR)/$(MAN8DIR)/marsond.1 || true
- $(INSTALL_UDEV) 99-marsond.rules $(DESTDIR)/$(UDEVDIR)$(RULESUFFIX)
+ $(INSTALL_BIN) $(PROJ) $(DESTDIR)/$(SBINDIR)
+ $(INSTALL_MAN) $(PROJ).1 $(DESTDIR)/$(MAN8DIR)
+ $(GZIP) $(DESTDIR)/$(MAN8DIR)/$(PROJ).1 || true
+ $(INSTALL_UDEV) 99-$(PROJ).rules $(DESTDIR)/$(UDEVDIR)$(RULESUFFIX)
$(INSTALL_DOC) README TODO LICENSE $(DESTDIR)/$(DOCDIR)
diff --git a/TODO b/TODO
index 2d1f969..bb32e1d 100644
--- a/TODO
+++ b/TODO
@@ -3,10 +3,7 @@
after detaching from the tty.
- print our /dev/input/event* node name, if possible.
- options to set the virtual device name and vendor/product IDs.
-- much as I hate systemd, get someone to write a systemd unit.
-- s6 and/or openrc init scripts?
- possibly use a UNIX socket. if we can connect to it on startup,
that means another instance is already running... so either exit
or pass a command to it (like "marsond -K" would kill an existing
instance).
-- 'make install' should install README and TODO.
diff --git a/marsond.c b/marsond.c
index e74128e..9419105 100644
--- a/marsond.c
+++ b/marsond.c
@@ -17,7 +17,9 @@
#include <linux/input.h>
#include <linux/uinput.h>
-#define VERSION "0.0.1"
+#ifndef VERSION
+#define VERSION "(unknown ver)"
+#endif
#define DEFAULT_DELAY_MS 30
diff --git a/marsond.rst b/marsond.rst
index 8b798c3..b25b464 100644
--- a/marsond.rst
+++ b/marsond.rst
@@ -48,7 +48,7 @@ please contact me so I can add the model number to this man page.
**marsond** uses the Linux kernel's **uinput** layer to "grab" the
keyboard, create a new virtual keyboard device, and pass events from
-the real keyboard to the virtual one. When it see the key release
+the real keyboard to the virtual one. When it sees the key release
event for the Enter key, it simply pauses for a few milliseconds
before delivering it.
@@ -62,6 +62,9 @@ and creating the virtual keyboard device, it will drop
privileges and run as the *nobody* user by default (but
see **ENVIRONMENT** if you need a different user).
+While **marsond** is running, "xinput --list" will show an input
+device called "marson virtual keyboard".
+
OPTIONS
=======