Browse Source

gpio-cdev: add nu801 userspace driver

This adds a userspace interpretation of the nu801 driver used by Meraki
hardware. Previously this was a driver that was added per target, but as
multiple targets now have this driver, we should move to something that
can be shared by all targets since no driver exists upstream.

Co-developed-by: Christian Lamparter <[email protected]>
Signed-off-by: Chris Blake <[email protected]>
Signed-off-by: Christian Lamparter <[email protected]>
Chris Blake 4 năm trước cách đây
mục cha
commit
f536f5ebdd

+ 41 - 0
package/system/gpio-cdev/nu801/Makefile

@@ -0,0 +1,41 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=nu801
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/chunkeey/nu801.git
+PKG_SOURCE_VERSION:=794a588fce3150129bb2e5bb37590c7daceb8927
+
+PKG_MAINTAINER:=Christian Lamparter <[email protected]>
+PKG_LICENSE:=GPL-3.0-or-later
+PKG_LICENSE_FILES:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/nu801
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=Userspace GPIO Drivers
+  DEPENDS:=@!LINUX_5_4 +kmod-leds-uleds
+  KCONFIG:= \
+    CONFIG_GPIO_CDEV=y
+  TITLE:=NU801 LED Driver
+endef
+
+define Package/nu801/description
+This package contains a userspace driver to power the NUMEN Tech. NU801 LED Driver.
+endef
+
+define Package/nu801/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/nu801 $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/nu801.init $(1)/etc/init.d/nu801
+
+endef
+
+$(eval $(call BuildPackage,nu801))

+ 15 - 0
package/system/gpio-cdev/nu801/files/nu801.init

@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+START=15
+STOP=94
+USE_PROCD=1
+
+start_service() {
+	. /lib/functions.sh
+
+	procd_open_instance
+	procd_set_param command /usr/sbin/nu801 "$(board_name)"
+	procd_set_param respawn 5 1 5
+	procd_close_instance
+}