diff options
author | greg@kroah.com <greg@kroah.com> | 2004-04-21 20:24:51 -0700 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 21:35:16 -0700 |
commit | a3e6c80049137722cf75d65de8d1e6d5a35bc252 (patch) | |
tree | 6ed699131fe198f80ac2033190625d251d523669 /dev_d.c | |
parent | ffcd3851b22b28e5ac8a9756b486050a2c915f11 (diff) |
[PATCH] make dev.d call each directory in the directory chain of the device name, instead of just the whole name.
This lets /etc/dev.d/sound/ work better.
Diffstat (limited to 'dev_d.c')
-rw-r--r-- | dev_d.c | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -64,20 +64,41 @@ static int run_program(char *name) void dev_d_send(struct udevice *dev, char *subsystem, char *devpath) { char dirname[256]; - char devname[NAME_SIZE]; + char env_devname[NAME_SIZE]; + char *devname; + char *temp; if (udev_dev_d == 0) return; if (dev->type == 'b' || dev->type == 'c') { - strfieldcpy(devname, udev_root); - strfieldcat(devname, dev->name); + strfieldcpy(env_devname, udev_root); + strfieldcat(env_devname, dev->name); } else if (dev->type == 'n') { - strfieldcpy(devname, dev->name); + strfieldcpy(env_devname, dev->name); setenv("DEVPATH", devpath, 1); } - setenv("DEVNAME", devname, 1); - dbg("DEVNAME='%s'", devname); + setenv("DEVNAME", env_devname, 1); + dbg("DEVNAME='%s'", env_devname); + + devname = strdup(dev->name); + if (!devname) { + dbg("out of memory"); + return; + } + + /* Chop the device name up into pieces based on '/' */ + temp = strchr(devname, '/'); + while (temp != NULL) { + *temp = 0x00; + strcpy(dirname, DEVD_DIR); + strfieldcat(dirname, devname); + call_foreach_file(run_program, dirname, DEVD_SUFFIX); + + *temp = '/'; + ++temp; + temp = strchr(temp, '/'); + } strcpy(dirname, DEVD_DIR); strfieldcat(dirname, dev->name); |