diff options
Diffstat (limited to 'udev/lib/test-libudev.c')
-rw-r--r-- | udev/lib/test-libudev.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 0a0d754b38..8afd294a2f 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -24,6 +24,7 @@ #include <string.h> #include <getopt.h> #include <syslog.h> +#include <fcntl.h> #include <sys/select.h> #include "libudev.h" @@ -114,6 +115,20 @@ static int test_device_parents(struct udev *udev, const char *syspath) return 0; } +static int test_device_devnum(struct udev *udev) +{ + dev_t devnum = makedev(1, 3); + struct udev_device *device; + + printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); + device = udev_device_new_from_devnum(udev, 'c', devnum); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; +} + static int devices_enum_cb(struct udev_device *device, void *data) { printf("device: '%s' (%s) '%s'\n", @@ -253,6 +268,7 @@ int main(int argc, char *argv[], char *envp[]) } test_device(udev, syspath); + test_device_devnum(udev); test_device_parents(udev, syspath); test_enumerate(udev, subsystem); test_monitor(udev, socket); |