kill trailing white space.

This commit is contained in:
matthieu 2010-07-25 19:53:35 +00:00
parent 67355d758b
commit 9f50d18e65

View File

@ -24,7 +24,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
/* $OpenBSD: usbtablet.c,v 1.9 2010/07/25 19:52:23 matthieu Exp $ */ /* $OpenBSD: usbtablet.c,v 1.10 2010/07/25 19:53:35 matthieu Exp $ */
/* /*
* Driver for USB HID tablet devices. * Driver for USB HID tablet devices.
@ -88,7 +88,7 @@ typedef struct {
hid_item_t hidInvert; hid_item_t hidInvert;
int reportSize; int reportSize;
int reportId; int reportId;
int nSwitch; int nSwitch;
USBTDevicePtr currentProxDev; USBTDevicePtr currentProxDev;
} USBTCommon, *USBTCommonPtr; } USBTCommon, *USBTCommonPtr;
@ -151,7 +151,7 @@ InputDriverRec USBTABLET = {
0 0
}; };
/* /*
* Debugging macro * Debugging macro
*/ */
#ifdef DBG #ifdef DBG
@ -184,19 +184,19 @@ SetupProc(pointer module,
if (!Initialised) { if (!Initialised) {
Initialised = TRUE; Initialised = TRUE;
xf86Msg(X_INFO, "USB Tablet driver\n"); xf86Msg(X_INFO, "USB Tablet driver\n");
xf86AddInputDriver(&USBTABLET, module, 0); xf86AddInputDriver(&USBTABLET, module, 0);
} }
return module; return module;
} }
static void static void
TearDownProc(pointer p) TearDownProc(pointer p)
{ {
DBG(1, ErrorF("USB Tablet TearDownProc Called\n")); DBG(1, ErrorF("USB Tablet TearDownProc Called\n"));
} }
static int static int
UsbTabletProc(DeviceIntPtr pUSBT, int what) UsbTabletProc(DeviceIntPtr pUSBT, int what)
@ -222,35 +222,35 @@ UsbTabletProc(DeviceIntPtr pUSBT, int what)
btn_labels, btn_labels,
#endif #endif
map) == FALSE) { map) == FALSE) {
xf86Msg(X_ERROR, xf86Msg(X_ERROR,
"unable to allocate Button class device\n"); "unable to allocate Button class device\n");
return !Success; return !Success;
} }
if (InitFocusClassDeviceStruct(pUSBT) == FALSE) { if (InitFocusClassDeviceStruct(pUSBT) == FALSE) {
xf86Msg(X_ERROR, xf86Msg(X_ERROR,
"unable to init Focus class device\n"); "unable to init Focus class device\n");
return !Success; return !Success;
} }
if (InitProximityClassDeviceStruct(pUSBT) == FALSE) { if (InitProximityClassDeviceStruct(pUSBT) == FALSE) {
xf86Msg(X_ERROR, xf86Msg(X_ERROR,
"unable to init proximity class device\n"); "unable to init proximity class device\n");
return !Success; return !Success;
} }
if (InitValuatorClassDeviceStruct( if (InitValuatorClassDeviceStruct(
pUSBT, NAXES, pUSBT, NAXES,
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 7
axes_labels, axes_labels,
#endif #endif
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 #if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3
xf86GetMotionEvents, xf86GetMotionEvents,
#endif #endif
pInfo->history_size, pInfo->history_size,
((priv->flags & ABSOLUTE_FLAG) ? Absolute : Relative) | ((priv->flags & ABSOLUTE_FLAG) ? Absolute : Relative) |
OutOfProximity) == FALSE) { OutOfProximity) == FALSE) {
xf86Msg(X_ERROR, xf86Msg(X_ERROR,
"unable to allocate Valuator class device\n"); "unable to allocate Valuator class device\n");
return !Success; return !Success;
} else { } else {
/* allocate the motion history buffer if needed */ /* allocate the motion history buffer if needed */
@ -271,7 +271,7 @@ UsbTabletProc(DeviceIntPtr pUSBT, int what)
} }
xf86AddEnabledDevice(pInfo); xf86AddEnabledDevice(pInfo);
pUSBT->public.on = TRUE; pUSBT->public.on = TRUE;
break; break;
case DEVICE_OFF: case DEVICE_OFF:
DBG(1, ErrorF("UsbTabletProc DEVICE_OFF\n")); DBG(1, ErrorF("UsbTabletProc DEVICE_OFF\n"));
@ -286,7 +286,7 @@ UsbTabletProc(DeviceIntPtr pUSBT, int what)
DBG(1, ErrorF("UsbTabletProc DEVICE_CLOSE\n")); DBG(1, ErrorF("UsbTabletProc DEVICE_CLOSE\n"));
UsbTabletClose(pInfo); UsbTabletClose(pInfo);
break; break;
default: default:
xf86Msg(X_ERROR, "UsbTabletProc: unsupported mode %d\n", xf86Msg(X_ERROR, "UsbTabletProc: unsupported mode %d\n",
what); what);
@ -303,7 +303,7 @@ UsbTabletReadInput(InputInfoPtr pInfo)
int invert, len, i; int invert, len, i;
unsigned char buffer[200], *p; unsigned char buffer[200], *p;
USBTState ds; USBTState ds;
DBG(7, ErrorF("UsbTabletReadInput BEGIN device=%s fd=%d\n", DBG(7, ErrorF("UsbTabletReadInput BEGIN device=%s fd=%d\n",
comm->devName, pInfo->fd)); comm->devName, pInfo->fd));
@ -314,14 +314,14 @@ UsbTabletReadInput(InputInfoPtr pInfo)
len = xf86ReadSerial(pInfo->fd, p, comm->reportSize); len = xf86ReadSerial(pInfo->fd, p, comm->reportSize);
DBG(8, ErrorF("UsbTabletReadInput len=%d\n", len)); DBG(8, ErrorF("UsbTabletReadInput len=%d\n", len));
if (len <= 0) { if (len <= 0) {
if (errno != EAGAIN) { if (errno != EAGAIN) {
Error("error reading USBT device"); Error("error reading USBT device");
} }
break; break;
} }
ds.x = hid_get_data(p, &comm->hidX); ds.x = hid_get_data(p, &comm->hidX);
ds.y = hid_get_data(p, &comm->hidY); ds.y = hid_get_data(p, &comm->hidY);
ds.buttons = 0; ds.buttons = 0;
@ -368,13 +368,13 @@ UsbTabletOutOfProx(USBTDevicePtr prx)
if (prx->state.buttons) { if (prx->state.buttons) {
/* Report buttons up when the device goes out of proximity. */ /* Report buttons up when the device goes out of proximity. */
DBG(9, ErrorF("xf86USBTOutOfProx: reset buttons\n")); DBG(9, ErrorF("xf86USBTOutOfProx: reset buttons\n"));
UsbTabletSendButtons(prx->info, 0, UsbTabletSendButtons(prx->info, 0,
ods->x, ods->y, ods->pressure, ods->x, ods->y, ods->pressure,
ods->xTilt, ods->yTilt); ods->xTilt, ods->yTilt);
prx->state.buttons = 0; prx->state.buttons = 0;
} }
DBG(1, ErrorF("xf86USBTSendEvents: out proximity\n")); DBG(1, ErrorF("xf86USBTSendEvents: out proximity\n"));
xf86PostProximityEvent(prx->info->dev, 0, 0, 5, xf86PostProximityEvent(prx->info->dev, 0, 0, 5,
ods->x, ods->y, ods->pressure, ods->x, ods->y, ods->pressure,
ods->xTilt, ods->yTilt); ods->xTilt, ods->yTilt);
} }
@ -390,14 +390,14 @@ UsbTabletIntoProx(USBTDevicePtr prx, USBTState *ds)
DBG(1, ErrorF("Into proximity %s\n", prx->info->name)); DBG(1, ErrorF("Into proximity %s\n", prx->info->name));
DBG(1, ErrorF("xf86USBTSendEvents: in proximity\n")); DBG(1, ErrorF("xf86USBTSendEvents: in proximity\n"));
xf86PostProximityEvent(prx->info->dev, 1, 0, 5, xf86PostProximityEvent(prx->info->dev, 1, 0, 5,
ds->x, ds->y, ds->pressure, ds->x, ds->y, ds->pressure,
ds->xTilt, ds->yTilt); ds->xTilt, ds->yTilt);
} }
static void static void
UsbTabletSendButtons(InputInfoPtr pInfo, int buttons, UsbTabletSendButtons(InputInfoPtr pInfo, int buttons,
int rx, int ry, int rz, int rx, int ry, int rz,
int rtx, int rty) int rtx, int rty)
{ {
@ -406,9 +406,9 @@ UsbTabletSendButtons(InputInfoPtr pInfo, int buttons,
for (button = 1; button < NBUTTONS; button++) { for (button = 1; button < NBUTTONS; button++) {
mask = 1 << (button-1); mask = 1 << (button-1);
if ((mask & priv->state.buttons) != (mask & buttons)) { if ((mask & priv->state.buttons) != (mask & buttons)) {
DBG(4, ErrorF("UsbTabletSendButtons button=%d is %d\n", DBG(4, ErrorF("UsbTabletSendButtons button=%d is %d\n",
button, (buttons & mask) != 0)); button, (buttons & mask) != 0));
xf86PostButtonEvent(pInfo->dev, xf86PostButtonEvent(pInfo->dev,
(priv->flags & ABSOLUTE_FLAG), (priv->flags & ABSOLUTE_FLAG),
@ -453,18 +453,18 @@ UsbTabletSendEvents(InputInfoPtr pInfo, int invert, USBTState *ds)
is_abs = 1; is_abs = 1;
/* XXX scaling done here, since Xorg 7.3 does not call UsbTabletConvert */ /* XXX scaling done here, since Xorg 7.3 does not call UsbTabletConvert */
rx = ds->x * comm->factorX; ry = ds->y * comm->factorY; rx = ds->x * comm->factorX; ry = ds->y * comm->factorY;
rz = ds->pressure; rz = ds->pressure;
rtx = ds->xTilt; rty = ds->yTilt; rtx = ds->xTilt; rty = ds->yTilt;
if (rx != ods->x || ry != ods->y || rz != ods->pressure || if (rx != ods->x || ry != ods->y || rz != ods->pressure ||
rtx != ods->xTilt || rty != ods->yTilt) { rtx != ods->xTilt || rty != ods->yTilt) {
DBG(9, ErrorF("UsbTabletSendEvents: motion\n")); DBG(9, ErrorF("UsbTabletSendEvents: motion\n"));
xf86PostMotionEvent(pInfo->dev, is_abs, 0, 5, xf86PostMotionEvent(pInfo->dev, is_abs, 0, 5,
rx, ry, rz, rtx, rty); rx, ry, rz, rtx, rty);
} }
if (ds->buttons != ods->buttons) if (ds->buttons != ods->buttons)
UsbTabletSendButtons(pInfo, ds->buttons, UsbTabletSendButtons(pInfo, ds->buttons,
rx, ry, rz, rtx, rty); rx, ry, rz, rtx, rty);
*ods = *ds; *ods = *ds;
@ -476,16 +476,16 @@ UsbTabletClose(InputInfoPtr pInfo)
USBTDevicePtr priv = (USBTDevicePtr)pInfo->private; USBTDevicePtr priv = (USBTDevicePtr)pInfo->private;
USBTCommonPtr comm = priv->comm; USBTCommonPtr comm = priv->comm;
int num, i; int num, i;
for (num = 0, i = 0; i < comm->nDevs; i++) for (num = 0, i = 0; i < comm->nDevs; i++)
if (comm->devices[i]->fd >= 0) if (comm->devices[i]->fd >= 0)
num++; num++;
DBG(4, ErrorF("USB tablet number of open devices = %d\n", num)); DBG(4, ErrorF("USB tablet number of open devices = %d\n", num));
if (num == 1) { if (num == 1) {
SYSCALL(close(pInfo->fd)); SYSCALL(close(pInfo->fd));
} }
pInfo->fd = -1; pInfo->fd = -1;
} }
@ -504,7 +504,7 @@ UsbTabletOpen(InputInfoPtr pInfo)
DBG(1, ErrorF("opening %s\n", comm->devName)); DBG(1, ErrorF("opening %s\n", comm->devName));
for (dev = comm->devices[0]; dev != NULL; dev = dev->next) { for (dev = comm->devices[0]; dev != NULL; dev = dev->next) {
if (dev->fd != -1 && dev != pInfo) if (dev->fd != -1 && dev != pInfo)
pInfo->fd = dev->fd; pInfo->fd = dev->fd;
} }
if (pInfo->fd != -1) { if (pInfo->fd != -1) {
@ -521,20 +521,20 @@ UsbTabletOpen(InputInfoPtr pInfo)
} }
SYSCALL(r = ioctl(pInfo->fd, USB_GET_REPORT_ID, &comm->reportId)); SYSCALL(r = ioctl(pInfo->fd, USB_GET_REPORT_ID, &comm->reportId));
if (r == -1) { if (r == -1) {
ErrorF("Error ioctl USB_GET_REPORT_ID on %s : %s\n", ErrorF("Error ioctl USB_GET_REPORT_ID on %s : %s\n",
comm->devName, strerror(errno)); comm->devName, strerror(errno));
return !Success; return !Success;
} }
DBG(1, ErrorF("initializing tablet\n")); DBG(1, ErrorF("initializing tablet\n"));
rd = hid_get_report_desc(pInfo->fd); rd = hid_get_report_desc(pInfo->fd);
if (rd == 0) { if (rd == 0) {
Error(comm->devName); Error(comm->devName);
SYSCALL(close(pInfo->fd)); SYSCALL(close(pInfo->fd));
return !Success; return !Success;
} }
memset(&comm->hidX, 0, sizeof (hid_item_t)); memset(&comm->hidX, 0, sizeof (hid_item_t));
memset(&comm->hidY, 0, sizeof (hid_item_t)); memset(&comm->hidY, 0, sizeof (hid_item_t));
memset(&comm->hidTiltX, 0, sizeof (hid_item_t)); memset(&comm->hidTiltX, 0, sizeof (hid_item_t));
@ -545,7 +545,7 @@ UsbTabletOpen(InputInfoPtr pInfo)
for (i = 0; i < NBUTTONS; i++) { for (i = 0; i < NBUTTONS; i++) {
memset(&comm->hidBarrel_Switch[i], 0, sizeof (hid_item_t)); memset(&comm->hidBarrel_Switch[i], 0, sizeof (hid_item_t));
} }
for (d = hid_start_parse(rd, 1<<hid_input, comm->reportId); for (d = hid_start_parse(rd, 1<<hid_input, comm->reportId);
hid_get_item(d, &h); ) { hid_get_item(d, &h); ) {
if (h.kind != hid_input || (h.flags & HIO_CONST)) if (h.kind != hid_input || (h.flags & HIO_CONST))
continue; continue;
@ -573,24 +573,24 @@ UsbTabletOpen(InputInfoPtr pInfo)
if (comm->hidX.report_size == 0 || if (comm->hidX.report_size == 0 ||
comm->hidY.report_size == 0 || comm->hidY.report_size == 0 ||
comm->hidIn_Range.report_size == 0) { comm->hidIn_Range.report_size == 0) {
xf86Msg(X_ERROR, "%s has no X, Y, or In_Range report\n", xf86Msg(X_ERROR, "%s has no X, Y, or In_Range report\n",
comm->devName); comm->devName);
return !Success; return !Success;
} }
DBG(2, ErrorF("Found X at %d, size=%d\n", DBG(2, ErrorF("Found X at %d, size=%d\n",
comm->hidX.pos, comm->hidX.report_size)); comm->hidX.pos, comm->hidX.report_size));
DBG(2, ErrorF("Found Y at %d, size=%d\n", DBG(2, ErrorF("Found Y at %d, size=%d\n",
comm->hidY.pos, comm->hidY.report_size)); comm->hidY.pos, comm->hidY.report_size));
DBG(2, ErrorF("Found Invert at %d, size=%d\n", DBG(2, ErrorF("Found Invert at %d, size=%d\n",
comm->hidInvert.pos, comm->hidInvert.report_size)); comm->hidInvert.pos, comm->hidInvert.report_size));
DBG(2, ErrorF("Found In_Range at %d, size=%d\n", DBG(2, ErrorF("Found In_Range at %d, size=%d\n",
comm->hidIn_Range.pos, comm->hidIn_Range.report_size)); comm->hidIn_Range.pos, comm->hidIn_Range.report_size));
DBG(2, ErrorF("Found Tip_Pressure at %d, size=%d\n", DBG(2, ErrorF("Found Tip_Pressure at %d, size=%d\n",
comm->hidTip_Pressure.pos, comm->hidTip_Pressure.pos,
comm->hidTip_Pressure.report_size)); comm->hidTip_Pressure.report_size));
for (i = 0; i < comm->nSwitch; i++) { for (i = 0; i < comm->nSwitch; i++) {
DBG(2, ErrorF("Found Barrel_Switch at %d, size=%d\n", DBG(2, ErrorF("Found Barrel_Switch at %d, size=%d\n",
comm->hidBarrel_Switch[i].pos, comm->hidBarrel_Switch[i].pos,
comm->hidBarrel_Switch[i].report_size)); comm->hidBarrel_Switch[i].report_size));
} }
DBG(2, ErrorF("Report size=%d, report id=%d\n", DBG(2, ErrorF("Report size=%d, report id=%d\n",
@ -600,18 +600,18 @@ UsbTabletOpen(InputInfoPtr pInfo)
/ (comm->hidX.logical_maximum - comm->hidX.logical_minimum); / (comm->hidX.logical_maximum - comm->hidX.logical_minimum);
comm->factorY = ((double) screenInfo.screens[0]->height) comm->factorY = ((double) screenInfo.screens[0]->height)
/ (comm->hidY.logical_maximum - comm->hidY.logical_minimum); / (comm->hidY.logical_maximum - comm->hidY.logical_minimum);
xf86Msg(X_PROBED, "USBT tablet X=%d..%d, Y=%d..%d", xf86Msg(X_PROBED, "USBT tablet X=%d..%d, Y=%d..%d",
comm->hidX.logical_minimum, comm->hidX.logical_minimum,
comm->hidX.logical_maximum, comm->hidX.logical_maximum,
comm->hidY.logical_minimum, comm->hidY.logical_minimum,
comm->hidY.logical_maximum); comm->hidY.logical_maximum);
if (comm->hidTip_Pressure.report_size != 0) if (comm->hidTip_Pressure.report_size != 0)
xf86Msg(X_NONE, ", pressure=%d..%d", xf86Msg(X_NONE, ", pressure=%d..%d",
comm->hidTip_Pressure.logical_minimum, comm->hidTip_Pressure.logical_minimum,
comm->hidTip_Pressure.logical_maximum); comm->hidTip_Pressure.logical_maximum);
xf86Msg(X_NONE, "\n"); xf86Msg(X_NONE, "\n");
return Success; return Success;
} }
@ -626,7 +626,7 @@ UsbTabletOpenDevice(DeviceIntPtr pUSBT)
Atom axes_labels[NAXES] = {0}; Atom axes_labels[NAXES] = {0};
#endif #endif
hid_item_t *h = &comm->hidTip_Pressure; hid_item_t *h = &comm->hidTip_Pressure;
DBG(1, ErrorF("UsbTabletOpenDevice start\n")); DBG(1, ErrorF("UsbTabletOpenDevice start\n"));
if (pInfo->fd < 0) { if (pInfo->fd < 0) {
DBG(2, ErrorF("UsbTabletOpenDevice really open\n")); DBG(2, ErrorF("UsbTabletOpenDevice really open\n"));
@ -643,15 +643,15 @@ UsbTabletOpenDevice(DeviceIntPtr pUSBT)
} }
} }
priv->threshold = priv->threshold =
h->logical_minimum + h->logical_minimum +
(h->logical_maximum - h->logical_minimum) * priv->thresCent / 100; (h->logical_maximum - h->logical_minimum) * priv->thresCent / 100;
if (h->report_size != 0) if (h->report_size != 0)
xf86Msg(X_PROBED, xf86Msg(X_PROBED,
"USBT %s pressure threshold=%d, suppress=%d\n", "USBT %s pressure threshold=%d, suppress=%d\n",
pInfo->name, priv->threshold, priv->suppress); pInfo->name, priv->threshold, priv->suppress);
/* Set the real values */ /* Set the real values */
/* XXX scaling done here, since Xorg 7.3 does not call UsbTabletConvert */ /* XXX scaling done here, since Xorg 7.3 does not call UsbTabletConvert */
InitValuatorAxisStruct(pUSBT, InitValuatorAxisStruct(pUSBT,
@ -713,16 +713,16 @@ UsbTabletAllocate(InputDriverPtr drv, char *name, int flag)
InputInfoPtr pInfo = xf86AllocateInput(drv, 0); InputInfoPtr pInfo = xf86AllocateInput(drv, 0);
USBTDevicePtr priv; USBTDevicePtr priv;
USBTCommonPtr comm; USBTCommonPtr comm;
if (pInfo == NULL) { if (pInfo == NULL) {
return NULL; return NULL;
} }
priv = (USBTDevicePtr)xalloc(sizeof(USBTDevice)); priv = (USBTDevicePtr)xalloc(sizeof(USBTDevice));
if (priv == NULL) { if (priv == NULL) {
return NULL; return NULL;
} }
comm = (USBTCommonPtr)xalloc(sizeof(USBTCommon)); comm = (USBTCommonPtr)xalloc(sizeof(USBTCommon));
if (comm == NULL) { if (comm == NULL) {
xfree(priv); xfree(priv);
@ -730,7 +730,7 @@ UsbTabletAllocate(InputDriverPtr drv, char *name, int flag)
} }
memset(priv, 0, sizeof *priv); memset(priv, 0, sizeof *priv);
memset(comm, 0, sizeof *comm); memset(comm, 0, sizeof *comm);
pInfo->name = name; pInfo->name = name;
pInfo->device_control = UsbTabletProc; pInfo->device_control = UsbTabletProc;
pInfo->read_input = UsbTabletReadInput; pInfo->read_input = UsbTabletReadInput;
@ -742,17 +742,17 @@ UsbTabletAllocate(InputDriverPtr drv, char *name, int flag)
pInfo->private = priv; pInfo->private = priv;
pInfo->old_x = -1; pInfo->old_x = -1;
pInfo->old_y = -1; pInfo->old_y = -1;
priv->info = pInfo; priv->info = pInfo;
priv->comm = comm; priv->comm = comm;
priv->flags = ABSOLUTE_FLAG | flag; priv->flags = ABSOLUTE_FLAG | flag;
priv->suppress = 2; priv->suppress = 2;
priv->thresCent = 5; priv->thresCent = 5;
comm->nDevs = 1; comm->nDevs = 1;
comm->devices = (InputInfoPtr*)xalloc(sizeof(InputInfoPtr)); comm->devices = (InputInfoPtr*)xalloc(sizeof(InputInfoPtr));
comm->devices[0] = pInfo; comm->devices[0] = pInfo;
return pInfo; return pInfo;
} }
@ -760,7 +760,7 @@ static InputInfoPtr
UsbTabletAllocateStylus(InputDriverPtr drv) UsbTabletAllocateStylus(InputDriverPtr drv)
{ {
InputInfoPtr pInfo = UsbTabletAllocate(drv, STYLUS_XI, STYLUS_ID); InputInfoPtr pInfo = UsbTabletAllocate(drv, STYLUS_XI, STYLUS_ID);
if (pInfo == NULL) { if (pInfo == NULL) {
return NULL; return NULL;
} }
@ -772,7 +772,7 @@ static InputInfoPtr
UsbTabletAllocateEraser(InputDriverPtr drv) UsbTabletAllocateEraser(InputDriverPtr drv)
{ {
InputInfoPtr pInfo = UsbTabletAllocate(drv, ERASER_XI, ERASER_ID); InputInfoPtr pInfo = UsbTabletAllocate(drv, ERASER_XI, ERASER_ID);
if (pInfo == NULL) { if (pInfo == NULL) {
return NULL; return NULL;
} }
@ -780,8 +780,8 @@ UsbTabletAllocateEraser(InputDriverPtr drv)
return pInfo; return pInfo;
} }
/* /*
* Called when the InputDevice Section is found in XF86Config * Called when the InputDevice Section is found in XF86Config
*/ */
static InputInfoPtr static InputInfoPtr
UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags) UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
@ -801,7 +801,7 @@ UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
fake->conf_idev = dev; fake->conf_idev = dev;
xf86CollectInputOptions(fake, NULL, NULL); xf86CollectInputOptions(fake, NULL, NULL);
s = xf86FindOptionValue(fake->options, "Type"); s = xf86FindOptionValue(fake->options, "Type");
if (s != NULL) { if (s != NULL) {
if (xf86NameCmp(s, "stylus") == 0) { if (xf86NameCmp(s, "stylus") == 0) {
pInfo = UsbTabletAllocateStylus(drv); pInfo = UsbTabletAllocateStylus(drv);
@ -834,12 +834,12 @@ UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
comm->devName = xf86FindOptionValue(pInfo->options, "Device"); comm->devName = xf86FindOptionValue(pInfo->options, "Device");
if (comm->devName == NULL) { if (comm->devName == NULL) {
xf86Msg(X_ERROR, "%s: No Device specified.\n", xf86Msg(X_ERROR, "%s: No Device specified.\n",
dev->identifier); dev->identifier);
goto PreInit_fail; goto PreInit_fail;
} }
/* Lookup to see if there is another device sharing /* Lookup to see if there is another device sharing
* the same device * the same device
*/ */
localDevices = xf86FirstLocalDevice(); localDevices = xf86FirstLocalDevice();
@ -848,7 +848,7 @@ UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
p = (USBTDevicePtr)localDevices->private; p = (USBTDevicePtr)localDevices->private;
c = p->comm; c = p->comm;
if ((pInfo != localDevices) && if ((pInfo != localDevices) &&
(localDevices->device_control == UsbTabletProc) && (localDevices->device_control == UsbTabletProc) &&
(strcmp(c->devName, comm->devName) == 0)) { (strcmp(c->devName, comm->devName) == 0)) {
DBG(2, ErrorF("UsbTabletPreInit port share between" DBG(2, ErrorF("UsbTabletPreInit port share between"
@ -859,7 +859,7 @@ UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
comm = priv->comm = c; comm = priv->comm = c;
comm->nDevs++; comm->nDevs++;
comm->devices = (InputInfoPtr *) comm->devices = (InputInfoPtr *)
xrealloc(comm->devices, xrealloc(comm->devices,
sizeof(InputInfoPtr)* comm->nDevs); sizeof(InputInfoPtr)* comm->nDevs);
comm->devices[comm->nDevs - 1] = pInfo; comm->devices[comm->nDevs - 1] = pInfo;
break; break;
@ -872,7 +872,7 @@ UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
xf86Msg(X_CONFIG, "%s device is %s\n", dev->identifier, comm->devName); xf86Msg(X_CONFIG, "%s device is %s\n", dev->identifier, comm->devName);
/* XXX Handle options */ /* XXX Handle options */
debug_level = xf86SetIntOption(pInfo->options, "DebugLevel", debug_level = xf86SetIntOption(pInfo->options, "DebugLevel",
debug_level); debug_level);
if (debug_level > 0) { if (debug_level > 0) {
xf86Msg(X_CONFIG, "UsbTablet: debug level set to %d\n", xf86Msg(X_CONFIG, "UsbTablet: debug level set to %d\n",
@ -891,10 +891,10 @@ UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
"Using default.\n", dev->identifier); "Using default.\n", dev->identifier);
} }
} }
xf86Msg(X_CONFIG, "%s is in %s mode\n", pInfo->name, xf86Msg(X_CONFIG, "%s is in %s mode\n", pInfo->name,
(priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative");
#if 0 #if 0
pInfo->history_size = xf86SetIntOption(pInfo->options, "HistorySize", pInfo->history_size = xf86SetIntOption(pInfo->options, "HistorySize",
pInfo->history_size); pInfo->history_size);
@ -902,15 +902,15 @@ UsbTabletPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
i = xf86SetIntOption(pInfo->options, "ThreshHold", -1); i = xf86SetIntOption(pInfo->options, "ThreshHold", -1);
if (i != -1) { if (i != -1) {
priv->thresCent = i; priv->thresCent = i;
} }
xf86Msg(i != -1 ? X_CONFIG : X_DEFAULT, "%s: threshold = %d\n", xf86Msg(i != -1 ? X_CONFIG : X_DEFAULT, "%s: threshold = %d\n",
dev->identifier, priv->thresCent); dev->identifier, priv->thresCent);
i = xf86SetIntOption(pInfo->options, "Suppress", -1); i = xf86SetIntOption(pInfo->options, "Suppress", -1);
if (i != -1) { if (i != -1) {
priv->suppress = i; priv->suppress = i;
} }
xf86Msg(i != -1 ? X_CONFIG : X_DEFAULT, "%s: suppress = %d\n", xf86Msg(i != -1 ? X_CONFIG : X_DEFAULT, "%s: suppress = %d\n",
dev->identifier, priv->suppress); dev->identifier, priv->suppress);