char devpath[DEVPATH_SIZE];
int config_line;
char config_file[NAME_SIZE];
- time_t config_time;
+ long config_uptime;
int added;
};
-LIST_HEAD(device_list);
-int device_count;
+static LIST_HEAD(device_list);
+static int device_count;
/* callback for database dump */
static int add_record(char *path, struct udevice *udev)
strfieldcpy(dev->devpath, path);
dev->config_line = udev->config_line;
strfieldcpy(dev->config_file, udev->config_file);
- dev->config_time = udev->config_time;
+ dev->config_uptime = udev->config_uptime;
dev->added = 0;
/* sort in lexical order */
char key[NAME_SIZE];
};
-LIST_HEAD(attribute_list);
-int attribute_count;
+static LIST_HEAD(attribute_list);
+static int attribute_count;
static int add_attribute(const char *key, int level)
{
}
}
+ sysfs_close_directory(sysfs_dir);
return 0;
}
{
struct sysfs_class_device *class_dev;
struct sysfs_class_device *class_dev_parent;
- struct sysfs_attribute *attr;
struct sysfs_device *sysfs_dev;
struct sysfs_device *sysfs_dev_parent;
char key[NAME_SIZE];
return -1;
}
- /* read the 'dev' file for major/minor*/
- attr = sysfs_get_classdev_attr(class_dev, "dev");
- if (attr == NULL) {
- dbg("couldn't get the \"dev\" file");
- retval = -1;
- goto exit;
- }
-
- sysfs_close_attribute(attr);
-
/* open sysfs class device directory and get all attributes */
if (add_all_attributes(class_dev->path, level) != 0) {
dbg("couldn't open class device directory");
/* get the device link (if parent exists look here) */
class_dev_parent = sysfs_get_classdev_parent(class_dev);
- if (class_dev_parent != NULL) {
- //sysfs_close_class_device(class_dev);
- class_dev = class_dev_parent;
- }
- sysfs_dev = sysfs_get_classdev_device(class_dev);
+ if (class_dev_parent != NULL)
+ sysfs_dev = sysfs_get_classdev_device(class_dev_parent);
+ else
+ sysfs_dev = sysfs_get_classdev_device(class_dev);
/* look the device chain upwards */
while (sysfs_dev != NULL) {
if (sysfs_dev_parent == NULL)
break;
- //sysfs_close_device(sysfs_dev);
sysfs_dev = sysfs_dev_parent;
}
- sysfs_close_device(sysfs_dev);
exit:
- //sysfs_close_class_device(class_dev);
+ sysfs_close_class_device(class_dev);
return retval;
}
char roottext[81];
char path[NAME_SIZE];
struct device *dev;
- time_t time_last;
+ long time_last;
int count_last;
newtInit();
/* look for last discovered device */
time_last = 0;
list_for_each_entry(dev, &device_list, list)
- if (dev->config_time > time_last)
- time_last = dev->config_time;
+ if (dev->config_uptime > time_last)
+ time_last = dev->config_uptime;
/* skip if more than 16 recent devices */
count_last = 0;
list_for_each_entry(dev, &device_list, list) {
- if (dev->config_time < time_last - 10)
+ if (dev->config_uptime < time_last - 10)
continue;
count_last++;
}
if (count_last < 16) {
newtListboxAppendEntry(lbox, "--- last dicovered ---", NULL);
list_for_each_entry(dev, &device_list, list) {
- if (dev->config_time < time_last - 10)
+ if (dev->config_uptime < time_last - 10)
continue;
dbg("%s %i", dev->name, dev->config_line);
int i;
int numitems;
struct attribute **selattr;
- char text_rule[80];
+ char text_rule[255];
answer = newtRunForm(form);
if (answer == quit)