Skip to contentSkip to conversation

package/gpiod: add gpiod hardware handling daemon

PATCH New mchalain 3 participants 7 messages Jun 16, 2020 – Jun 20, 2020

lore
Share & tools
lore

mchalain

author
#0 lore raw

PATCH 1/1 package/gpiod: add gpiod hardware handling daemon

Gpiod is a little daemon to trig gpio event and launch scripts on level changing events.
As udev or mdev, it reads rules files to attach scripts on events. and launch the scripts with environment variables to describe the event. It uses libgpiod to monitor the gpio and libconfig to read the rules. It is tested on Raspberry Pi (0,3,4) with success, during few months.

---
 package/Config.in             |  1 +
 package/gpiod/Config.in       | 14 ++++++++++
 package/gpiod/S20gpiod        | 41 +++++++++++++++++++++++++++
 package/gpiod/gpiod.hash      |  1 +
 package/gpiod/gpiod.mk        | 52 +++++++++++++++++++++++++++++++++++
 package/gpiod/gpiod_defconfig |  0
 6 files changed, 109 insertions(+)
 create mode 100644 package/gpiod/Config.in
 create mode 100755 package/gpiod/S20gpiod
 create mode 100644 package/gpiod/gpiod.hash
 create mode 100644 package/gpiod/gpiod.mk
 create mode 100644 package/gpiod/gpiod_defconfig
package/Config.in +1 -0
index d32eadab88..d529442fe7 100644
@@ -457,6 +457,7 @@ endmenu
 	source "package/freescale-imx/Config.in"
 	source "package/fxload/Config.in"
 	source "package/gcnano-binaries/Config.in"
+	source "package/gpiod/Config.in"
 	source "package/gpm/Config.in"
 	source "package/gpsd/Config.in"
 	source "package/gptfdisk/Config.in"
package/gpiod/Config.in new file +14 -0
new file mode 100644
index 0000000000..e9d5dc47f9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_GPIOD
+	bool "gpiod: gpio monitor daemon"
+	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8
+	select BR2_PACKAGE_LIBGPIOD
+	select BR2_PACKAGE_LIBCONFIG
+	help
+	  GPIOD monitors gpio events and start scripts.
+	  The daemon loads rules defining a gpio and
+	  the scripts to launch when the level of gpio changes.
+
+comment "gpiod: needs a toolchain w/ support of MMU and headers > 4.8"
+	depends on !BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8
package/gpiod/S20gpiod new file +41 -0

41 lines not on this page · raw message

package/gpiod/gpiod.hash new file +1 -0
new file mode 100644
index 0000000000..4a9c10297c
@@ -0,0 +1 @@
+sha256 f7c12fafcfb02515ae34d9502b4121d7980606fb53b57bee35143bd985bfdddc  gpiod-1.0.tar.gz
package/gpiod/gpiod.mk new file +52 -0

52 lines not on this page · raw message

package/gpiod/gpiod_defconfig new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 package/gpiod: add gpiod hardware handling daemon

Quoted 8 lines · On Tue, 16 Jun 2020 18:42:00 +0200 mchalain <[email protected]> wrote:

Gpiod is a little daemon to trig gpio event and launch scripts on level changing events.
As udev or mdev, it reads rules files to attach scripts on events. and launch the scripts with environment variables to describe the event. It uses libgpiod to monitor the gpio and libconfig to read the rules. It is tested on Raspberry Pi (0,3,4) with success, during few months.

Thanks a lot for your contribution. I have not reviewed it carefully. However, while it looks potentially interesting, I am personally always a bit concerned in packaging software components that look like "personal projects". This project has only been written by you, there are no contributions from others, no stars, no fork on Github, nothing indicates that anyone but you is using gpiod.

So I am wondering if it is not too early to have that in Buildroot. On the other hand, you could certainly say that having it in Buildroot would give it some exposure that might encourage some users to try it out.

Anyway, we will need your Signed-off-by to use your full first name and last name, properly capitalized.

package/gpiod/Config.in line 4

Quoted 10 lines
package/gpiod/Config.in new file +4 -0
new file mode 100644
index 0000000000..e9d5dc47f9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_GPIOD
+	bool "gpiod: gpio monitor daemon"
+	depends on BR2_USE_MMU
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8

This needs a comment:

depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 # libgpiod

package/gpiod/Config.in line 14

Quoted 10 lines
package/gpiod/Config.in new file +10 -0
+	select BR2_PACKAGE_LIBGPIOD
+	select BR2_PACKAGE_LIBCONFIG
+	help
+	  GPIOD monitors gpio events and start scripts.
+	  The daemon loads rules defining a gpio and
+	  the scripts to launch when the level of gpio changes.
+
+comment "gpiod: needs a toolchain w/ support of MMU and headers > 4.8"
+	depends on !BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8

No, this should be:

comment "gpiod needs a toolchain w/ kernel headers >= 4.8"
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8

Quoted 4 lines
package/gpiod/Config.in new file +4 -0
+RUNDIR=/var/run
+SBINDIR=/usr/sbin
+BINDIR=/usr/bin
+

package/gpiod/Config.in

Quoted 10 lines
package/gpiod/Config.in new file +10 -0
+start() {
+	printf "Starting gpiod: "
+	start-stop-daemon -S -q --exec ${SBINDIR}/gpiod -- -D -p ${RUNDIR}/gpiod.pid
+	[ $? == 0 ] && echo "OK" || echo "FAILED"
+}
+stop() {
+	printf "Stopping gpiod: "
+	${SBINDIR}/gpiod -K -p ${RUNDIR}/gpiod.pid
+	echo "OK"
+}

Please follow the template package/busybox/S01syslogd for your init script.

package/gpiod/gpiod.hash line 1

Quoted 7 lines
package/gpiod/gpiod.hash new file +1 -0
new file mode 100644
index 0000000000..4a9c10297c
@@ -0,0 +1 @@
+sha256 f7c12fafcfb02515ae34d9502b4121d7980606fb53b57bee35143bd985bfdddc  gpiod-1.0.tar.gz

We need a hash for the license file.

Quoted 6 lines
package/gpiod/gpiod.mk new file +0 -0
new file mode 100644
index 0000000000..ed99f1d3be

package/gpiod/gpiod.mk line 8

Quoted 8 lines
package/gpiod/gpiod.mk new file +8 -0
@@ -0,0 +1,52 @@
+################################################################################
+#
+# gpiod
+#
+################################################################################
+
+GPIOD_VERSION = 1.0
+GPIOD_SITE = $(call github,mchalain,gpiod,$(GPIOD_VERSION))

We need GPIOD_LICENSE and GPIOD_LICENSE_FILES.

package/gpiod/gpiod.mk line 11

Quoted 2 lines
package/gpiod/gpiod.mk new file +2 -0
+GPIOD_MAKE_OPTS+=prefix=/usr
+GPIOD_MAKE_OPTS+=sysconfdir=/etc/gpiod

Just one assignment, and unconditional:

GPIOD_MAKE_OPTS = \
	prefix=/usr \
	sysconfdir=/etc/gpiod

package/gpiod/gpiod.mk line 12

Quoted 1 line
package/gpiod/gpiod.mk new file +1 -0
+#GPIOD_MAKE_OPTS+=DEBUG=y

Drop comments please.

package/gpiod/gpiod.mk line 19

Quoted 7 lines
package/gpiod/gpiod.mk new file +7 -0
+
+GPIOD_KCONFIG_FILE=$(GPIOD_PKGDIR)/gpiod_defconfig
+GPIOD_KCONFIG_EDITORS = config
+GPIOD_KCONFIG_OPTS = $(GPIOD_MAKE_OPTS)
+
+GPIOD_DEPENDENCIES += libgpiod
+GPIOD_DEPENDENCIES += libconfig

One line for dependencies, and unconditional:

GPIOD_DEPENDENCIES = libgpiod libconfig

Quoted 5 lines
package/gpiod/gpiod.mk new file +5 -0
+define GPIOD_LIBCONFIG_OPTS
+	$(call KCONFIG_ENABLE_OPT,LIBCONFIG,$(@D)/.config)
+endef
+
+define GPIOD_KCONFIG_FIXUP_CMDS

package/gpiod/gpiod.mk line 35

Quoted 10 lines
package/gpiod/gpiod.mk new file +10 -0
+	$(GPIOD_LIBCONFIG_OPTS)
+endef
+
+define GPIOD_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) \
+		$(MAKE1) -C $(@D) $(GPIOD_MAKE_OPTS)
+endef
+
+define GPIOD_INSTALL_TARGET_CMDS
+	$(INSTALL) -d -m 755 $(TARGET_DIR)/etc/gpiod/rules.d

Why do you need this ?

package/gpiod/gpiod.mk line 37

Quoted 2 lines
package/gpiod/gpiod.mk new file +2 -0
+	$(MAKE) -C $(@D) $(GPIOD_MAKE_OPTS) \
+		DESTDIR="$(TARGET_DIR)" DEVINSTALL=n install

I don't think you need DEVINSTALL=n here

package/gpiod/gpiod.mk line 42

Quoted 5 lines
package/gpiod/gpiod.mk new file +5 -0
+endef
+
+define GPIOD_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 644 $(GPIOD_PKGDIR)/gpiod.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/gpiod.service

This is OK. Perhaps use $(@D) instead of $(GPIOD_PKGDIR)

However, the service file was missing in your patch.

package/gpiod/gpiod.mk line 45

Quoted 3 lines
package/gpiod/gpiod.mk new file +3 -0
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+	ln -fs ../../../../usr/lib/systemd/system/gpiod.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/gpiod.service

These two commands are not needed, systemd preset-all is going to take care of this.

package/gpiod/gpiod.mk line 52

Quoted 7 lines
package/gpiod/gpiod.mk new file +7 -0
+endef
+define GPIOD_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 $(GPIOD_PKGDIR)/S20gpiod \
+		$(TARGET_DIR)/etc/init.d/S20gpiod
+endef
+
+$(eval $(kconfig-package))

I'm a bit skeptical on the usage of kconfig-package here. You are *not* using kconfig at all. You have a makefile that emulates some of the kconfig behavior, but you're not using kconfig. So if we later change how kconfig-package behave, to use some kconfig functionality that you do not emulate, things will no longer work for the gpiod package.

package/gpiod/gpiod_defconfig

Quoted 3 lines
package/gpiod/gpiod_defconfig new file +0 -0
new file mode 100644
index 0000000000..e69de29bb2

So it's just empty ?

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/gpiod: add gpiod hardware handling daemon

Hello,
Before to send a new patch I have some questions:

Le mer. 17 juin 2020 ? 22:38, Thomas Petazzoni <[email protected]> a ?crit :

Quoted 12 lines
Quoted 8 lines · On Tue, 16 Jun 2020 18:42:00 +0200 mchalain <[email protected]> wrote:

Gpiod is a little daemon to trig gpio event and launch scripts on level changing events.
As udev or mdev, it reads rules files to attach scripts on events. and launch the scripts with environment variables to describe the event. It uses libgpiod to monitor the gpio and libconfig to read the rules. It is tested on Raspberry Pi (0,3,4) with success, during few months.

Quoted 8 lines

Thanks a lot for your contribution. I have not reviewed it carefully. However, while it looks potentially interesting, I am personally always a bit concerned in packaging software components that look like "personal projects". This project has only been written by you, there are no contributions from others, no stars, no fork on Github, nothing indicates that anyone but you is using gpiod.

This project comes from a professional project. I didn't find any tool

to launch an application on a switch event. I thought that is stupid to write
code in the application only for that, when there isn't time mandatory. This is a personal project, but I hope to reuse it in the future.

So I am wondering if it is not too early to have that in Buildroot. On

Quoted 21 lines

the other hand, you could certainly say that having it in Buildroot would give it some exposure that might encourage some users to try it out.

Anyway, we will need your Signed-off-by to use your full first name and last name, properly capitalized.

package/gpiod/Config.in line 4

Quoted 10 lines
package/gpiod/Config.in new file +4 -0
new file mode 100644
index 0000000000..e9d5dc47f9
@@ -0,0 +1,14 @@
+config BR2_PACKAGE_GPIOD
+     bool "gpiod: gpio monitor daemon"
+     depends on BR2_USE_MMU
+     depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8

This needs a comment:

Quoted 2 lines

depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8 # libgpiod

OK done

Quoted 13 lines

package/gpiod/Config.in line 14

Quoted 10 lines
package/gpiod/Config.in new file +10 -0
+     select BR2_PACKAGE_LIBGPIOD
+     select BR2_PACKAGE_LIBCONFIG
+     help
+       GPIOD monitors gpio events and start scripts.
+       The daemon loads rules defining a gpio and
+       the scripts to launch when the level of gpio changes.
+
+comment "gpiod: needs a toolchain w/ support of MMU and headers > 4.8"
+     depends on !BR2_USE_MMU
+     depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8

No, this should be:

Quoted 5 lines

comment "gpiod needs a toolchain w/ kernel headers >= 4.8"
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_8

Are you sure for "depends on BR2_USE_MMU" and not "depends on

!BR2_USE_MMU" ?

Quoted 104 lines

+RUNDIR=/var/run

package/gpiod/Config.in

Quoted 6 lines
package/gpiod/Config.in new file +6 -0
+SBINDIR=/usr/sbin
+BINDIR=/usr/bin
+
+start() {
+     printf "Starting gpiod: "
+     start-stop-daemon -S -q --exec ${SBINDIR}/gpiod -- -D -p

${RUNDIR}/gpiod.pid

package/gpiod/Config.in

Quoted 7 lines
package/gpiod/Config.in new file +7 -0
+     [ $? == 0 ] && echo "OK" || echo "FAILED"
+}
+stop() {
+     printf "Stopping gpiod: "
+     ${SBINDIR}/gpiod -K -p ${RUNDIR}/gpiod.pid
+     echo "OK"
+}

Please follow the template package/busybox/S01syslogd for your init script.

OK done

package/gpiod/gpiod.hash line 1

Quoted 7 lines
package/gpiod/gpiod.hash new file +1 -0
new file mode 100644
index 0000000000..4a9c10297c
@@ -0,0 +1 @@
+sha256

f7c12fafcfb02515ae34d9502b4121d7980606fb53b57bee35143bd985bfdddc gpiod-1.0.tar.gz

We need a hash for the license file.

OK done

package/gpiod/gpiod.mk +0 -0

package/gpiod/gpiod.mk

Quoted 6 lines

new file mode 100644
index 0000000000..ed99f1d3be

package/gpiod/gpiod.mk new file +0 -0
@@ -0,0 +1,52 @@

+################################################################################

package/gpiod/gpiod.mk line 4

Quoted 4 lines
package/gpiod/gpiod.mk new file +3 -0
+#
+# gpiod
+#

+################################################################################

package/gpiod/gpiod.mk line 8

Quoted 3 lines
package/gpiod/gpiod.mk new file +3 -0
+
+GPIOD_VERSION = 1.0
+GPIOD_SITE = $(call github,mchalain,gpiod,$(GPIOD_VERSION))

We need GPIOD_LICENSE and GPIOD_LICENSE_FILES.

OK done

+GPIOD_MAKE_OPTS+=prefix=/usr

package/gpiod/gpiod.mk line 11

Quoted 1 line
package/gpiod/gpiod.mk new file +1 -0
+GPIOD_MAKE_OPTS+=sysconfdir=/etc/gpiod

Just one assignment, and unconditional:

GPIOD_MAKE_OPTS = \
        prefix=/usr \
        sysconfdir=/etc/gpiod

package/gpiod/gpiod.mk line 12

Quoted 1 line
package/gpiod/gpiod.mk new file +1 -0
+#GPIOD_MAKE_OPTS+=DEBUG=y

Drop comments please.

OK done

package/gpiod/gpiod.mk line 19

Quoted 7 lines
package/gpiod/gpiod.mk new file +7 -0
+
+GPIOD_KCONFIG_FILE=$(GPIOD_PKGDIR)/gpiod_defconfig
+GPIOD_KCONFIG_EDITORS = config
+GPIOD_KCONFIG_OPTS = $(GPIOD_MAKE_OPTS)
+
+GPIOD_DEPENDENCIES += libgpiod
+GPIOD_DEPENDENCIES += libconfig

One line for dependencies, and unconditional:

GPIOD_DEPENDENCIES = libgpiod libconfig

OK done

Quoted 5 lines
package/gpiod/gpiod.mk new file +5 -0
+define GPIOD_LIBCONFIG_OPTS
+     $(call KCONFIG_ENABLE_OPT,LIBCONFIG,$(@D)/.config)
+endef
+
+define GPIOD_KCONFIG_FIXUP_CMDS

package/gpiod/gpiod.mk line 35

Quoted 10 lines
package/gpiod/gpiod.mk new file +10 -0
+     $(GPIOD_LIBCONFIG_OPTS)
+endef
+
+define GPIOD_BUILD_CMDS
+     $(TARGET_CONFIGURE_OPTS) $(TARGET_MAKE_ENV) \
+             $(MAKE1) -C $(@D) $(GPIOD_MAKE_OPTS)
+endef
+
+define GPIOD_INSTALL_TARGET_CMDS
+     $(INSTALL) -d -m 755 $(TARGET_DIR)/etc/gpiod/rules.d

Why do you need this ?

Quoted 1 line

For the same reason as the gpiod_defconfig is empty. LIBCONFIG is the only

option of gpiod.
In a future version, I would like to remove the dependencies to libconfig, and I prepared that here.
I will remove the configuration in the makefile, and add the entry in the configuration file.

Quoted 6 lines

+ $(MAKE) -C $(@D) $(GPIOD_MAKE_OPTS) \

package/gpiod/gpiod.mk line 37

Quoted 1 line
package/gpiod/gpiod.mk new file +1 -0
+             DESTDIR="$(TARGET_DIR)" DEVINSTALL=n install

I don't think you need DEVINSTALL=n here

Yes, it's right. This option disallows the headers files, but there aren't

headers files.

Quoted 36 lines

+endef

package/gpiod/gpiod.mk line 42

Quoted 4 lines
package/gpiod/gpiod.mk new file +4 -0
+
+define GPIOD_INSTALL_INIT_SYSTEMD
+     $(INSTALL) -D -m 644 $(GPIOD_PKGDIR)/gpiod.service \
+             $(TARGET_DIR)/usr/lib/systemd/system/gpiod.service

This is OK. Perhaps use $(@D) instead of $(GPIOD_PKGDIR)

However, the service file was missing in your patch.

OK done

package/gpiod/gpiod.mk line 51

Quoted 3 lines
package/gpiod/gpiod.mk new file +3 -0
+     mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
+     ln -fs ../../../../usr/lib/systemd/system/gpiod.service \
+

$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/gpiod.service

These two commands are not needed, systemd preset-all is going to take care of this.

OK thank, I remembered to need that, a few years ago.

+endef

package/gpiod/gpiod.mk line 52

Quoted 6 lines
package/gpiod/gpiod.mk new file +6 -0
+define GPIOD_INSTALL_INIT_SYSV
+     $(INSTALL) -D -m 755 $(GPIOD_PKGDIR)/S20gpiod \
+             $(TARGET_DIR)/etc/init.d/S20gpiod
+endef
+
+$(eval $(kconfig-package))

I'm a bit skeptical on the usage of kconfig-package here. You are *not* using kconfig at all. You have a makefile that emulates some of the kconfig behavior, but you're not using kconfig. So if we later change how kconfig-package behave, to use some kconfig functionality that you do not emulate, things will no longer work for the gpiod package.

Quoted 1 line

Big question... I can use CONFIGURE_CMDS, but if the kconfig system from

the
kernel changes, what will you do ?
The version compatibility of each build system is a debate in development community
for many years,
I remember of many discussions about the version of autotools and m4, the discussions
about the best usage between to load all makefiles only once or to run each one by one.
And I don't speak about the trolls about the best tools "autotools more stable
"scons easer with python" "cmake the greatest", some people add another wrapper
arount cmake.
I prefer to use only Makefile, it's proof, flexible and it does a good job. I'm sure that
in 10 or 20 years, some body will be able to write and correct a Makefile. After I can write a CONFIGURE_CMDS to do the same as kconfig-package but it's less flexible to change the options (yes the only one option of the application ;)
Tell me your preference.

Quoted 6 lines
package/gpiod/gpiod_defconfig +0 -0
Quoted 2 lines

new file mode 100644
index 0000000000..e69de29bb2

So it's just empty ?

Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200619/ae3c4475/attachment.html>

#3 lore raw

PATCH 1/1 package/gpiod: add gpiod hardware handling daemon

Hei hei,

Quoted 7 lines · Marc Chalain
Quoted 7 lines

Thanks a lot for your contribution. I have not reviewed it carefully. However, while it looks potentially interesting, I am personally always a bit concerned in packaging software components that look like "personal projects". This project has only been written by you, there are no contributions from others, no stars, no fork on Github, nothing indicates that anyone but you is using gpiod.

Quoted 5 lines
Quoted 1 line

This project comes from a professional project. I didn't find any tool

to launch an application on a switch event. I thought that is stupid to write
code in the application only for that, when there isn't time mandatory. This is a personal project, but I hope to reuse it in the future.

I had a similar problem last year. There's triggerhappy which I first noticed on raspbian, but that was already too heavy and did not fullfill my needs (pressing a button for five seconds and acting after that).

I know OpenWrt has something similar, but I found it was embedded to deep in their code to just use that part and they stripped out all that evdev stuff from kernel and userspace (probably to shrink size).

However, I defined my button in dts as key, not just as gpio, because it is actually a key and linux has infrastructure for that. Furthermore there are reliable userspace libraries to not reinvent the wheel. I was able to build something around libevdev in two days.

Besides: your gpiod uses the well known libgpiod, but is not part of that project, right? That is a little puzzling, people will mix that up.

Greets
Alex

Signature · 11 lines
/"\ ASCII RIBBON | ?With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.?
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200619/07176cbb/attachment.asc>
#4 lore raw

PATCH 1/1 package/gpiod: add gpiod hardware handling daemon

Hello

Le ven. 19 juin 2020 ? 21:39, Alexander Dahl <[email protected]> a ?crit :

Quoted 25 lines

Hei hei,

Quoted 7 lines · Marc Chalain
Quoted 7 lines

Thanks a lot for your contribution. I have not reviewed it carefully. However, while it looks potentially interesting, I am personally always a bit concerned in packaging software components that look like "personal projects". This project has only been written by you, there are no contributions from others, no stars, no fork on Github, nothing indicates that anyone but you is using gpiod.

Quoted 5 lines
Quoted 1 line

This project comes from a professional project. I didn't find any tool

to launch an application on a switch event. I thought that is stupid to write
code in the application only for that, when there isn't time mandatory. This is a personal project, but I hope to reuse it in the future.

I had a similar problem last year. There's triggerhappy which I first noticed on raspbian, but that was already too heavy and did not fullfill my needs (pressing a button for five seconds and acting after that).

I know OpenWrt has something similar, but I found it was embedded to deep in their code to just use that part and they stripped out all that evdev stuff from kernel and userspace (probably to shrink size).

Quoted 6 lines

However, I defined my button in dts as key, not just as gpio, because it is actually a key and linux has infrastructure for that. Furthermore there are reliable userspace libraries to not reinvent the wheel. I was able to build something around libevdev in two days.

This solution may be complicated when you use some buttons for an

application,
and just another button for a system feature. You have to manage several keyboards,
to name each one by udev (or mdev) to use the good one with each
application.
A daemon on GPIO will never replace a keyboard. When you need several events
key and a short time response, a keyboard is more powerful. The Daemon is useful for few events in the life of the system, and you don't want
modify an application.

Besides: your gpiod uses the well known libgpiod, but is not part of

Quoted 4 lines

that project, right? That is a little puzzling, people will mix that up.

Yes I'm sorry for the name. I wanted to use direct access to the

/dev/gpiochip,
and after I saw that libgpiod was a kernel.org project. I should change the name
but it's the right name for its usage, and it uses libgpiod, then the daemon promotes
the library. Another name would have been stupid.
I will propose the daemon to the libgpiod developer, when I will be ready.

Greets

Quoted 8 lines

Alex

--

/"\ ASCII RIBBON | ?With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.?
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200619/26ac141e/attachment.html>

#5 lore raw

PATCH 1/1 package/gpiod: add gpiod hardware handling daemon

Hei hei,

Quoted 6 lines · Marc Chalain

Le ven. 19 juin 2020 ? 21:39, Alexander Dahl <[email protected]> a ?crit :

Quoted 5 lines

However, I defined my button in dts as key, not just as gpio, because it is actually a key and linux has infrastructure for that. Furthermore there are reliable userspace libraries to not reinvent the wheel. I was able to build something around libevdev in two days.

Quoted 6 lines

This solution may be complicated when you use some buttons for an application,
and just another button for a system feature. You have to manage several keyboards,
to name each one by udev (or mdev) to use the good one with each
application.

No and no.

There's no keyboard involved, the keycode I used is not even assigned to a key usually found on keyboards. The system has neither udev nor mdev, the key is ready by just defining it in dts.

Quoted 6 lines

A daemon on GPIO will never replace a keyboard. When you need several events
key and a short time response, a keyboard is more powerful. The Daemon is useful for few events in the life of the system, and you don't want
modify an application.

This is exactly my usecase, a tiny daemon doing basically nothing but waiting for a button press once a year or so.

Quoted 4 lines
Quoted 4 lines

Besides: your gpiod uses the well known libgpiod, but is not part of that project, right? That is a little puzzling, people will mix that up.

Quoted 8 lines

Yes I'm sorry for the name. I wanted to use direct access to the /dev/gpiochip,
and after I saw that libgpiod was a kernel.org project. I should change the name
but it's the right name for its usage, and it uses libgpiod, then the daemon promotes
the library. Another name would have been stupid.
I will propose the daemon to the libgpiod developer, when I will be ready.

Looking forward to that. :-)

Greets
Alex

Signature · 11 lines
/"\ ASCII RIBBON | ?With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.?
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200620/4920bc97/attachment.asc>
#6 lore raw

PATCH 1/1 package/gpiod: add gpiod hardware handling daemon

hello,
just to speak clearly and explain that I agree with you

compatible = "gpio-keys";
label = "mediakey";
nextkey: gpiokey,next {
label = "next";
gpios = <&gpio 22 1>;
linux,code = <163>; /* 163 KEY_NEXTSONG */ status = "disabled";
};
for me this is a keyboard definition with one key. I think that we spoke about exactly the same thing.

Le sam. 20 juin 2020 ? 14:33, Alexander Dahl <[email protected]> a ?crit :

Quoted 50 lines

Hei hei,

Quoted 1 line · Marc Chalain

Le ven. 19 juin 2020 ? 21:39, Alexander Dahl <[email protected]> a ?crit

:

Quoted 11 lines
Quoted 5 lines

However, I defined my button in dts as key, not just as gpio, because it is actually a key and linux has infrastructure for that. Furthermore there are reliable userspace libraries to not reinvent the wheel. I was able to build something around libevdev in two days.

This solution may be complicated when you use some buttons for an application,
and just another button for a system feature. You have to manage several keyboards,
to name each one by udev (or mdev) to use the good one with each
application.

No and no.

There's no keyboard involved, the keycode I used is not even assigned to a key usually found on keyboards. The system has neither udev nor mdev, the key is ready by just defining it in dts.

Quoted 6 lines

A daemon on GPIO will never replace a keyboard. When you need several events
key and a short time response, a keyboard is more powerful. The Daemon is useful for few events in the life of the system, and you don't want
modify an application.

This is exactly my usecase, a tiny daemon doing basically nothing but waiting for a button press once a year or so.

Quoted 7 lines
Quoted 4 lines

Besides: your gpiod uses the well known libgpiod, but is not part of that project, right? That is a little puzzling, people will mix that up.

Yes I'm sorry for the name. I wanted to use direct access to the /dev/gpiochip,
and after I saw that libgpiod was a kernel.org project. I should change

the

Quoted 5 lines

name
but it's the right name for its usage, and it uses libgpiod, then the daemon promotes
the library. Another name would have been stupid.
I will propose the daemon to the libgpiod developer, when I will be

ready.

Looking forward to that. :-)

Quoted 9 lines

Greets
Alex

--

/"\ ASCII RIBBON | ?With the first link, the chain is forged. The first
\ / CAMPAIGN     | speech censured, the first thought forbidden, the
 X  AGAINST      | first freedom denied, chains us all irrevocably.?
/ \ HTML MAIL    | (Jean-Luc Picard, quoting Judge Aaron Satie)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20200620/0dceda13/attachment.html>