Commit 2429513915ee11e42e44068c1f8f66ff179cd534

  • avatar
  • Peter Hutterer <peter.hutterer @wh…t.net>
  • Thu Dec 24 00:01:05 CET 2009
Auto-prepend device name/file to debug messages.

Add a new "name" field to the WacomDeviceRec. This field is at the same
offset as the wcmDevice Field of the WacomCommonRec, hence the access to
either is the same if casted.

Then use this field to auto-prepend either the device name or the device
file wherever a DBG macro is used. The output for DBG on priv is now
(II) Wacom Intuos4 6x9 (xf86WcmMappingFactor): X factor = 0.0258, Y factor = 0.0309

and for DBG on common
(II) /dev/input/event13 (wcmReadPacket): buffer has 112 bytes

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  
360360 goto SetupProc_fail;
361361
362362 priv = (WacomDevicePtr) local->private;
363 priv->name = local->name;
363364 common = priv->common;
364365
365366 common->wcmDevice = device;
  
7777#define DBG(lvl, priv, ...) \
7878 do { \
7979 if ((lvl) <= priv->debugLevel) { \
80 xf86Msg(X_INFO, "%s: ", __func__); \
80 xf86Msg(X_INFO, "%s (%s): ", \
81 ((WacomDeviceRec*)priv)->name, __func__); \
8182 xf86Msg(X_NONE, __VA_ARGS__); \
8283 } \
8384 } while (0)
  
159159
160160struct _WacomDeviceRec
161161{
162 char *name; /* Do not move, same offset as common->wcmDevice */
162163 /* configuration fields */
163164 struct _WacomDeviceRec *next;
164165 LocalDevicePtr local;
371371
372372struct _WacomCommonRec
373373{
374 /* Do not move wcmDevice, same offset as priv->name */
374375 char* wcmDevice; /* device file name */
375376 dev_t min_maj; /* minor/major number */
376377 unsigned char wcmFlags; /* various flags (handle tilt) */