- retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX);
- dbg("sysfs_path = %s", sysfs_path);
+ strcpy(filename, sysfs_path);
+ strcat(filename, path);
+ strcat(filename, "/dev");
+
+ while (loop < SECONDS_TO_WAIT_FOR_DEV) {
+ dbg("looking for %s", filename);
+ retval = stat(filename, &buf);
+ if (retval == 0) {
+ retval = 0;
+ goto exit;
+ }
+
+ /* sleep for a second or two to give the kernel a chance to
+ * create the dev file */
+ sleep(1);
+ }
+ retval = -ENODEV;
+exit: