Sorry about the delay, only been back from holidays since mid last week.
On Fri, Oct 07, 2016 at 10:25:39AM -0700, Jason Gerecke wrote:
> The driver has historically normalized the pressure range of all kernel
> devices to 0..2047 rather than using their native range to keep things
> like the application of the pressure curve simple. Pens that report more
> than 2048 pressure levels are also normalized down to this range though,
> reducing their precision. In order to accomodate the new 8K pen (and any
> future pens with even higher precision), this patch bumps up the full-
> scale range to be 0..65535. This number was chosen both because it far
> exceeds anything currently known about, and also because it matches the
> normalization range used over the wire by the Wayland tablet protocol.
>
> Note that the WACOM_PROP_PRESSURE_THRESHOLD value has been tied to the
> normalized (2048-level) pressure range for some time, meaning that we
> cannot simply change the range without causing a change in the perceived
> threshold for users. To ensure compatibility, the value is interpreted
> as a fraction of 2048 and then scaled to the actual normalization range.
>
> Signed-off-by: Jason Gerecke <[email protected]>
> ---
> src/wcmXCommand.c | 6 +++++-
> src/xf86WacomDefs.h | 2 +-
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
> index 02278ba..403bc84 100644
> --- a/src/wcmXCommand.c
> +++ b/src/wcmXCommand.c
> @@ -256,6 +256,7 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
> }
>
> values[0] = (!common->wcmMaxZ) ? 0 : common->wcmThreshold;
> + values[0] /= (FILTER_PRESSURE_RES / 2048); /* backwards compatibility */
Add a pair of inline helper functions, that way you can have the 2048 in
only one place and you can add the documentation in one place too.
Cheers,
Peter
> prop_threshold = InitWcmAtom(pInfo->dev, WACOM_PROP_PRESSURE_THRESHOLD,
> XA_INTEGER, 32, 1, values);
>
> values[0] = common->wcmSuppress;
> @@ -827,6 +828,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property,
> XIPropertyValuePtr prop,
> common->wcmCursorProxoutDist = value;
> } else if (property == prop_threshold)
> {
> + const INT32 MAXIMUM = 2048; /* backwards compatibility */
> INT32 value;
>
> if (prop->size != 1 || prop->format != 32)
> @@ -836,8 +838,10 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property,
> XIPropertyValuePtr prop,
>
> if (value == -1)
> value = DEFAULT_THRESHOLD;
> - else if ((value < 1) || (value > FILTER_PRESSURE_RES))
> + else if ((value < 1) || (value > MAXIMUM))
> return BadValue;
> + else
> + value *= (FILTER_PRESSURE_RES / MAXIMUM);
>
> if (!checkonly)
> common->wcmThreshold = value;
> diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
> index 1575960..9de9cab 100644
> --- a/src/xf86WacomDefs.h
> +++ b/src/xf86WacomDefs.h
> @@ -183,7 +183,7 @@ struct _WacomModel
>
> #define IsUSBDevice(common) ((common)->wcmDevCls == &gWacomUSBDevice)
>
> -#define FILTER_PRESSURE_RES 2048 /* maximum points in pressure curve */
> +#define FILTER_PRESSURE_RES 65536 /* maximum points in pressure curve */
> /* Tested result for setting the pressure threshold to a reasonable value */
> #define THRESHOLD_TOLERANCE (FILTER_PRESSURE_RES / 125)
> #define DEFAULT_THRESHOLD (FILTER_PRESSURE_RES / 75)
> --
> 2.10.0
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel