Apply changes to code to support path; Add signal handling; Update README
This commit is contained in:
30
makefile
Normal file
30
makefile
Normal file
@ -0,0 +1,30 @@
|
||||
# see LICENSE file for copyright and license information.
|
||||
|
||||
NAME=mergeinputs
|
||||
LIBS = -lpthread
|
||||
SRC = ${NAME}.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
CFLAGS = -Os
|
||||
DESTDIR = /usr/local
|
||||
CC=gcc
|
||||
|
||||
.c.o:
|
||||
@echo CC $<
|
||||
@${CC} -c ${CFLAGS} ${LIBS} $<
|
||||
|
||||
${NAME}: ${OBJ}
|
||||
@echo CC -o $@
|
||||
@${CC} -o $@ ${OBJ} ${CFLAGS} ${LIBS}
|
||||
|
||||
clean:
|
||||
@echo cleaning
|
||||
@rm -f ${NAME} *.o
|
||||
|
||||
install: ${NAME}
|
||||
@echo installing executable file to ${DESTDIR}/bin
|
||||
@mkdir -p ${DESTDIR}/bin
|
||||
@cp -f ${NAME} ${DESTDIR}/bin/${NAME}
|
||||
@chmod 755 ${DESTDIR}/bin/${NAME}
|
||||
uninstall: ${NAME}
|
||||
@echo removing executable file from ${DESTDIR}/bin
|
||||
@rm -f ${DESTDIR}/bin/${NAME}
|
10
mergeinputs-restart.path
Normal file
10
mergeinputs-restart.path
Normal file
@ -0,0 +1,10 @@
|
||||
[Path]
|
||||
Unit=mergeinputs-restart.service
|
||||
PathChanged=/dev/input/by-path
|
||||
|
||||
[Unit]
|
||||
StartLimitIntervalSec=5
|
||||
StartLimitBurst=20
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
12
mergeinputs-restart.service
Normal file
12
mergeinputs-restart.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=mergeinputs restarter
|
||||
After=multi-user.target
|
||||
StartLimitIntervalSec=5
|
||||
StartLimitBurst=20
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/systemctl restart mergeinputs.service
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
190
mergeinputs.c
Normal file
190
mergeinputs.c
Normal file
File diff suppressed because one or more lines are too long
12
mergeinputs.service
Normal file
12
mergeinputs.service
Normal file
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Merge multiple keyboards into one input
|
||||
After=multi-user.target
|
||||
ConditionPathExistsGlob=/dev/input/by-path/*-kbd
|
||||
StartLimitIntervalSec=5
|
||||
StartLimitBurst=20
|
||||
|
||||
[Service]
|
||||
ExecStart=/bin/sh -c '/usr/local/bin/mergeinputs /dev/input/by-path/*-kbd'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Reference in New Issue
Block a user