2006-11-26 11:13:41 -07:00
|
|
|
/************************************************************
|
|
|
|
|
|
|
|
Copyright 1989, 1998 The Open Group
|
|
|
|
|
|
|
|
Permission to use, copy, modify, distribute, and sell this software and its
|
|
|
|
documentation for any purpose is hereby granted without fee, provided that
|
|
|
|
the above copyright notice appear in all copies and that both that
|
|
|
|
copyright notice and this permission notice appear in supporting
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
Except as contained in this notice, the name of The Open Group shall not be
|
|
|
|
used in advertising or otherwise to promote the sale, use or other dealings
|
|
|
|
in this Software without prior written authorization from The Open Group.
|
|
|
|
|
|
|
|
Copyright 1989 by Hewlett-Packard Company, Palo Alto, California.
|
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
|
|
|
provided that the above copyright notice appear in all copies and that
|
|
|
|
both that copyright notice and this permission notice appear in
|
|
|
|
supporting documentation, and that the name of Hewlett-Packard not be
|
|
|
|
used in advertising or publicity pertaining to distribution of the
|
|
|
|
software without specific, written prior permission.
|
|
|
|
|
|
|
|
HEWLETT-PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
|
|
|
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
|
|
|
HEWLETT-PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
|
|
|
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
|
|
|
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
|
|
|
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
|
|
SOFTWARE.
|
|
|
|
|
|
|
|
********************************************************/
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* Extension function to list the available input devices.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_DIX_CONFIG_H
|
|
|
|
#include <dix-config.h>
|
|
|
|
#endif
|
|
|
|
|
2012-06-10 07:21:05 -06:00
|
|
|
#include <X11/X.h> /* for inputstr.h */
|
|
|
|
#include <X11/Xproto.h> /* Request macro */
|
|
|
|
#include "inputstr.h" /* DeviceIntPtr */
|
2006-11-26 11:13:41 -07:00
|
|
|
#include <X11/extensions/XI.h>
|
|
|
|
#include <X11/extensions/XIproto.h>
|
|
|
|
#include "XIstubs.h"
|
|
|
|
#include "extnsionst.h"
|
2009-09-06 13:44:18 -06:00
|
|
|
#include "exevents.h"
|
2008-11-02 08:26:08 -07:00
|
|
|
#include "xace.h"
|
2010-07-27 13:02:24 -06:00
|
|
|
#include "xkbsrv.h"
|
|
|
|
#include "xkbstr.h"
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
#include "listdev.h"
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure lists the input devices available to the server.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2007-11-24 10:55:21 -07:00
|
|
|
SProcXListInputDevices(ClientPtr client)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
REQUEST(xListInputDevicesReq);
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&stuff->length);
|
2006-11-26 11:13:41 -07:00
|
|
|
return (ProcXListInputDevices(client));
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure calculates the size of the information to be returned
|
|
|
|
* for an input device.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
static void
|
2006-11-26 11:13:41 -07:00
|
|
|
SizeDeviceInfo(DeviceIntPtr d, int *namesize, int *size)
|
|
|
|
{
|
|
|
|
int chunks;
|
|
|
|
|
|
|
|
*namesize += 1;
|
|
|
|
if (d->name)
|
2012-06-10 07:21:05 -06:00
|
|
|
*namesize += strlen(d->name);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (d->key != NULL)
|
2012-06-10 07:21:05 -06:00
|
|
|
*size += sizeof(xKeyInfo);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (d->button != NULL)
|
2012-06-10 07:21:05 -06:00
|
|
|
*size += sizeof(xButtonInfo);
|
2006-11-26 11:13:41 -07:00
|
|
|
if (d->valuator != NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
chunks = ((int) d->valuator->numAxes + 19) / VPC;
|
|
|
|
*size += (chunks * sizeof(xValuatorInfo) +
|
|
|
|
d->valuator->numAxes * sizeof(xAxisInfo));
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
|
|
|
*
|
|
|
|
* We need the extra byte in the allocated buffer, because the trailing null
|
|
|
|
* hammers one extra byte, which is overwritten by the next name except for
|
|
|
|
* the last name copied.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static void
|
2014-09-27 11:52:59 -06:00
|
|
|
CopyDeviceName(char **namebuf, const char *name)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
2014-09-27 11:52:59 -06:00
|
|
|
char *nameptr = *namebuf;
|
2006-11-26 11:13:41 -07:00
|
|
|
|
|
|
|
if (name) {
|
2012-06-10 07:21:05 -06:00
|
|
|
*nameptr++ = strlen(name);
|
|
|
|
strcpy(nameptr, name);
|
|
|
|
*namebuf += (strlen(name) + 1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*nameptr++ = 0;
|
|
|
|
*namebuf += 1;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure copies ButtonClass information, swapping if necessary.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
CopySwapButtonClass(ClientPtr client, ButtonClassPtr b, char **buf)
|
|
|
|
{
|
|
|
|
xButtonInfoPtr b2;
|
|
|
|
|
|
|
|
b2 = (xButtonInfoPtr) * buf;
|
|
|
|
b2->class = ButtonClass;
|
|
|
|
b2->length = sizeof(xButtonInfo);
|
|
|
|
b2->num_buttons = b->numButtons;
|
2009-09-06 13:44:18 -06:00
|
|
|
if (client && client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&b2->num_buttons);
|
2007-11-24 10:55:21 -07:00
|
|
|
}
|
|
|
|
*buf += sizeof(xButtonInfo);
|
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure copies data to the DeviceInfo struct, swapping if necessary.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static void
|
2012-06-10 07:21:05 -06:00
|
|
|
CopySwapDevice(ClientPtr client, DeviceIntPtr d, int num_classes, char **buf)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
xDeviceInfoPtr dev;
|
|
|
|
|
|
|
|
dev = (xDeviceInfoPtr) * buf;
|
|
|
|
|
|
|
|
dev->id = d->id;
|
2010-07-27 13:02:24 -06:00
|
|
|
dev->type = d->xinput_type;
|
2006-11-26 11:13:41 -07:00
|
|
|
dev->num_classes = num_classes;
|
2010-07-27 13:02:24 -06:00
|
|
|
if (IsMaster(d) && IsKeyboardDevice(d))
|
2012-06-10 07:21:05 -06:00
|
|
|
dev->use = IsXKeyboard;
|
2010-07-27 13:02:24 -06:00
|
|
|
else if (IsMaster(d) && IsPointerDevice(d))
|
2012-06-10 07:21:05 -06:00
|
|
|
dev->use = IsXPointer;
|
2007-11-24 10:55:21 -07:00
|
|
|
else if (d->valuator && d->button)
|
|
|
|
dev->use = IsXExtensionPointer;
|
2010-12-21 13:10:44 -07:00
|
|
|
else if (d->key && d->kbdfeed)
|
|
|
|
dev->use = IsXExtensionKeyboard;
|
2006-11-26 11:13:41 -07:00
|
|
|
else
|
2012-06-10 07:21:05 -06:00
|
|
|
dev->use = IsXExtensionDevice;
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
if (client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swapl(&dev->type);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
*buf += sizeof(xDeviceInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure copies KeyClass information, swapping if necessary.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static void
|
|
|
|
CopySwapKeyClass(ClientPtr client, KeyClassPtr k, char **buf)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
xKeyInfoPtr k2;
|
|
|
|
|
|
|
|
k2 = (xKeyInfoPtr) * buf;
|
|
|
|
k2->class = KeyClass;
|
|
|
|
k2->length = sizeof(xKeyInfo);
|
2010-07-27 13:02:24 -06:00
|
|
|
k2->min_keycode = k->xkbInfo->desc->min_key_code;
|
|
|
|
k2->max_keycode = k->xkbInfo->desc->max_key_code;
|
2006-11-26 11:13:41 -07:00
|
|
|
k2->num_keys = k2->max_keycode - k2->min_keycode + 1;
|
2009-09-06 13:44:18 -06:00
|
|
|
if (client && client->swapped) {
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&k2->num_keys);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
*buf += sizeof(xKeyInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure copies ValuatorClass information, swapping if necessary.
|
|
|
|
*
|
|
|
|
* Devices may have up to 255 valuators. The length of a ValuatorClass is
|
|
|
|
* defined to be sizeof(ValuatorClassInfo) + num_axes * sizeof (xAxisInfo).
|
2009-09-06 13:44:18 -06:00
|
|
|
* The maximum length is therefore (8 + 255 * 12) = 3068. However, the
|
2006-11-26 11:13:41 -07:00
|
|
|
* length field is one byte. If a device has more than 20 valuators, we
|
|
|
|
* must therefore return multiple valuator classes to the client.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
static int
|
2011-11-05 07:32:40 -06:00
|
|
|
CopySwapValuatorClass(ClientPtr client, DeviceIntPtr dev, char **buf)
|
2006-11-26 11:13:41 -07:00
|
|
|
{
|
|
|
|
int i, j, axes, t_axes;
|
2011-11-05 07:32:40 -06:00
|
|
|
ValuatorClassPtr v = dev->valuator;
|
2006-11-26 11:13:41 -07:00
|
|
|
xValuatorInfoPtr v2;
|
|
|
|
AxisInfo *a;
|
|
|
|
xAxisInfoPtr a2;
|
|
|
|
|
|
|
|
for (i = 0, axes = v->numAxes; i < ((v->numAxes + 19) / VPC);
|
2012-06-10 07:21:05 -06:00
|
|
|
i++, axes -= VPC) {
|
|
|
|
t_axes = axes < VPC ? axes : VPC;
|
|
|
|
if (t_axes < 0)
|
|
|
|
t_axes = v->numAxes % VPC;
|
|
|
|
v2 = (xValuatorInfoPtr) * buf;
|
|
|
|
v2->class = ValuatorClass;
|
|
|
|
v2->length = sizeof(xValuatorInfo) + t_axes * sizeof(xAxisInfo);
|
|
|
|
v2->num_axes = t_axes;
|
|
|
|
v2->mode = valuator_get_mode(dev, 0);
|
|
|
|
v2->motion_buffer_size = v->numMotionEvents;
|
|
|
|
if (client && client->swapped) {
|
|
|
|
swapl(&v2->motion_buffer_size);
|
|
|
|
}
|
|
|
|
*buf += sizeof(xValuatorInfo);
|
|
|
|
a = v->axes + (VPC * i);
|
|
|
|
a2 = (xAxisInfoPtr) * buf;
|
|
|
|
for (j = 0; j < t_axes; j++) {
|
|
|
|
a2->min_value = a->min_value;
|
|
|
|
a2->max_value = a->max_value;
|
|
|
|
a2->resolution = a->resolution;
|
|
|
|
if (client && client->swapped) {
|
|
|
|
swapl(&a2->min_value);
|
|
|
|
swapl(&a2->max_value);
|
|
|
|
swapl(&a2->resolution);
|
|
|
|
}
|
|
|
|
a2++;
|
|
|
|
a++;
|
|
|
|
*buf += sizeof(xAxisInfo);
|
|
|
|
}
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
2010-12-05 08:36:02 -07:00
|
|
|
return i;
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
static void
|
|
|
|
CopySwapClasses(ClientPtr client, DeviceIntPtr dev, CARD8 *num_classes,
|
2012-06-10 07:21:05 -06:00
|
|
|
char **classbuf)
|
2010-07-27 13:02:24 -06:00
|
|
|
{
|
|
|
|
if (dev->key != NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
CopySwapKeyClass(client, dev->key, classbuf);
|
|
|
|
(*num_classes)++;
|
2010-07-27 13:02:24 -06:00
|
|
|
}
|
|
|
|
if (dev->button != NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
CopySwapButtonClass(client, dev->button, classbuf);
|
|
|
|
(*num_classes)++;
|
2010-07-27 13:02:24 -06:00
|
|
|
}
|
|
|
|
if (dev->valuator != NULL) {
|
2012-06-10 07:21:05 -06:00
|
|
|
(*num_classes) += CopySwapValuatorClass(client, dev, classbuf);
|
2010-07-27 13:02:24 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-24 10:55:21 -07:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure lists information to be returned for an input device.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
ListDeviceInfo(ClientPtr client, DeviceIntPtr d, xDeviceInfoPtr dev,
|
2012-06-10 07:21:05 -06:00
|
|
|
char **devbuf, char **classbuf, char **namebuf)
|
2007-11-24 10:55:21 -07:00
|
|
|
{
|
|
|
|
CopyDeviceName(namebuf, d->name);
|
|
|
|
CopySwapDevice(client, d, 0, devbuf);
|
2009-09-06 13:44:18 -06:00
|
|
|
CopySwapClasses(client, d, &dev->num_classes, classbuf);
|
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure checks if a device should be left off the list.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static Bool
|
|
|
|
ShouldSkipDevice(ClientPtr client, DeviceIntPtr d)
|
2009-09-06 13:44:18 -06:00
|
|
|
{
|
2010-07-27 13:02:24 -06:00
|
|
|
/* don't send master devices other than VCP/VCK */
|
2012-06-10 07:21:05 -06:00
|
|
|
if (!IsMaster(d) || d == inputInfo.pointer ||d == inputInfo.keyboard) {
|
2010-07-27 13:02:24 -06:00
|
|
|
int rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess);
|
2012-06-10 07:21:05 -06:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
if (rc == Success)
|
|
|
|
return FALSE;
|
2007-11-24 10:55:21 -07:00
|
|
|
}
|
2010-07-27 13:02:24 -06:00
|
|
|
return TRUE;
|
2007-11-24 10:55:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure lists the input devices available to the server.
|
|
|
|
*
|
2009-09-06 13:44:18 -06:00
|
|
|
* If this request is called by a client that has not issued a
|
|
|
|
* GetExtensionVersion request with major/minor version set, we don't send the
|
|
|
|
* complete device list. Instead, we only send the VCP, the VCK and floating
|
|
|
|
* SDs. This resembles the setup found on XI 1.x machines.
|
2007-11-24 10:55:21 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
|
|
|
ProcXListInputDevices(ClientPtr client)
|
|
|
|
{
|
|
|
|
xListInputDevicesReply rep;
|
|
|
|
int numdevs = 0;
|
2012-06-10 07:21:05 -06:00
|
|
|
int namesize = 1; /* need 1 extra byte for strcpy */
|
2010-07-27 13:02:24 -06:00
|
|
|
int i = 0, size = 0;
|
2007-11-24 10:55:21 -07:00
|
|
|
int total_length;
|
2010-07-27 13:02:24 -06:00
|
|
|
char *devbuf, *classbuf, *namebuf, *savbuf;
|
|
|
|
Bool *skip;
|
2007-11-24 10:55:21 -07:00
|
|
|
xDeviceInfo *dev;
|
|
|
|
DeviceIntPtr d;
|
|
|
|
|
|
|
|
REQUEST_SIZE_MATCH(xListInputDevicesReq);
|
|
|
|
|
2013-06-07 11:28:45 -06:00
|
|
|
rep = (xListInputDevicesReply) {
|
|
|
|
.repType = X_Reply,
|
|
|
|
.RepType = X_ListInputDevices,
|
|
|
|
.sequenceNumber = client->sequence,
|
|
|
|
.length = 0
|
|
|
|
};
|
2007-11-24 10:55:21 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
/* allocate space for saving skip value */
|
2010-12-05 08:36:02 -07:00
|
|
|
skip = calloc(sizeof(Bool), inputInfo.numDevices);
|
2010-07-27 13:02:24 -06:00
|
|
|
if (!skip)
|
|
|
|
return BadAlloc;
|
|
|
|
|
|
|
|
/* figure out which devices to skip */
|
|
|
|
numdevs = 0;
|
|
|
|
for (d = inputInfo.devices; d; d = d->next, i++) {
|
|
|
|
skip[i] = ShouldSkipDevice(client, d);
|
|
|
|
if (skip[i])
|
|
|
|
continue;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
SizeDeviceInfo(d, &namesize, &size);
|
2007-11-24 10:55:21 -07:00
|
|
|
numdevs++;
|
|
|
|
}
|
2009-09-06 13:44:18 -06:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
for (d = inputInfo.off_devices; d; d = d->next, i++) {
|
|
|
|
skip[i] = ShouldSkipDevice(client, d);
|
|
|
|
if (skip[i])
|
|
|
|
continue;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
SizeDeviceInfo(d, &namesize, &size);
|
2007-11-24 10:55:21 -07:00
|
|
|
numdevs++;
|
|
|
|
}
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
/* allocate space for reply */
|
2007-11-24 10:55:21 -07:00
|
|
|
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
|
2012-06-10 07:21:05 -06:00
|
|
|
devbuf = (char *) calloc(1, total_length);
|
2007-11-24 10:55:21 -07:00
|
|
|
classbuf = devbuf + (numdevs * sizeof(xDeviceInfo));
|
|
|
|
namebuf = classbuf + size;
|
|
|
|
savbuf = devbuf;
|
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
/* fill in and send reply */
|
|
|
|
i = 0;
|
2007-11-24 10:55:21 -07:00
|
|
|
dev = (xDeviceInfoPtr) devbuf;
|
2010-07-27 13:02:24 -06:00
|
|
|
for (d = inputInfo.devices; d; d = d->next, i++) {
|
|
|
|
if (skip[i])
|
|
|
|
continue;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
|
|
|
|
}
|
2007-11-24 10:55:21 -07:00
|
|
|
|
2010-07-27 13:02:24 -06:00
|
|
|
for (d = inputInfo.off_devices; d; d = d->next, i++) {
|
|
|
|
if (skip[i])
|
|
|
|
continue;
|
|
|
|
|
2009-09-06 13:44:18 -06:00
|
|
|
ListDeviceInfo(client, d, dev++, &devbuf, &classbuf, &namebuf);
|
|
|
|
}
|
2007-11-24 10:55:21 -07:00
|
|
|
rep.ndevices = numdevs;
|
2010-07-27 13:02:24 -06:00
|
|
|
rep.length = bytes_to_int32(total_length);
|
2007-11-24 10:55:21 -07:00
|
|
|
WriteReplyToClient(client, sizeof(xListInputDevicesReply), &rep);
|
|
|
|
WriteToClient(client, total_length, savbuf);
|
2010-12-05 08:36:02 -07:00
|
|
|
free(savbuf);
|
|
|
|
free(skip);
|
2007-11-24 10:55:21 -07:00
|
|
|
return Success;
|
|
|
|
}
|
|
|
|
|
2006-11-26 11:13:41 -07:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
|
|
|
* This procedure writes the reply for the XListInputDevices function,
|
|
|
|
* if the client and server have a different byte ordering.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
|
|
|
SRepXListInputDevices(ClientPtr client, int size, xListInputDevicesReply * rep)
|
|
|
|
{
|
2012-06-10 07:21:05 -06:00
|
|
|
swaps(&rep->sequenceNumber);
|
|
|
|
swapl(&rep->length);
|
2013-06-07 11:28:45 -06:00
|
|
|
WriteToClient(client, size, rep);
|
2006-11-26 11:13:41 -07:00
|
|
|
}
|