- return -1;
- }
-
- memset(bus_name, 0, SYSFS_NAME_LEN);
- memset(bus_path, 0, SYSFS_NAME_LEN);
- if ((sysfs_find_device_bus(device, bus_name, SYSFS_NAME_LEN)) != 0) {
- dprintf("Device %s not found\n", device);
- return -1;
- }
- if (sysfs_get_mnt_path(bus_path, SYSFS_PATH_MAX) != 0) {
- dprintf ("Sysfs not supported on this system\n");
- return -1;
- }
- strcat(bus_path, SYSFS_BUS_DIR);
- strcat(bus_path, "/");
- strcat(bus_path, bus_name);
- strcat(bus_path, SYSFS_DEVICES_DIR);
- strcat(bus_path, "/");
- strcat(bus_path, device);
- /*
- * We now are at /sys/bus/"bus_name"/devices/"device" which is a link.
- * Now read this link to reach to the device.
- */
- if ((sysfs_get_link(bus_path, path, SYSFS_PATH_MAX)) != 0) {
- dprintf("Error getting to device %s\n", device);
- return -1;