- } else {
- /* get subsystem from "subsystem" link */
- strlcpy(link_path, sysfs_path, sizeof(link_path));
- strlcat(link_path, dev->devpath, sizeof(link_path));
- strlcat(link_path, "/subsystem", sizeof(link_path));
- len = readlink(link_path, link_target, sizeof(link_target));
- if (len > 0) {
- link_target[len] = '\0';
- dbg("subsystem link '%s' points to '%s'", link_path, link_target);
- pos = strrchr(link_target, '/');
- if (pos != NULL)
- strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem));
- }
- }
- /* get driver name */
- strlcpy(link_path, sysfs_path, sizeof(link_path));
- strlcat(link_path, dev->devpath, sizeof(link_path));
- strlcat(link_path, "/driver", sizeof(link_path));
- len = readlink(link_path, link_target, sizeof(link_target));
- if (len > 0) {
- link_target[len] = '\0';
- dbg("driver link '%s' points to '%s'", link_path, link_target);
- pos = strrchr(link_target, '/');
- if (pos != NULL)
- strlcpy(dev->driver, &pos[1], sizeof(dev->driver));