Package: xserver-xorg-input-wacom
Version: 0.10.3+20100109-1
Severity: normal
Tags: patch

Hi,

it appears that setting tvResolutions through either of 'xsetwacom' or
'xinput set-int-prop' is impossible for any TwinView value. Any such
attempt returns BadInt error.

The problem appears to be in sanity checks for the received values in
wacom drivers: it was required for both sums of widths and heights of
monitors to be equal to xinerama screen size. This permits for only very
strange screen layouts, like this:

+---+----+
| 1 |    |
+---+----+
|   |  2 |
+---+----+

The attached patch fixes the checks to a more reasonable behaviour
(which depends on whether monitors are reported to be arranged
horizontally or vertically).

This led to a second problem in xsetwacom: initially tvResolutions is
set to [0,0,0,0], which means "autodetect". Thus, sending either
TVResolution0, or TVResolution1 would yield values that will not pass
the checks. (One can bypass this bug by giving 4 values to xsetwacom
set ... TVResolution0). I assume a reasonable bypass would be to remove
parameter TVResolution1 from xsetwacom altogether and rename
TVResolution0 to TVResolutions. I assume that changing interface is
possible, since I see no way this parameter could be used before.

This suggested change is also in the attached patch.

Cheers,
-- Danya.


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages xserver-xorg-input-wacom depends on:
ii  libc6                         2.10.2-2   GNU C Library: Shared libraries
ii  libx11-6                      2:1.3.3-1  X11 client-side library
ii  libxi6                        2:1.3-2    X11 Input extension library
ii  xserver-xorg-core             2:1.7.4-2  Xorg X server - core server

xserver-xorg-input-wacom recommends no packages.

Versions of packages xserver-xorg-input-wacom suggests:
ii  xinput                        1.4.2-1    Runtime configuration and test of 

-- no debconf information
diff -u -r xf86-input-wacom-0.10.3+20100109/src/wcmXCommand.c xf86-input-wacom-0.10.3+20100109.my/src/wcmXCommand.c
--- xf86-input-wacom-0.10.3+20100109/src/wcmXCommand.c	2010-01-09 10:40:54.000000000 +0300
+++ xf86-input-wacom-0.10.3+20100109.my/src/wcmXCommand.c	2010-02-22 23:45:54.165461382 +0300
@@ -585,13 +585,26 @@
 
 		values = (CARD32*)prop->data;
 
+		DBG(0, priv, "(PROP_TV_RESOLUTIONS) values=[%d, %d, %d, %d]\n",
+			values[0], values[1], values[2], values[3]);
+
 		/* non-TwinView settings can not set TwinView RESOLUTION */
 		if ((priv->twinview == TV_NONE) || (values[0] < 0) ||
-				(values[1] < 0) || (values[2] < 0) || (values[3] < 0) ||
-				((values[0] + values[2]) != screenInfo.screens[0]->width) ||
-				((values[1] + values[3]) != screenInfo.screens[0]->height))
+				(values[1] < 0) || (values[2] < 0) || (values[3] < 0))
 			return BadValue;
 
+		if ((priv->twinview == TV_LEFT_RIGHT) ||
+				(priv->twinview == TV_RIGHT_LEFT))
+			if (((values[0] + values[2]) != screenInfo.screens[0]->width) ||
+					max(values[1], values[3]) != screenInfo.screens[0]->height)
+				return BadValue;
+
+		if ((priv->twinview == TV_ABOVE_BELOW) ||
+				(priv->twinview == TV_BELOW_ABOVE))
+			if (((values[1] + values[3]) != screenInfo.screens[0]->height) ||
+					max(values[0], values[2]) != screenInfo.screens[0]->width)
+				return BadValue;
+
 		if (!checkonly)
 		{
 			priv->tvResolution[0] = values[0];
diff -u -r xf86-input-wacom-0.10.3+20100109/tools/xsetwacom.c xf86-input-wacom-0.10.3+20100109.my/tools/xsetwacom.c
--- xf86-input-wacom-0.10.3+20100109/tools/xsetwacom.c	2010-01-09 10:40:54.000000000 +0300
+++ xf86-input-wacom-0.10.3+20100109.my/tools/xsetwacom.c	2010-02-23 00:05:46.702573807 +0300
@@ -471,20 +471,13 @@
 		.prop_offset = 3,
 	},
 	{
-		.name = "TVResolution0",
-		.desc = "Sets MetaModes option for TwinView Screen 0. ",
+		.name = "TVResolutions",
+		.desc = "Sets MetaModes option for TwinView. Format: W0 H0 W1 H1. ",
 		.prop_name = WACOM_PROP_TWINVIEW_RES,
 		.prop_format = 32,
 		.prop_offset = 0,
 	},
 	{
-		.name = "TVResolution1",
-		.desc = "Sets MetaModes option for TwinView Screen 1. ",
-		.prop_name = WACOM_PROP_TWINVIEW_RES,
-		.prop_format = 32,
-		.prop_offset = 1,
-	},
-	{
 		.name = "RawFilter",
 		.desc = "Enables and disables filtering of raw data, "
 		"default is true/on.",

Reply via email to