diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-05-05 15:30:34 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-05-06 11:56:25 +1000 |
commit | 429e9d569d9907f7954384dab433f2a267f173e1 (patch) | |
tree | 369cb1c5b014666a0818761450169831e3c5616d | |
parent | a4ce692ea35911fa597eff477e209c4ec49af79e (diff) | |
download | xf86-input-wacom-429e9d569d9907f7954384dab433f2a267f173e1.tar.gz |
Add a property to bind the device to a serial number.
This is a read/write property to force the device to a single serial number
only.
xsetwacom parameter BindToSerial
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chris Bagwell <chris@cnpbagwell.com>
-rw-r--r-- | include/wacom-properties.h | 3 | ||||
-rw-r--r-- | man/xsetwacom.man | 6 | ||||
-rw-r--r-- | src/wcmXCommand.c | 27 | ||||
-rw-r--r-- | tools/xsetwacom.c | 10 |
4 files changed, 45 insertions, 1 deletions
diff --git a/include/wacom-properties.h b/include/wacom-properties.h index f35313c..165cd83 100644 --- a/include/wacom-properties.h +++ b/include/wacom-properties.h @@ -37,6 +37,9 @@ read-only */ #define WACOM_PROP_SERIALIDS "Wacom Serial IDs" +/* CARD32, 1 value */ +#define WACOM_PROP_SERIAL_BIND "Wacom Serial ID binding" + /* 8 bit, 4 values, left up, left down, right up, right down OR Atom, 4 values , left up, left down, right up, right down diff --git a/man/xsetwacom.man b/man/xsetwacom.man index 3f3aafe..3a5fa40 100644 --- a/man/xsetwacom.man +++ b/man/xsetwacom.man @@ -113,6 +113,12 @@ shift, press and release b, release shift, release a". In addition to the "key" keyword, "button" and "modetoggle" are also recognized. Multiple keywords may be present in one action if desired: for example "key +ctrl button 5 key -ctrl". .TP +\fBBindToSerial\fR [serial|0] +Bind the device to the tool with the specified serial number. Once bound, +the device will ignore events from other tools. A serial of 0 means the +device is unbound and will react to any tool of the matching type. +Default: 0 +.TP \fBMapToOutput\fR output Map the tablet's input area to the given output (e.g. "VGA1"). The output must specify one of those available through the XRandR extension. A list of diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index c11708a..31e1f73 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -26,6 +26,8 @@ #include <exevents.h> #include <xf86_OSproc.h> +static void wcmBindToSerial(InputInfoPtr pInfo, unsigned int serial); + /***************************************************************************** * wcmDevSwitchModeCall -- *****************************************************************************/ @@ -74,6 +76,7 @@ Atom prop_rotation; Atom prop_tablet_area; Atom prop_pressurecurve; Atom prop_serials; +Atom prop_serial_binding; Atom prop_strip_buttons; Atom prop_wheel_buttons; Atom prop_tv_resolutions; @@ -166,6 +169,9 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo) values[3] = priv->cur_serial; prop_serials = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIALIDS, 32, 4, values); + values[0] = priv->serial; + prop_serial_binding = InitWcmAtom(pInfo->dev, WACOM_PROP_SERIAL_BIND, 32, 1, values); + if (IsCursor(priv)) { values[0] = common->wcmCursorProxoutDist; prop_cursorprox = InitWcmAtom(pInfo->dev, WACOM_PROP_PROXIMITY_THRESHOLD, 32, 1, values); @@ -678,6 +684,18 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, return Success; return BadValue; /* Read-only */ + } else if (property == prop_serial_binding) + { + unsigned int serial; + + if (prop->size != 1 || prop->format != 32) + return BadValue; + + if (!checkonly) + { + serial = *(CARD32*)prop->data; + wcmBindToSerial(pInfo, serial); + } } else if (property == prop_strip_buttons) return wcmSetStripProperty(dev, property, prop, checkonly); else if (property == prop_wheel_buttons) @@ -889,4 +907,13 @@ wcmUpdateSerial(InputInfoPtr pInfo, int serial) 1, serialTimerFunc, pInfo); } +static void +wcmBindToSerial(InputInfoPtr pInfo, unsigned int serial) +{ + WacomDevicePtr priv = pInfo->private; + + priv->serial = serial; + +} + /* vim: set noexpandtab tabstop=8 shiftwidth=8: */ diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c index efb7019..048cf8d 100644 --- a/tools/xsetwacom.c +++ b/tools/xsetwacom.c @@ -395,6 +395,14 @@ static param_t parameters[] = .prop_flags = PROP_FLAG_READONLY }, { + .name = "BindToSerial", + .desc = "Binds this device to the serial number.", + .prop_name = WACOM_PROP_SERIAL_BIND, + .prop_format = 32, + .prop_offset = 0, + .arg_count = 1, + }, + { .name = "TabletID", .desc = "Returns the tablet ID of the associated device. ", .prop_name = WACOM_PROP_SERIALIDS, @@ -2360,7 +2368,7 @@ static void test_parameter_number(void) * deprecated them. * Numbers include trailing NULL entry. */ - assert(ArrayLength(parameters) == 34); + assert(ArrayLength(parameters) == 35); assert(ArrayLength(deprecated_parameters) == 16); } |