summaryrefslogtreecommitdiff
path: root/namedev.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-01-15 21:53:20 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:17 -0700
commit54988802b795328ceba29480611102902e88f572 (patch)
tree1bb53694614fe9ca088613368fcf6244618a0f16 /namedev.c
parent5e4f123888a30bcc2a9fc256ec00315387b2d240 (diff)
[PATCH] add udev logging to info log
On Thu, Jan 15, 2004 at 05:14:16AM +0100, Kay Sievers wrote: > On Wed, Jan 14, 2004 at 01:10:43PM -0800, Greg KH wrote: > > On Wed, Jan 14, 2004 at 02:34:26PM -0600, Clay Haapala wrote: > > > On Wed, 14 Jan 2004, Chris Friesen spake thusly: > > > > > > > > Maybe for ones with a matching rule, you could print something like: > > > > > > > > > > > Is the act of printing/syslogging a rule in an of itself? > > > > No, as currently the only way stuff ends up in the syslog is if > > DEBUG=true is used on the build line. > > > > But it's sounding like we might want to change that... :) > > How about this in the syslog after connect/disconnect? > > Jan 15 05:07:45 pim udev[28007]: configured rule in '/etc/udev/udev.rules' at line 17 applied, 'video*' becomes 'video/webcam%n' > Jan 15 05:07:45 pim udev[28007]: creating device node '/udev/video/webcam0' > Jan 15 05:07:47 pim udev[28015]: removing device node '/udev/video/webcam0' Here is a slightly better version. I've created a logging.h file and moved the debug macros from udev.h in there. If you type: 'make' - you will get a binary that prints one or two lines to syslog if a device node is created or deleted 'make LOG=false' - you get a binary that prints asolutely nothing 'make DEBUG=true' - the same as today, it will print all debug lines
Diffstat (limited to 'namedev.c')
-rw-r--r--namedev.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/namedev.c b/namedev.c
index b3b23521d6..137446e255 100644
--- a/namedev.c
+++ b/namedev.c
@@ -36,6 +36,7 @@
#include "list.h"
#include "udev.h"
#include "udev_version.h"
+#include "logging.h"
#include "namedev.h"
#include "libsysfs/libsysfs.h"
#include "klibc_fixups.h"
@@ -285,12 +286,12 @@ static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device)
/* sleep to give the kernel a chance to create the file */
sleep(1);
}
- dbg("Timed out waiting for '%s' file, continuing on anyway...", b->file);
+ dbg("timed out waiting for '%s' file, continuing on anyway...", b->file);
goto exit;
}
b++;
}
- dbg("Did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus);
+ dbg("did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus);
exit:
return; /* here to prevent compiler warning... */
}
@@ -534,7 +535,7 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de
if (sysfs_device != NULL)
goto device_found;
}
- dbg("Timed out waiting for device symlink, continuing on anyway...");
+ dbg("timed out waiting for device symlink, continuing on anyway...");
device_found:
/* We have another issue with just the wait above - the sysfs part of
@@ -559,10 +560,10 @@ device_found:
if (sysfs_device->bus[0] != '\0')
goto bus_found;
}
- dbg("Timed out waiting to find the device bus, continuing on anyway\n");
+ dbg("timed out waiting to find the device bus, continuing on anyway");
goto exit;
bus_found:
- dbg("Device %s is registered with bus %s\n",
+ dbg("device %s is registered with bus '%s'",
sysfs_device->name, sysfs_device->bus);
}
exit:
@@ -694,7 +695,8 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud
}
/* Yup, this rule belongs to us! */
- dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name);
+ info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
+ udev_rules_filename, dev->config_line, udev->kernel_name, dev->name);
strfieldcpy(udev->name, dev->name);
strfieldcpy(udev->symlink, dev->symlink);
goto found;