Commit dfee7c3f authored by Peter Hutterer's avatar Peter Hutterer

Replace xf86Msg with xf86IDrvMsg

xf86IDrvMsg automatically logs driver and device name.
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent f37c67fc
......@@ -77,8 +77,8 @@ EventDeviceOnHook(InputInfoPtr pInfo, SynapticsParameters *para)
int ret;
SYSCALL(ret = ioctl(pInfo->fd, EVIOCGRAB, (pointer)1));
if (ret < 0) {
xf86Msg(X_WARNING, "%s can't grab event device, errno=%d\n",
pInfo->name, errno);
xf86IDrvMsg(pInfo, X_WARNING, "can't grab event device, errno=%d\n",
errno);
}
}
......@@ -215,15 +215,16 @@ event_query_model(int fd, enum TouchpadModel *model_out, unsigned short *vendor_
* @return Zero on success, or errno otherwise.
*/
static int
event_get_abs(int fd, int code, int *min, int *max, int *fuzz, int *res)
event_get_abs(InputInfoPtr pInfo, int fd, int code,
int *min, int *max, int *fuzz, int *res)
{
int rc;
struct input_absinfo abs = {0};
SYSCALL(rc = ioctl(fd, EVIOCGABS(code), &abs));
if (rc < 0) {
xf86Msg(X_ERROR, "%s: EVIOCGABS error on %d (%s)\n",
__func__, code, strerror(rc));
xf86IDrvMsg(pInfo, X_ERROR, "%s EVIOCGABS error on %d (%s)\n",
__func__, code, strerror(rc));
return errno;
}
......@@ -254,10 +255,10 @@ event_query_axis_ranges(InputInfoPtr pInfo)
/* The kernel's fuzziness concept seems a bit weird, but it can more or
* less be applied as hysteresis directly, i.e. no factor here. */
event_get_abs(pInfo->fd, ABS_X, &priv->minx, &priv->maxx,
event_get_abs(pInfo, pInfo->fd, ABS_X, &priv->minx, &priv->maxx,
&priv->synpara.hyst_x, &priv->resx);
event_get_abs(pInfo->fd, ABS_Y, &priv->miny, &priv->maxy,
event_get_abs(pInfo, pInfo->fd, ABS_Y, &priv->miny, &priv->maxy,
&priv->synpara.hyst_y, &priv->resy);
priv->has_pressure = FALSE;
......@@ -269,15 +270,14 @@ event_query_axis_ranges(InputInfoPtr pInfo)
priv->has_width = (BitIsOn(absbits, ABS_TOOL_WIDTH) != 0);
}
else
xf86Msg(X_ERROR, "%s: failed to query ABS bits (%s)\n", pInfo->name,
strerror(errno));
xf86IDrvMsg(pInfo, X_ERROR, "failed to query ABS bits (%s)\n", strerror(errno));
if (priv->has_pressure)
event_get_abs(pInfo->fd, ABS_PRESSURE, &priv->minp, &priv->maxp,
event_get_abs(pInfo, pInfo->fd, ABS_PRESSURE, &priv->minp, &priv->maxp,
NULL, NULL);
if (priv->has_width)
event_get_abs(pInfo->fd, ABS_TOOL_WIDTH,
event_get_abs(pInfo, pInfo->fd, ABS_TOOL_WIDTH,
&priv->minw, &priv->maxw,
NULL, NULL);
......@@ -298,23 +298,22 @@ event_query_axis_ranges(InputInfoPtr pInfo)
}
/* Now print the device information */
xf86Msg(X_PROBED, "%s: x-axis range %d - %d\n", pInfo->name,
priv->minx, priv->maxx);
xf86Msg(X_PROBED, "%s: y-axis range %d - %d\n", pInfo->name,
priv->miny, priv->maxy);
xf86IDrvMsg(pInfo, X_PROBED, "x-axis range %d - %d\n",
priv->minx, priv->maxx);
xf86IDrvMsg(pInfo, X_PROBED, "y-axis range %d - %d\n",
priv->miny, priv->maxy);
if (priv->has_pressure)
xf86Msg(X_PROBED, "%s: pressure range %d - %d\n", pInfo->name,
priv->minp, priv->maxp);
xf86IDrvMsg(pInfo, X_PROBED, "pressure range %d - %d\n",
priv->minp, priv->maxp);
else
xf86Msg(X_INFO,
"%s: device does not report pressure, will use touch data.\n",
pInfo->name);
xf86IDrvMsg(pInfo, X_INFO,
"device does not report pressure, will use touch data.\n");
if (priv->has_width)
xf86Msg(X_PROBED, "%s: finger width range %d - %d\n", pInfo->name,
abs.minimum, abs.maximum);
xf86IDrvMsg(pInfo, X_PROBED, "finger width range %d - %d\n",
abs.minimum, abs.maximum);
else
xf86Msg(X_INFO,
"%s: device does not report finger width.\n", pInfo->name);
xf86IDrvMsg(pInfo, X_INFO,
"device does not report finger width.\n");
if (priv->has_left)
strcat(buf, " left");
......@@ -329,7 +328,7 @@ event_query_axis_ranges(InputInfoPtr pInfo)
if (priv->has_scrollbuttons)
strcat(buf, " scroll-buttons");
xf86Msg(X_PROBED, "%s: buttons:%s\n", pInfo->name, buf);
xf86IDrvMsg(pInfo, X_PROBED, "buttons:%s\n", buf);
}
static Bool
......@@ -341,7 +340,7 @@ EventQueryHardware(InputInfoPtr pInfo)
if (!event_query_is_touchpad(pInfo->fd, (proto_data) ? proto_data->need_grab : TRUE))
return FALSE;
xf86Msg(X_PROBED, "%s: touchpad found\n", pInfo->name);
xf86IDrvMsg(pInfo, X_PROBED, "touchpad found\n");
return TRUE;
}
......@@ -536,12 +535,11 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device)
i = scandir(DEV_INPUT_EVENT, &namelist, EventDevOnly, alphasort);
if (i < 0) {
xf86Msg(X_ERROR, "Couldn't open %s\n", DEV_INPUT_EVENT);
xf86IDrvMsg(pInfo, X_ERROR, "Couldn't open %s\n", DEV_INPUT_EVENT);
return FALSE;
}
else if (i == 0) {
xf86Msg(X_ERROR, "%s The /dev/input/event* device nodes seem to be missing\n",
pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "The /dev/input/event* device nodes seem to be missing\n");
free(namelist);
return FALSE;
}
......@@ -558,8 +556,8 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device)
if (event_query_is_touchpad(fd, TRUE)) {
touchpad_found = TRUE;
xf86Msg(X_PROBED, "%s auto-dev sets device to %s\n",
pInfo->name, fname);
xf86IDrvMsg(pInfo, X_PROBED, "auto-dev sets device to %s\n",
fname);
pInfo->options =
xf86ReplaceStrOption(pInfo->options, "Device", fname);
}
......@@ -571,7 +569,7 @@ EventAutoDevProbe(InputInfoPtr pInfo, const char *device)
free(namelist);
if (!touchpad_found) {
xf86Msg(X_ERROR, "%s no synaptics event device found\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "no synaptics event device found\n");
return FALSE;
}
......
......@@ -157,8 +157,8 @@ InitDeviceProperties(InputInfoPtr pInfo)
float_type = MakeAtom(XATOM_FLOAT, strlen(XATOM_FLOAT), TRUE);
if (!float_type)
{
xf86Msg(X_ERROR, "%s: Failed to init float atom. "
"Disabling property support.\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "Failed to init float atom. "
"Disabling property support.\n");
return;
}
}
......
......@@ -315,7 +315,7 @@ ps2_synaptics_disable_device(int fd)
}
static Bool
ps2_query_is_synaptics(int fd, struct PS2SynapticsHwInfo* synhw)
ps2_query_is_synaptics(InputInfoPtr pInfo, int fd, struct PS2SynapticsHwInfo* synhw)
{
int i;
......@@ -329,43 +329,43 @@ ps2_query_is_synaptics(int fd, struct PS2SynapticsHwInfo* synhw)
if (ps2_synaptics_identify(fd, synhw)) {
return TRUE;
} else {
xf86Msg(X_ERROR, "Query no Synaptics: %06X\n", synhw->identity);
xf86IDrvMsg(pInfo, X_ERROR, "Query no Synaptics: %06X\n", synhw->identity);
return FALSE;
}
}
void
ps2_print_ident(const struct PS2SynapticsHwInfo *synhw)
ps2_print_ident(InputInfoPtr pInfo, const struct PS2SynapticsHwInfo *synhw)
{
xf86Msg(X_PROBED, " Synaptics Touchpad, model: %d\n", SYN_ID_MODEL(synhw));
xf86Msg(X_PROBED, " Firmware: %d.%d\n", SYN_ID_MAJOR(synhw),
xf86IDrvMsg(pInfo, X_PROBED, " Synaptics Touchpad, model: %d\n", SYN_ID_MODEL(synhw));
xf86IDrvMsg(pInfo, X_PROBED, " Firmware: %d.%d\n", SYN_ID_MAJOR(synhw),
SYN_ID_MINOR(synhw));
if (SYN_MODEL_ROT180(synhw))
xf86Msg(X_PROBED, " 180 degree mounted touchpad\n");
xf86IDrvMsg(pInfo, X_PROBED, " 180 degree mounted touchpad\n");
if (SYN_MODEL_PORTRAIT(synhw))
xf86Msg(X_PROBED, " portrait touchpad\n");
xf86Msg(X_PROBED, " Sensor: %d\n", SYN_MODEL_SENSOR(synhw));
xf86IDrvMsg(pInfo, X_PROBED, " portrait touchpad\n");
xf86IDrvMsg(pInfo, X_PROBED, " Sensor: %d\n", SYN_MODEL_SENSOR(synhw));
if (SYN_MODEL_NEWABS(synhw))
xf86Msg(X_PROBED, " new absolute packet format\n");
xf86IDrvMsg(pInfo, X_PROBED, " new absolute packet format\n");
if (SYN_MODEL_PEN(synhw))
xf86Msg(X_PROBED, " pen detection\n");
xf86IDrvMsg(pInfo, X_PROBED, " pen detection\n");
if (SYN_CAP_EXTENDED(synhw)) {
xf86Msg(X_PROBED, " Touchpad has extended capability bits\n");
xf86IDrvMsg(pInfo, X_PROBED, " Touchpad has extended capability bits\n");
if (SYN_CAP_MULTI_BUTTON_NO(synhw))
xf86Msg(X_PROBED, " -> %d multi buttons, i.e. besides standard buttons\n",
xf86IDrvMsg(pInfo, X_PROBED, " -> %d multi buttons, i.e. besides standard buttons\n",
(int)(SYN_CAP_MULTI_BUTTON_NO(synhw)));
if (SYN_CAP_MIDDLE_BUTTON(synhw))
xf86Msg(X_PROBED, " -> middle button\n");
xf86IDrvMsg(pInfo, X_PROBED, " -> middle button\n");
if (SYN_CAP_FOUR_BUTTON(synhw))
xf86Msg(X_PROBED, " -> four buttons\n");
xf86IDrvMsg(pInfo, X_PROBED, " -> four buttons\n");
if (SYN_CAP_MULTIFINGER(synhw))
xf86Msg(X_PROBED, " -> multifinger detection\n");
xf86IDrvMsg(pInfo, X_PROBED, " -> multifinger detection\n");
if (SYN_CAP_PALMDETECT(synhw))
xf86Msg(X_PROBED, " -> palm detection\n");
xf86IDrvMsg(pInfo, X_PROBED, " -> palm detection\n");
if (SYN_CAP_PASSTHROUGH(synhw))
xf86Msg(X_PROBED, " -> pass-through port\n");
xf86IDrvMsg(pInfo, X_PROBED, " -> pass-through port\n");
}
}
......@@ -388,13 +388,13 @@ PS2QueryHardware(InputInfoPtr pInfo)
synhw = (struct PS2SynapticsHwInfo*)priv->proto_data;
/* is the synaptics touchpad active? */
if (!ps2_query_is_synaptics(pInfo->fd, synhw))
if (!ps2_query_is_synaptics(pInfo, pInfo->fd, synhw))
return FALSE;
xf86Msg(X_PROBED, "%s synaptics touchpad found\n", pInfo->name);
xf86IDrvMsg(pInfo, X_PROBED, "synaptics touchpad found\n");
if (!ps2_synaptics_reset(pInfo->fd))
xf86Msg(X_ERROR, "%s reset failed\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "reset failed\n");
if (!ps2_synaptics_identify(pInfo->fd, synhw))
return FALSE;
......@@ -415,7 +415,7 @@ PS2QueryHardware(InputInfoPtr pInfo)
ps2_synaptics_enable_device(pInfo->fd);
ps2_print_ident(synhw);
ps2_print_ident(pInfo, synhw);
return TRUE;
}
......@@ -476,7 +476,7 @@ ps2_synaptics_get_packet(InputInfoPtr pInfo, struct PS2SynapticsHwInfo *synhw,
/* to avoid endless loops */
if (count++ > 30) {
xf86Msg(X_ERROR, "Synaptics driver lost sync... got gigantic packet!\n");
xf86IDrvMsg(pInfo, X_ERROR, "Synaptics driver lost sync... got gigantic packet!\n");
return FALSE;
}
......@@ -529,9 +529,8 @@ PS2ReadHwStateProto(InputInfoPtr pInfo,
synhw = (struct PS2SynapticsHwInfo*)priv->proto_data;
if (!synhw)
{
xf86Msg(X_ERROR,
"%s: PS2ReadHwState, synhw is NULL. This is a bug.\n",
pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR,
"PS2ReadHwState, synhw is NULL. This is a bug.\n");
return FALSE;
}
......
......@@ -102,7 +102,7 @@ struct PS2SynapticsHwInfo {
};
Bool ps2_putbyte(int fd, byte b);
void ps2_print_ident(const struct PS2SynapticsHwInfo *synhw);
void ps2_print_ident(InputInfoPtr pInfo, const struct PS2SynapticsHwInfo *synhw);
Bool PS2ReadHwStateProto(InputInfoPtr pInfo,
struct SynapticsProtocolOperations *proto_ops,
struct CommData *comm, struct SynapticsHwState *hwRet);
......
......@@ -84,19 +84,19 @@ PSMQueryIsSynaptics(InputInfoPtr pInfo)
*/
SYSCALL(ret = ioctl(pInfo->fd, MOUSE_SETLEVEL, &level));
if (ret != 0) {
xf86Msg(X_ERROR, "%s Can't set native mode\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "%s Can't set native mode\n", pInfo->name);
return FALSE;
}
SYSCALL(ret = ioctl(pInfo->fd, MOUSE_GETHWINFO, &mhw));
if (ret != 0) {
xf86Msg(X_ERROR, "%s Can't get hardware info\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "%s Can't get hardware info\n", pInfo->name);
return FALSE;
}
if (mhw.model == MOUSE_MODEL_SYNAPTICS) {
return TRUE;
} else {
xf86Msg(X_ERROR, "%s Found no Synaptics, found Mouse model %d instead\n",
xf86IDrvMsg(pInfo, X_ERROR, "%s Found no Synaptics, found Mouse model %d instead\n",
pInfo->name, mhw.model);
return FALSE;
}
......@@ -143,14 +143,14 @@ PSMQueryHardware(InputInfoPtr pInfo)
if (!PSMQueryIsSynaptics(pInfo))
return FALSE;
xf86Msg(X_PROBED, "%s synaptics touchpad found\n", pInfo->name);
xf86IDrvMsg(pInfo, X_PROBED, "synaptics touchpad found\n");
if (!psm_synaptics_identify(pInfo->fd, &psm_ident))
return FALSE;
convert_hw_info(&psm_ident, synhw);
ps2_print_ident(synhw);
ps2_print_ident(pInfo, synhw);
return TRUE;
}
......
......@@ -212,9 +212,9 @@ SanitizeDimensions(InputInfoPtr pInfo)
priv->maxx = 5685;
priv->resx = 0;
xf86Msg(X_PROBED,
"%s: invalid x-axis range. defaulting to %d - %d\n",
pInfo->name, priv->minx, priv->maxx);
xf86IDrvMsg(pInfo, X_PROBED,
"invalid x-axis range. defaulting to %d - %d\n",
priv->minx, priv->maxx);
}
if (priv->miny >= priv->maxy)
......@@ -223,9 +223,9 @@ SanitizeDimensions(InputInfoPtr pInfo)
priv->maxy = 4171;
priv->resy = 0;
xf86Msg(X_PROBED,
"%s: invalid y-axis range. defaulting to %d - %d\n",
pInfo->name, priv->miny, priv->maxy);
xf86IDrvMsg(pInfo, X_PROBED,
"invalid y-axis range. defaulting to %d - %d\n",
priv->miny, priv->maxy);
}
if (priv->minp >= priv->maxp)
......@@ -233,9 +233,9 @@ SanitizeDimensions(InputInfoPtr pInfo)
priv->minp = 0;
priv->maxp = 256;
xf86Msg(X_PROBED,
"%s: invalid pressure range. defaulting to %d - %d\n",
pInfo->name, priv->minp, priv->maxp);
xf86IDrvMsg(pInfo, X_PROBED,
"invalid pressure range. defaulting to %d - %d\n",
priv->minp, priv->maxp);
}
if (priv->minw >= priv->maxw)
......@@ -243,9 +243,9 @@ SanitizeDimensions(InputInfoPtr pInfo)
priv->minw = 0;
priv->maxw = 16;
xf86Msg(X_PROBED,
"%s: invalid finger width range. defaulting to %d - %d\n",
pInfo->name, priv->minw, priv->maxw);
xf86IDrvMsg(pInfo, X_PROBED,
"invalid finger width range. defaulting to %d - %d\n",
priv->minw, priv->maxw);
}
}
......@@ -291,11 +291,11 @@ alloc_shm_data(InputInfoPtr pInfo)
shmctl(shmid, IPC_RMID, NULL);
if ((shmid = shmget(SHM_SYNAPTICS, sizeof(SynapticsSHM),
0774 | IPC_CREAT)) == -1) {
xf86Msg(X_ERROR, "%s error shmget\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "error shmget\n");
return FALSE;
}
if ((priv->synshm = (SynapticsSHM*)shmat(shmid, NULL, 0)) == NULL) {
xf86Msg(X_ERROR, "%s error shmat\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "error shmat\n");
return FALSE;
}
} else {
......@@ -574,8 +574,7 @@ static void set_default_parameters(InputInfoPtr pInfo)
int tmp = pars->top_edge;
pars->top_edge = pars->bottom_edge;
pars->bottom_edge = tmp;
xf86Msg(X_WARNING, "%s: TopEdge is bigger than BottomEdge. Fixing.\n",
pInfo->name);
xf86IDrvMsg(pInfo, X_WARNING, "TopEdge is bigger than BottomEdge. Fixing.\n");
}
}
......@@ -690,7 +689,7 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
/* may change pInfo->options */
SetDeviceAndProtocol(pInfo);
if (priv->proto_ops == NULL) {
xf86Msg(X_ERROR, "Synaptics driver unable to detect protocol\n");
xf86IDrvMsg(pInfo, X_ERROR, "Synaptics driver unable to detect protocol\n");
goto SetupProc_fail;
}
......@@ -699,7 +698,7 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
/* open the touchpad device */
pInfo->fd = xf86OpenSerial(pInfo->options);
if (pInfo->fd == -1) {
xf86Msg(X_ERROR, "Synaptics driver unable to open device\n");
xf86IDrvMsg(pInfo, X_ERROR, "Synaptics driver unable to open device\n");
goto SetupProc_fail;
}
xf86ErrorFVerb(6, "port opened successfully\n");
......@@ -731,7 +730,7 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
priv->comm.buffer = XisbNew(pInfo->fd, INPUT_BUFFER_SIZE);
if (!QueryHardware(pInfo)) {
xf86Msg(X_ERROR, "%s Unable to query/initialize Synaptics hardware.\n", pInfo->name);
xf86IDrvMsg(pInfo, X_ERROR, "Unable to query/initialize Synaptics hardware.\n");
goto SetupProc_fail;
}
......@@ -827,7 +826,7 @@ DeviceOn(DeviceIntPtr dev)
pInfo->fd = xf86OpenSerial(pInfo->options);
if (pInfo->fd == -1) {
xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name);
xf86IDrvMsg(pInfo, X_WARNING, "cannot open input device\n");
return !Success;
}
......@@ -992,8 +991,8 @@ DeviceInit(DeviceIntPtr dev)
* May be overridden in xf86InitValuatorDefaults */
tmpf = 1.0 / priv->synpara.min_speed;
xf86Msg(X_CONFIG, "%s: (accel) MinSpeed is now constant deceleration "
"%.1f\n", dev->name, tmpf);
xf86IDrvMsg(pInfo, X_CONFIG, "(accel) MinSpeed is now constant deceleration "
"%.1f\n", tmpf);
prop = XIGetKnownProperty(ACCEL_PROP_CONSTANT_DECELERATION);
XIChangeDeviceProperty(dev, prop, float_type, 32,
PropModeReplace, 1, &tmpf, FALSE);
......@@ -1006,10 +1005,10 @@ DeviceInit(DeviceIntPtr dev)
* 100 packet/s by default. */
pVel->corr_mul = 12.5f; /*1000[ms]/80[/s] = 12.5 */
xf86Msg(X_CONFIG, "%s: MaxSpeed is now %.2f\n",
dev->name, priv->synpara.max_speed);
xf86Msg(X_CONFIG, "%s: AccelFactor is now %.3f\n",
dev->name, priv->synpara.accl);
xf86IDrvMsg(pInfo, X_CONFIG, "MaxSpeed is now %.2f\n",
priv->synpara.max_speed);
xf86IDrvMsg(pInfo, X_CONFIG, "AccelFactor is now %.3f\n",
priv->synpara.accl);
prop = XIGetKnownProperty(ACCEL_PROP_PROFILE_NUMBER);
i = AccelProfileDeviceSpecific;
......@@ -2646,7 +2645,7 @@ QueryHardware(InputInfoPtr pInfo)
priv->comm.protoBufTail = 0;
if (!priv->proto_ops->QueryHardware(pInfo)) {
xf86Msg(X_PROBED, "%s: no supported touchpad found\n", pInfo->name);
xf86IDrvMsg(pInfo, X_PROBED, "no supported touchpad found\n");
if (priv->proto_ops->DeviceOffHook)
priv->proto_ops->DeviceOffHook(pInfo);
return FALSE;
......
......@@ -35,6 +35,10 @@
#define DBG(verb, msg, ...) /* */
#endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 12
#define xf86IDrvMsg(pInfo, type, ...) xf86Msg(type, __VA_ARGS__)
#endif
/******************************************************************************
* Definitions
* structs, typedefs, #defines, enums
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment