- struct udev *udev = udev_device_get_udev(device);
- DIR *dir;
- struct dirent *dent;
-
- dir = opendir(udev_device_get_syspath(device));
- if (dir != NULL) {
- for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
- struct stat statbuf;
- const char *value;
- size_t len;
-
- if (dent->d_name[0] == '.')
- continue;
-
- if (strcmp(dent->d_name, "uevent") == 0)
- continue;
- if (strcmp(dent->d_name, "dev") == 0)
- continue;
-
- if (fstatat(dirfd(dir), dent->d_name, &statbuf, AT_SYMLINK_NOFOLLOW) != 0)
- continue;
- if (S_ISLNK(statbuf.st_mode))
- continue;
-
- value = udev_device_get_sysattr_value(device, dent->d_name);
- if (value == NULL)
- continue;
- dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len);
-
- /* skip nonprintable attributes */
- len = strlen(value);
- while (len > 0 && isprint(value[len-1]))
- len--;
- if (len > 0) {
- dbg(udev, "attribute value of '%s' non-printable, skip\n", dent->d_name);
- continue;
- }