diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-06-07 11:17:10 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-09-01 15:26:50 +1000 |
commit | 8764782f6de56a9dc5e9d5a8e9fb616a8ddb2f7c (patch) | |
tree | 3dee890358d47b0736493b472a748ff659ee3d09 | |
parent | b55ac354afa0f16f71bb4f2d3d4277c887082520 (diff) |
xfree86: add xf86IDrvMsg and friends for input driver logging.
Input driver messages are only standardised by convention, with the drivers
prefixing the device name to most messages. This makes it rather hard to
grep on "evdev" for example when looking for the evdev ouput.
This patch adds three new logging functions, modeled after xf86DrvMsg(), the
logging function for output drivers. New functions are
xf86IDrvMsg() - input driver log message in default verbosity.
xf86IDrvMsgVerb() - input driver log message in specified verbosity.
xf86VIDrvMsgVerb() - same as xf86IDrvMsgVerb() but takes a varargs
argument.
Default log format is <driver name>: <device name>: <message>.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | hw/xfree86/common/xf86Helper.c | 37 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Xinput.h | 11 |
2 files changed, 48 insertions, 0 deletions
diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index 8eccb22b6..8f5ca4579 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -1190,6 +1190,43 @@ xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) va_end(ap); } +/* Print input driver messages in the standard format of + <driver>: <device name>: <message> */ +void +xf86VIDrvMsgVerb(LocalDevicePtr dev, MessageType type, int verb, const char *format, + va_list args) +{ + char *msg; + + msg = Xprintf("%s: %s: %s", dev->drv->driverName, dev->name, format); + LogVMessageVerb(type, verb, "%s", msg); + free(msg); +} + +/* Print input driver message, with verbose level specified directly */ +void +xf86IDrvMsgVerb(LocalDevicePtr dev, MessageType type, int verb, const char *format, + ...) +{ + va_list ap; + + va_start(ap, format); + xf86VIDrvMsgVerb(dev, type, verb, format, ap); + va_end(ap); +} + +/* Print input driver messages, with verbose level of 1 (default) */ +void +xf86IDrvMsg(LocalDevicePtr dev, MessageType type, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + xf86VIDrvMsgVerb(dev, type, 1, format, ap); + va_end(ap); +} + + /* Print non-driver messages with verbose level specified directly */ void xf86MsgVerb(MessageType type, int verb, const char *format, ...) diff --git a/hw/xfree86/common/xf86Xinput.h b/hw/xfree86/common/xf86Xinput.h index 4851f8b85..943e181b2 100644 --- a/hw/xfree86/common/xf86Xinput.h +++ b/hw/xfree86/common/xf86Xinput.h @@ -192,6 +192,17 @@ extern _X_EXPORT InputDriverPtr xf86LookupInputDriver(const char *name); extern _X_EXPORT InputInfoPtr xf86LookupInput(const char *name); extern _X_EXPORT void xf86DeleteInput(InputInfoPtr pInp, int flags); extern _X_EXPORT void xf86MotionHistoryAllocate(LocalDevicePtr local); +extern _X_EXPORT void xf86IDrvMsgVerb(LocalDevicePtr dev, + MessageType type, int verb, + const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5); +extern _X_EXPORT void xf86IDrvMsg(LocalDevicePtr dev, + MessageType type, + const char *format, ...) _X_ATTRIBUTE_PRINTF(3,4); +extern _X_EXPORT void xf86VIDrvMsgVerb(LocalDevicePtr dev, + MessageType type, + int verb, + const char *format, + va_list args); /* xf86Option.c */ extern _X_EXPORT void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts, |