PKG_NAME:=libudev-fbsd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_VERSION:=20160820
PKG_SOURCE_VERSION:=1f21323b817e70253d3c04bc8bedd61c477d0544
--- /dev/null
+--- a/src/libudev.c
++++ b/src/libudev.c
+@@ -130,6 +130,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
+@@ -30,6 +30,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);
--- /dev/null
+--- a/src/libudev.c
++++ b/src/libudev.c
+@@ -26,6 +26,7 @@ struct udev_device {
+ struct udev *udev;
+ int refcount;
+ char syspath[32];
++ char sysfspath[64];
+ dev_t devnum;
+ char const *sysname;
+ char const *action;
+@@ -115,6 +116,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)
+ {
+@@ -132,6 +156,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
+@@ -30,6 +30,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);
--- /dev/null
+--- a/src/libudev.c
++++ b/src/libudev.c
+@@ -162,7 +162,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, '/');
+@@ -600,6 +600,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
+@@ -59,6 +59,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) \