From 1c4ae73518ae8032c83131b490eb5fb1f645701b Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Tue, 22 Dec 2020 15:54:29 +0100 Subject: [PATCH] Add package target --- CMakeLists.txt | 13 +++++++++++++ ReadMe.md | 3 +-- res/99-tuxedo-touchpad-switch.rules | 2 +- res/tuxedo-touchpad-switch.service | 10 ---------- tuxedo-touchpad-switch.cpp | 2 +- 5 files changed, 16 insertions(+), 14 deletions(-) delete mode 100644 res/tuxedo-touchpad-switch.service diff --git a/CMakeLists.txt b/CMakeLists.txt index 2407db2..5a396ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,3 +7,16 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET gio-2.0 udev) add_executable(tuxedo-touchpad-switch tuxedo-touchpad-switch.cpp) target_link_libraries(tuxedo-touchpad-switch udev PkgConfig::deps) + +install(TARGETS tuxedo-touchpad-switch DESTINATION bin/) +install(FILES res/99-tuxedo-touchpad-switch.rules DESTINATION lib/udev/rules.d/) +install(FILES res/tuxedo-touchpad-switch.desktop DESTINATION /etc/xdg/autostart/) # absolute path on purpose for this file only: + # $XDG_CONFIG_DIRS dos not include a folder under /usr/ by default + # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html#variables + +SET(CPACK_GENERATOR DEB RPM) +SET(CPACK_PACKAGE_CONTACT "Werner Sembach ") +SET(CPACK_PACKAGE_VERSION 0.0.1) +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hardware toggle for Tongfang/Uniwill i2c touchpads. This will toggle the touchpad-disabled-led.") +SET(CPACK_DEBIAN_PACKAGE_SECTION admin) +include(CPack) diff --git a/ReadMe.md b/ReadMe.md index 62903c4..512c6ae 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -6,8 +6,7 @@ It comes with some known disfuctionalities: - only works on desktop evnironments using gsettings/gio - does not work on loginscreen(gdm) - needs to be started for every user seperatly - - no script/package to setup autostart - - every user needs write access to the /dev/hidraw* device for the touchpad (udev *.rules giving read and write access included, could be trimmed down to write only) + - every user needs write access to the /dev/hidraw* device for the touchpad (udev *.rules included) - switching between 2 users is not detected (on next toggle the software and hardware disable will be in sync again however) Author: Werner Sembach diff --git a/res/99-tuxedo-touchpad-switch.rules b/res/99-tuxedo-touchpad-switch.rules index a19884c..48a6073 100644 --- a/res/99-tuxedo-touchpad-switch.rules +++ b/res/99-tuxedo-touchpad-switch.rules @@ -1 +1 @@ -KERNELS=="i2c-UNIW0001:00", SUBSYSTEMS=="i2c", DRIVERS=="i2c_hid", ATTRS{name}=="UNIW0001:00", SUBSYSTEM=="hidraw", MODE="0666" +KERNELS=="i2c-UNIW0001:00", SUBSYSTEMS=="i2c", DRIVERS=="i2c_hid", ATTRS{name}=="UNIW0001:00", SUBSYSTEM=="hidraw", MODE="0622" diff --git a/res/tuxedo-touchpad-switch.service b/res/tuxedo-touchpad-switch.service deleted file mode 100644 index 6143658..0000000 --- a/res/tuxedo-touchpad-switch.service +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=TUXEDO Touchpad Switch -After=gdm.service - -[Service] -User=gdm -ExecStart=/usr/bin/tuxedo-touchpad-switch - -[Install] -WantedBy=gdm.service diff --git a/tuxedo-touchpad-switch.cpp b/tuxedo-touchpad-switch.cpp index c599bf6..8f0b5cf 100644 --- a/tuxedo-touchpad-switch.cpp +++ b/tuxedo-touchpad-switch.cpp @@ -104,7 +104,7 @@ void send_events_handler(GSettings *settings, const char* key, __attribute__((un } for (auto it = devnodes.begin(); it != devnodes.end(); ++it) { - int hidraw = open((*it).c_str(), O_RDWR|O_NONBLOCK); + int hidraw = open((*it).c_str(), O_WRONLY|O_NONBLOCK); if (hidraw < 0) { cerr << "send_events_handler(...): open(\"" << *it << "\", O_RDWR|O_NONBLOCK) failed." << endl; continue;