return 0;
}
-static int match_place(struct config_device *dev, struct sysfs_device *sysfs_device)
-{
- char path[PATH_SIZE];
- char *temp;
-
- strlcpy(path, sysfs_device->path, sizeof(path));
- temp = strrchr(path, '/');
- dbg("search '%s' in '%s', path='%s'", dev->place, temp, path);
- if (strstr(temp, dev->place) != NULL)
- return 0;
-
- /* try the parent */
- temp[0] = '\0';
- temp = strrchr(path, '/');
- dbg("search '%s' in '%s', path='%s'", dev->place, temp, path);
- if (strstr(temp, dev->place) == NULL)
- return 0;
-
- dbg("place doesn't match");
- return -ENODEV;
-}
-
static int match_rule(struct udevice *udev, struct config_device *dev,
struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)
{
dbg(FIELD_ID " matches");
}
- /* check for matching place of device */
- if (dev->place[0] != '\0') {
- if (sysfs_device == NULL) {
- dbg("device has no sysfs_device");
- goto try_parent;
- }
- dbg("check " FIELD_PLACE);
- if (match_place(dev, sysfs_device) != 0) {
- dbg(FIELD_PLACE " is not matching");
- goto try_parent;
- }
- dbg(FIELD_PLACE " matches");
- }
-
/* check for matching sysfs pairs */
if (dev->sysfs_pair[0].file[0] != '\0') {
dbg("check " FIELD_SYSFS " pairs");
#define FIELD_BUS "BUS"
#define FIELD_SYSFS "SYSFS"
#define FIELD_ID "ID"
-#define FIELD_PLACE "PLACE"
#define FIELD_PROGRAM "PROGRAM"
#define FIELD_RESULT "RESULT"
#define FIELD_DRIVER "DRIVER"
char subsystem[NAME_SIZE];
char bus[NAME_SIZE];
char id[NAME_SIZE];
- char place[NAME_SIZE];
struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS];
char program[PATH_SIZE];
char result[PATH_SIZE];
void dump_config_dev(struct config_device *dev)
{
- dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', "
+ dbg_parse("name='%s', symlink='%s', bus='%s', id='%s', "
"sysfs_file[0]='%s', sysfs_value[0]='%s', "
"kernel='%s', program='%s', result='%s'"
"owner='%s', group='%s', mode=%#o",
- dev->name, dev->symlink, dev->bus, dev->place, dev->id,
+ dev->name, dev->symlink, dev->bus, dev->id,
dev->sysfs_pair[0].file, dev->sysfs_pair[0].value,
dev->kernel, dev->program, dev->result,
dev->owner, dev->group, dev->mode);
continue;
}
- if (strcasecmp(temp2, FIELD_PLACE) == 0) {
- strlcpy(dev.place, temp3, sizeof(dev.place));
- valid = 1;
- continue;
- }
-
if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) {
struct sysfs_pair *pair = &dev.sysfs_pair[0];
int sysfs_pair_num = 0;
devpath => "/block/sda/sda3",
exp_name => "first_disk3" ,
conf => <<EOF
-BUS="scsi", PLACE="0:0:0:0", NAME="first_disk%n"
+BUS="scsi", ID="0:0:0:0", NAME="first_disk%n"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" ,
conf => <<EOF
-BUS="scsi", PLACE="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
+BUS="scsi", ID="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "M8-m3-n3-b0:0-sIBM" ,
conf => <<EOF
-BUS="scsi", PLACE="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
+BUS="scsi", ID="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
EOF
},
{
.B ID
Match the device number on the bus, like PCI bus id.
.TP
-.B PLACE
-Match the topological position on bus, like physical port of USB device
-.TP
.BI SYSFS{ filename }
Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID
or file system label. Up to 5 different sysfs files can be checked, with
BUS="pci", ID="00:0b.0", NAME="dsp"
# USB mouse at third port of the second hub to be called mouse1
-BUS="usb", PLACE="2.3", NAME="mouse1"
+BUS="usb", ID="2.3", NAME="mouse1"
# ttyUSB1 should always be called pda with two additional symlinks
KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld"