This will be replaced with libudev-zero Signed-off-by: Rosen Penev <rosenp@gmail.com>lilik-openwrt-22.03
@ -1,41 +0,0 @@ | |||
# 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_SOURCE_DATE:=2017-12-16 | |||
PKG_SOURCE_VERSION:=fa190fdf0b22a41b5f42e3a722f754c08ad7b337 | |||
PKG_RELEASE:=1 | |||
PKG_SOURCE_PROTO:=git | |||
PKG_SOURCE_URL:=https://github.com/jiixyj/libudev-fbsd.git | |||
PKG_MIRROR_HASH:=dac2d960191fe970c974f022d008ef3b712ad331e2426a51debd5aa2e208f02b | |||
PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org> | |||
PKG_LICENSE:=MIT | |||
PKG_LICENSE_FILES:=COPYING | |||
CMAKE_INSTALL:=1 | |||
PKG_BUILD_PARALLEL:=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 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)) |
@ -1,20 +0,0 @@ | |||
--- a/src/CMakeLists.txt | |||
+++ b/src/CMakeLists.txt | |||
@@ -26,6 +26,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} |
@ -1,25 +0,0 @@ | |||
--- a/src/libudev.h | |||
+++ b/src/libudev.h | |||
@@ -7,6 +7,11 @@ | |||
extern "C" { | |||
#endif | |||
+ | |||
+#ifdef __cplusplus | |||
+extern "C" { | |||
+#endif | |||
+ | |||
struct udev; | |||
struct udev_device; | |||
struct udev_list_entry; | |||
@@ -76,6 +81,10 @@ void udev_monitor_unref(struct udev_moni | |||
#ifdef __cplusplus | |||
} /* extern "C" */ | |||
+#endif | |||
+ | |||
+#ifdef __cplusplus | |||
+} /* extern "C" */ | |||
#endif | |||
#endif |
@ -1,25 +0,0 @@ | |||
--- a/src/libudev.c | |||
+++ b/src/libudev.c | |||
@@ -139,6 +139,12 @@ udev_device_get_devnum(struct udev_devic | |||
} | |||
char const * | |||
+udev_device_get_driver(struct udev_device *udev_device) | |||
+{ | |||
+ return NULL; | |||
+} | |||
+ | |||
+char const * | |||
udev_device_get_property_value(struct udev_device *dev, char const *property) | |||
{ | |||
LOG("udev_device_get_property_value %s\n", property); | |||
--- a/src/libudev.h | |||
+++ b/src/libudev.h | |||
@@ -31,6 +31,7 @@ struct udev_device *udev_device_new_from | |||
struct udev *udev, char const *syspath); | |||
struct udev_device *udev_device_new_from_devnum( | |||
struct udev *udev, char type, dev_t devnum); | |||
+char const *udev_device_get_driver(struct udev_device *udev_device); | |||
char const *udev_device_get_syspath(struct udev_device *udev_device); | |||
char const *udev_device_get_sysname(struct udev_device *udev_device); | |||
char const *udev_device_get_subsystem(struct udev_device *udev_device); |
@ -1,72 +0,0 @@ | |||
--- a/src/libudev.c | |||
+++ b/src/libudev.c | |||
@@ -35,6 +35,7 @@ struct udev_device { | |||
struct udev *udev; | |||
int refcount; | |||
char syspath[32]; | |||
+ char sysfspath[64]; | |||
dev_t devnum; | |||
char const *sysname; | |||
char const *action; | |||
@@ -124,6 +125,29 @@ udev_device_new_from_devnum(struct udev | |||
return NULL; | |||
} | |||
+struct udev_device * | |||
+udev_device_new_from_subsystem_sysname( | |||
+ struct udev *udev, const char *subsystem, const char *sysname) | |||
+{ | |||
+ struct udev_device *u; | |||
+ char sysfsname[64]; | |||
+ struct stat st; | |||
+ | |||
+ snprintf(sysfsname, sizeof(sysfsname), "/sys/bus/%s/devices/%s/", subsystem, sysname); | |||
+ if (stat(sysfsname, &st) == 0) | |||
+ { | |||
+ char sysfsdev[64]; | |||
+ u = calloc(1, sizeof(struct udev_device)); | |||
+ strncpy(u->sysfspath, sysfsname, sizeof(u->sysfspath)); | |||
+ | |||
+ return u; | |||
+ } | |||
+ else | |||
+ { | |||
+ return NULL; | |||
+ } | |||
+} | |||
+ | |||
char const * | |||
udev_device_get_devnode(struct udev_device *udev_device) | |||
{ | |||
@@ -141,6 +165,20 @@ udev_device_get_devnum(struct udev_devic | |||
char const * | |||
udev_device_get_driver(struct udev_device *udev_device) | |||
{ | |||
+ if (udev_device->sysfspath) | |||
+ { | |||
+ char driverlnp[64]; | |||
+ char driverlnk[32]; | |||
+ snprintf(driverlnp, sizeof(driverlnp), "%s/driver", | |||
+ udev_device->sysfspath); | |||
+ if (readlink(driverlnp, driverlnk, sizeof(driver))) | |||
+ { | |||
+ char *drivernm; | |||
+ drivernm = strrchr(driverlnk, '/'); | |||
+ if (drivernm) | |||
+ return ++drivernm; | |||
+ } | |||
+ } | |||
return NULL; | |||
} | |||
--- a/src/libudev.h | |||
+++ b/src/libudev.h | |||
@@ -31,6 +31,8 @@ struct udev_device *udev_device_new_from | |||
struct udev *udev, char const *syspath); | |||
struct udev_device *udev_device_new_from_devnum( | |||
struct udev *udev, char type, dev_t devnum); | |||
+struct udev_device *udev_device_new_from_subsystem_sysname( | |||
+ struct udev *udev, const char *subsystem, const char *sysname); | |||
char const *udev_device_get_driver(struct udev_device *udev_device); | |||
char const *udev_device_get_syspath(struct udev_device *udev_device); | |||
char const *udev_device_get_sysname(struct udev_device *udev_device); |
@ -1,41 +0,0 @@ | |||
--- a/src/libudev.c | |||
+++ b/src/libudev.c | |||
@@ -171,7 +171,7 @@ udev_device_get_driver(struct udev_devic | |||
char driverlnk[32]; | |||
snprintf(driverlnp, sizeof(driverlnp), "%s/driver", | |||
udev_device->sysfspath); | |||
- if (readlink(driverlnp, driverlnk, sizeof(driver))) | |||
+ if (readlink(driverlnp, driverlnk, sizeof(driverlnk))) | |||
{ | |||
char *drivernm; | |||
drivernm = strrchr(driverlnk, '/'); | |||
@@ -612,6 +612,18 @@ udev_enumerate_add_match_property(struct | |||
value); | |||
return -1; | |||
} | |||
+ | |||
+int | |||
+udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, | |||
+ const char *sysattr, const char *value) | |||
+{ | |||
+ (void)udev_enumerate; | |||
+ (void)sysattr; | |||
+ (void)value; | |||
+ LOG("stub: udev_enumerate_add_nomatch_sysattr %s %s\n", sysattr, | |||
+ value); | |||
+ return -1; | |||
+} | |||
void | |||
udev_enumerate_unref(struct udev_enumerate *udev_enumerate) | |||
--- a/src/libudev.h | |||
+++ b/src/libudev.h | |||
@@ -60,6 +60,8 @@ int udev_enumerate_add_match_sysname( | |||
struct udev_enumerate *udev_enumerate, char const *sysname); | |||
int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, | |||
char const *property, char const *value); | |||
+int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, | |||
+ const char *sysattr, const char *value); | |||
void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); | |||
#define udev_list_entry_foreach(list_entry, first_entry) \ |