-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
134 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(footswitch-cli C) | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build) | ||
set(SRCDIR src) | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(HIDAPI REQUIRED hidapi-libusb) | ||
|
||
include_directories(${HIDAPI_INCLUDE_DIRS} include) | ||
link_libraries(${HIDAPI_LIBRARIES}) | ||
link_directories(src) | ||
|
||
foreach(exe IN ITEMS footswitch scythe scythe2) | ||
add_executable(${exe}-cli | ||
${SRCDIR}/common.c | ||
${SRCDIR}/debug.c | ||
${SRCDIR}/${exe}.c | ||
) | ||
|
||
install(TARGETS ${exe}-cli | ||
RUNTIME DESTINATION bin | ||
) | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM debian:bookworm | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get update && \ | ||
apt-get install -y devscripts equivs | ||
|
||
COPY . /build | ||
WORKDIR /build | ||
RUN mk-build-deps -i -t 'apt-get -y --no-install-recommends' && \ | ||
dpkg-buildpackage -us -uc -b |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,63 @@ | ||
PREFIX = /usr/local | ||
UDEVPREFIX = /etc/udev | ||
PREFIX := /usr/local | ||
UDEVPREFIX := /etc/udev | ||
|
||
TARGETS := \ | ||
footswitch \ | ||
scythe \ | ||
scythe2 | ||
|
||
INCDIR := include | ||
SRCDIR := src | ||
OBJDIR := obj | ||
|
||
COMMONSRC := \ | ||
common.c \ | ||
debug.c | ||
|
||
INSTALL := /usr/bin/install -c | ||
INSTALLDATA := /usr/bin/install -c -m 644 | ||
CFLAGS := -Wall -I$(INCDIR) | ||
UNAME := $(shell uname) | ||
|
||
INSTALL = /usr/bin/install -c | ||
INSTALLDATA = /usr/bin/install -c -m 644 | ||
CFLAGS = -Wall | ||
UNAME := $(shell uname) | ||
ifeq ($(UNAME), Darwin) | ||
CFLAGS += -DOSX $(shell pkg-config --cflags hidapi) | ||
LDLIBS = $(shell pkg-config --libs hidapi) | ||
CFLAGS += -DOSX $(shell pkg-config --cflags hidapi) | ||
LDLIBS := $(shell pkg-config --libs hidapi) | ||
else | ||
ifeq ($(UNAME), Linux) | ||
CFLAGS += $(shell pkg-config --cflags hidapi-libusb) | ||
LDLIBS = $(shell pkg-config --libs hidapi-libusb) | ||
CFLAGS += $(shell pkg-config --cflags hidapi-libusb) | ||
LDLIBS := $(shell pkg-config --libs hidapi-libusb) | ||
else | ||
LDLIBS = -lhidapi | ||
LDLIBS := -lhidapi | ||
endif | ||
endif | ||
|
||
all: footswitch scythe scythe2 | ||
all: $(OBJDIR) $(TARGETS) | ||
|
||
$(OBJDIR): | ||
mkdir $@ | ||
|
||
$(OBJDIR)/%.o: $(SRCDIR)/%.c | ||
$(CC) $(CFLAGS) -c -o $@ $< | ||
|
||
footswitch: footswitch.c common.c debug.c | ||
scythe: scythe.c common.c debug.c | ||
scythe2: scythe2.c common.c debug.c | ||
$(TARGETS): %: $(patsubst %.c, $(OBJDIR)/%.o, $(COMMONSRC)) $(OBJDIR)/%.o | ||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS) | ||
|
||
install: all | ||
$(INSTALL) -d $(DESTDIR)$(PREFIX)/bin | ||
$(INSTALL) footswitch $(DESTDIR)$(PREFIX)/bin | ||
$(INSTALL) scythe $(DESTDIR)$(PREFIX)/bin | ||
$(INSTALL) scythe2 $(DESTDIR)$(PREFIX)/bin | ||
for target in $(TARGETS); do \ | ||
$(INSTALL) "$$target" $(DESTDIR)$(PREFIX)/bin; \ | ||
done | ||
ifeq ($(UNAME), Linux) | ||
$(INSTALL) -d $(DESTDIR)$(UDEVPREFIX)/rules.d | ||
$(INSTALLDATA) 19-footswitch.rules $(DESTDIR)$(UDEVPREFIX)/rules.d | ||
endif | ||
|
||
uninstall: | ||
rm -f $(DESTDIR)$(PREFIX)/bin/footswitch | ||
rm -f $(DESTDIR)$(PREFIX)/bin/scythe | ||
rm -f $(DESTDIR)$(PREFIX)/bin/scythe2 | ||
rm -f $(addprefix $(DESTDIR)$(PREFIX)/bin/, $(TARGETS)) | ||
ifeq ($(UNAME), Linux) | ||
rm -f $(DESTDIR)$(UDEVPREFIX)/rules.d/19-footswitch.rules | ||
endif | ||
|
||
clean: | ||
rm -f scythe scythe2 footswitch *.o | ||
rm -rf $(TARGETS) $(OBJDIR) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
footswitch-cli (1.0.0) stable; urgency=medium | ||
|
||
* Initial release. | ||
|
||
-- drlkf <drlkf@drlkf.net> Thu, 16 May 2024 19:27:47 +0200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
11 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Source: footswitch-cli | ||
Section: utils | ||
Priority: optional | ||
Maintainer: Radoslav Gerganov <rgerganov@gmail.com> | ||
Build-Depends: | ||
cmake, | ||
libhidapi-dev, | ||
pkg-config | ||
|
||
Package: footswitch-cli | ||
Description: Command-line tools to configure PCsensor and Scythe foot switches. | ||
Architecture: any | ||
Depends: | ||
libhidapi-libusb0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# PCsensor | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7403", MODE="0666" | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0c45", ATTRS{idProduct}=="7404", MODE="0666" | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="413d", ATTRS{idProduct}=="2107", MODE="0666" | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="e026", MODE="0666" | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="3553", ATTRS{idProduct}=="b001", MODE="0666" | ||
|
||
# Scythe | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0426", ATTRS{idProduct}=="3011", MODE="0666" | ||
|
||
# Scythe2 | ||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="055a", ATTRS{idProduct}=="0998", MODE="0666" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/make -f | ||
|
||
%: | ||
dh $@ --buildsystem=cmake |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.