mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-03-10 07:54:10 +07:00
[PATCH] added topology support.
This commit is contained in:
parent
c18d70b447
commit
20051a5be9
35
namedev.c
35
namedev.c
@ -421,6 +421,8 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at
|
|||||||
int retval = 0;
|
int retval = 0;
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
|
dbg("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path);
|
||||||
|
dbg("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id);
|
||||||
list_for_each(tmp, &config_device_list) {
|
list_for_each(tmp, &config_device_list) {
|
||||||
struct config_device *dev = list_entry(tmp, struct config_device, node);
|
struct config_device *dev = list_entry(tmp, struct config_device, node);
|
||||||
switch (dev->type) {
|
switch (dev->type) {
|
||||||
@ -437,11 +439,37 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at
|
|||||||
dev->attr.owner, dev->attr.group, dev->attr.mode);
|
dev->attr.owner, dev->attr.group, dev->attr.mode);
|
||||||
break;
|
break;
|
||||||
case TOPOLOGY:
|
case TOPOLOGY:
|
||||||
dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'"
|
{
|
||||||
" owner = '%s', group = '%s', mode = '%#o'",
|
char path[SYSFS_PATH_MAX];
|
||||||
dev->attr.name, dev->bus, dev->place,
|
char *temp;
|
||||||
|
|
||||||
|
found = 0;
|
||||||
|
strcpy(path, class_dev->sysdevice->directory->path);
|
||||||
|
temp = strrchr(path, '/');
|
||||||
|
dbg("TOPOLOGY path = '%s'", path);
|
||||||
|
dbg("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place);
|
||||||
|
if (strstr(temp, dev->place) != NULL) {
|
||||||
|
found = 1;
|
||||||
|
} else {
|
||||||
|
*temp = 0x00;
|
||||||
|
temp = strrchr(path, '/');
|
||||||
|
dbg("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place);
|
||||||
|
if (strstr(temp, dev->place) != NULL)
|
||||||
|
found = 1;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
strcpy(attr->name, dev->attr.name);
|
||||||
|
attr->mode = dev->attr.mode;
|
||||||
|
strcpy(attr->owner, dev->attr.owner);
|
||||||
|
strcpy(attr->group, dev->attr.group);
|
||||||
|
dbg("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o",
|
||||||
|
dev->place, attr->name,
|
||||||
dev->attr.owner, dev->attr.group, dev->attr.mode);
|
dev->attr.owner, dev->attr.group, dev->attr.mode);
|
||||||
|
return retval;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case REPLACE:
|
case REPLACE:
|
||||||
if (strcmp(dev->kernel_name, class_dev->name) != 0)
|
if (strcmp(dev->kernel_name, class_dev->name) != 0)
|
||||||
continue;
|
continue;
|
||||||
@ -463,7 +491,6 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at
|
|||||||
attr->owner[0] = 0x00;
|
attr->owner[0] = 0x00;
|
||||||
attr->group[0] = 0x00;
|
attr->group[0] = 0x00;
|
||||||
strcpy(attr->name, class_dev->name);
|
strcpy(attr->name, class_dev->name);
|
||||||
exit:
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user