This package provides a small udev shim originally intended for FreeBSD/devd, but it works well for our non-systemd-environment as well. It has limited features, but it's enough to detect and enumerate input devices. Signed-off-by: Daniel Golle <daniel@makrotopia.org>lilik-openwrt-22.03
@ -0,0 +1,50 @@ | |||
# This is free software, licensed under the GNU General Public License v2. | |||
# See /LICENSE for more information. | |||
# | |||
include $(TOPDIR)/rules.mk | |||
PKG_NAME:=libudev-fbsd | |||
PKG_RELEASE:=1 | |||
PKG_VERSION:=20160820 | |||
PKG_SOURCE_VERSION:=1f21323b817e70253d3c04bc8bedd61c477d0544 | |||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz | |||
PKG_SOURCE_PROTO:=git | |||
PKG_SOURCE_URL:=https://github.com/jiixyj/libudev-fbsd.git | |||
PKG_LICENSE:=MIT | |||
PKG_LICENSE_FILES:=COPYING | |||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org> | |||
PKG_INSTALL:=1 | |||
include $(INCLUDE_DIR)/package.mk | |||
include $(INCLUDE_DIR)/cmake.mk | |||
define Package/libudev-fbsd | |||
SECTION:=libs | |||
CATEGORY:=Libraries | |||
TITLE:=small udev shim for FreeBSD/devd (and other non-systemd) | |||
URL:=https://github.com/jiixyj/libudev-fbsd | |||
DEPENDS:=libevdev | |||
PROVIDES:=libudev | |||
CONFLICTS:=libudev eudev udev | |||
endef | |||
define Build/InstallDev | |||
$(INSTALL_DIR) $(1)/usr/include | |||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ | |||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/* $(1)/usr/lib/pkgconfig/ | |||
endef | |||
define Package/libudev-fbsd/install | |||
$(INSTALL_DIR) $(1)/usr/lib | |||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/*.so* $(1)/usr/lib/ | |||
endef | |||
$(eval $(call BuildPackage,libudev-fbsd)) |
@ -0,0 +1,42 @@ | |||
--- a/src/libudev.c | |||
+++ b/src/libudev.c | |||
@@ -354,7 +354,7 @@ udev_device_get_subsystem(struct udev_de | |||
const char * | |||
udev_device_get_sysattr_value( | |||
- struct udev_device *udev_device __unused, const char *sysattr) | |||
+ __attribute__ ((unused))struct udev_device *udev_device, const char *sysattr) | |||
{ | |||
(void)sysattr; | |||
LOG("stub: udev_device_get_sysattr_value %s\n", sysattr); | |||
@@ -469,7 +469,7 @@ udev_device_get_parent_with_subsystem_de | |||
} | |||
struct udev_enumerate * | |||
-udev_enumerate_new(struct udev *udev __unused) | |||
+udev_enumerate_new( __attribute__ ((unused))struct udev *udev) | |||
{ | |||
LOG("udev_enumerate_new\n"); | |||
struct udev_enumerate *u = calloc(1, sizeof(struct udev_enumerate)); | |||
@@ -538,7 +538,7 @@ udev_enumerate_get_list_entry(struct ude | |||
int | |||
udev_enumerate_add_match_sysname( | |||
- struct udev_enumerate *udev_enumerate __unused, const char *sysname) | |||
+ __attribute__ ((unused))struct udev_enumerate *udev_enumerate, const char *sysname) | |||
{ | |||
(void)sysname; | |||
LOG("stub: udev_enumerate_add_match_sysname %s\n", sysname); | |||
--- a/src/libudev.h | |||
+++ b/src/libudev.h | |||
@@ -24,8 +24,8 @@ void udev_unref(struct udev *udev); | |||
char const *udev_device_get_devnode(struct udev_device *udev_device); | |||
dev_t udev_device_get_devnum(struct udev_device *udev_device); | |||
char const *udev_device_get_property_value( | |||
- struct udev_device *dummy __unused, char const *property); | |||
-struct udev *udev_device_get_udev(struct udev_device *dummy __unused); | |||
+ __attribute__ ((unused))struct udev_device *dummy, char const *property); | |||
+struct udev *udev_device_get_udev( __attribute__ ((unused))struct udev_device *dummy); | |||
struct udev_device *udev_device_new_from_syspath( | |||
struct udev *udev, char const *syspath); | |||
struct udev_device *udev_device_new_from_devnum( |
@ -0,0 +1,11 @@ | |||
--- a/src/libudev.c | |||
+++ b/src/libudev.c | |||
@@ -175,7 +175,7 @@ populate_properties_list(struct udev_dev | |||
struct udev_list_entry **list_end = &udev_device->properties_list; | |||
- for (unsigned i = 0; i < nitems(ids); ++i) { | |||
+ for (unsigned i = 0; i < (sizeof(ids) / sizeof(ids[0])); ++i) { | |||
char const *id = ids[i]; | |||
struct udev_list_entry *le; | |||
@ -0,0 +1,20 @@ | |||
--- a/src/CMakeLists.txt | |||
+++ b/src/CMakeLists.txt | |||
@@ -11,6 +11,7 @@ install(TARGETS udev LIBRARY DESTINATION | |||
install(FILES libudev.h DESTINATION include) | |||
set(PKG_CONFIG_NAME libudev) | |||
+set(PKG_CONFIG_DESCRIPTION small udev shim for FreeBSD/devd) | |||
set(PKG_CONFIG_REQUIRES libevdev) | |||
set(PKG_CONFIG_LIBDIR "\${prefix}/lib") | |||
set(PKG_CONFIG_INCLUDEDIR "\${prefix}/include") | |||
--- a/src/pkg-config.pc.cmake | |||
+++ b/src/pkg-config.pc.cmake | |||
@@ -3,6 +3,7 @@ libdir=${PKG_CONFIG_LIBDIR} | |||
includedir=${PKG_CONFIG_INCLUDEDIR} | |||
Name: ${PKG_CONFIG_NAME} | |||
+Description: ${PKG_CONFIG_DESCRIPTION} | |||
Version: 143 | |||
Requires: ${PKG_CONFIG_REQUIRES} | |||
Libs: ${PKG_CONFIG_LIBS} |