From 3cd8c0a0f67acdf03fc93b6a4c90075d6d696f88 Mon Sep 17 00:00:00 2001 From: "P.M. Kuipers" Date: Sat, 14 Jan 2023 15:49:42 +0100 Subject: [PATCH] Updates for ne version of boost and using python3 --- debian/compat | 1 + debpackager.py | 6 +++--- debpackager.sh | 2 +- lib/systemd/system/mediacore-hid.service | 12 ++++++++++++ src/mc-hid-server.cpp | 14 +++++++++----- 5 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 debian/compat create mode 100644 lib/systemd/system/mediacore-hid.service diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..9d60796 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 \ No newline at end of file diff --git a/debpackager.py b/debpackager.py index 3ce0c0a..cf2dd87 100644 --- a/debpackager.py +++ b/debpackager.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os,sys import glob @@ -41,9 +41,9 @@ shutil.move(TARBALLNAME , os.path.join(DEBBUILDDIR,DEBSOURCEPKG)) os.chdir(DEBBUILDDIR) call(["tar","-xzvf",DEBSOURCEPKG]) -print "Entering dir " + PKGDIR +print("Entering dir " + PKGDIR) os.chdir(PKGDIR) -print "Now in ", os.getcwd() +print("Now in ", os.getcwd()) call(["dh_make --single --yes --copyright lgpl"],shell=True) for f in glob.glob(os.path.join(CWD,"debian","*")): diff --git a/debpackager.sh b/debpackager.sh index 39480d8..3605ef6 100755 --- a/debpackager.sh +++ b/debpackager.sh @@ -3,5 +3,5 @@ rm -r deb_dist rm version.py make version.py -python debpackager.py +python3 debpackager.py diff --git a/lib/systemd/system/mediacore-hid.service b/lib/systemd/system/mediacore-hid.service new file mode 100644 index 0000000..7c06f77 --- /dev/null +++ b/lib/systemd/system/mediacore-hid.service @@ -0,0 +1,12 @@ +[Unit] +Description=Mediacore HID interface server +After=dbus.service + + +[Service] +Type=dbus +ExecStart=/usr/local/sbin/$NAME +BusName=nl.miqra.MediaCore.Hid + +[Install] +WantedBy=multi-user.target diff --git a/src/mc-hid-server.cpp b/src/mc-hid-server.cpp index 329c90e..1a6de15 100644 --- a/src/mc-hid-server.cpp +++ b/src/mc-hid-server.cpp @@ -83,9 +83,11 @@ HidServer::HidServer(DBus::Connection &connection) // Initialize button timer btnTimer = new ButtonTimer(70,5000); // 70 ms debounce time, and a Long press takes 5 seconds - onShortPressConnection = this->btnTimer->onShortPress.connect( boost::bind( &HidServer::onShortPress, this, _1) ); - onLongPressConnection = this->btnTimer->onLongPress.connect( boost::bind( &HidServer::onLongPress, this, _1) ); - //onValidatePressConnection = this->btnTimer->onValidatePress.connect( boost::bind( &HidServer::onValidatePress, this, _1) ); +// onShortPressConnection = this->btnTimer->onShortPress.connect( boost::bind( &HidServer::onShortPress, this, placeholders::_1) ); +// onLongPressConnection = this->btnTimer->onLongPress.connect( boost::bind( &HidServer::onLongPress, this, placeholders::_1) ); + onShortPressConnection = this->btnTimer->onShortPress.connect( [&](uint8_t gpio){ this->onShortPress(gpio); } ); + onLongPressConnection = this->btnTimer->onLongPress.connect( [&](uint8_t gpio){ this->onLongPress(gpio); } ); + //onValidatePressConnection = this->btnTimer->onValidatePress.connect( boost::bind( &HidServer::onValidatePress, this, placeholders::_1) ); // **** Initialize the GPIO Interrupt pin @@ -99,7 +101,8 @@ HidServer::HidServer(DBus::Connection &connection) clog << kLogInfo << "Connecting to Home button"; this->btHome = new GpioPin(BTN_HOME); clog << kLogInfo << "."; - onBtHomeConnection = this->btHome->onChange.connect( boost::bind( &HidServer::onBtChange, this, _1, _2, _3) ); +// onBtHomeConnection = this->btHome->onChange.connect( boost::bind( &HidServer::onBtChange, this, placeholders::_1, placeholders::_2, placeholders::_3) ); + onBtHomeConnection = this->btHome->onChange.connect( [&](uint8_t gpio, GpioEdge edge, bool level) {this->onBtChange(gpio,edge,level); }); clog << kLogInfo << "."; this->btHome->Listen(GpioEdge::Both, GpioPullup::PullUp, false); clog << kLogInfo << "." << endl; @@ -108,7 +111,8 @@ HidServer::HidServer(DBus::Connection &connection) clog << kLogInfo << "Connecting to other buttons"; this->btOther = new GpioPins(BUTTONS_REGULAR); clog << kLogInfo << "."; - onBtOtherConnection = this->btOther->onChange.connect( boost::bind( &HidServer::onBtChange, this, _1, _2, _3) ); +// onBtOtherConnection = this->btOther->onChange.connect( boost::bind( &HidServer::onBtChange, this, placeholders::_1, placeholders::_2, placeholders::_3) ); + onBtOtherConnection = this->btOther->onChange.connect( [&](uint8_t gpio, GpioEdge edge, bool level){ this->onBtChange(gpio,edge,level); } ); clog << kLogInfo << "."; this->btOther->Listen(GpioEdge::Both, GpioPullup::PullUp, true); clog << kLogInfo << "." << endl;