Re: [Linuxwacom-devel] [PATCH 1/2] Increase full-scale pressure range from 0..2047 to 0..65535

2016-10-27 Thread Ping Cheng
On Thursday, October 27, 2016, Peter Hutterer 
wrote:

> On Wed, Oct 26, 2016 at 11:56:57PM -0700, Ping Cheng wrote:
> > On Wednesday, October 26, 2016, Peter Hutterer  >
> > wrote:
> >
> > > On Wed, Oct 26, 2016 at 06:24:48PM -0700, Ping Cheng wrote:
> > > > On Fri, Oct 7, 2016 at 10:25 AM, 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   >
> > > >
> > > > Reviewed-by: Ping Cheng 
> > for the set of
> > > 2 patches.
> > > >
> > > > Thank you for considering backward compatibility. That's a bonus for
> > > > many system admins who use xsetwacom/xinput to configure the driver.
> > > >
> > > > Please update this patch as Peter suggested though.
> > >
> > > uhm, just something else I noticed. we precalculate the pressure
> curve, so
> > > we now have 256 KB in the driver allocated just for the values. We
> should
> > > probably split this out to be allocated on demand
> >
> >
> > How do you plan to make it on demand? Will it add a new API?
>
> Changing pPressCurve[FILTER_PRESSURE_RES + 1] to a dynamically allocated
> memory should be enough, no new API is needed, this is just an
> implementation detail.


Great! That's smart. Then go for it ;).

Cheers,

Ping
--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH libwacom] data: set the 22HD(T) to allow for touch strip modes

2016-10-27 Thread Bastien Nocera
On Thu, 2016-10-27 at 13:39 +1000, Peter Hutterer wrote:
> There is no physical LED to show the current mode, but the tablet was
> clearly
> intended to be used that way [1] and we already reserve two buttons
> as mode
> switch buttons anyway. Declare it correctly and let the userspace
> stack worry
> about displaying mode switches (it's already responsible for changing
> LEDs
> anyway).
> 
> [1] "The ambidextrous design of the Cintiq 22HD touch features a pair
> of
> rear-mounted Touch Strips, along with accompanying Touch Strip Toggle
> buttons.
> Each controls up to four application-specific functions, such as
> brush size,
> zooming, scrolling and on-screen canvas rotation."
> https://buywacom.com.au/cintiq-22hd-touch.html

Looks like this would need user-space changes to show an OSD when the
feature is being used. In the meanwhile, I'd hold off on making a
change until at least one front-end implemented the functionality.

--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH libwacom] data: set the 22HD(T) to allow for touch strip modes

2016-10-27 Thread Ping Cheng
On Wednesday, October 26, 2016, Peter Hutterer 
wrote:

> There is no physical LED to show the current mode, but the tablet was
> clearly
> intended to be used that way [1] and we already reserve two buttons as mode
> switch buttons anyway. Declare it correctly and let the userspace stack
> worry
> about displaying mode switches (it's already responsible for changing LEDs
> anyway).


If user space agrees with your suggestion, I am all for it!

Reviewed-by: Ping Cheng 

Thank you for the patch.

Ping


>
> [1] "The ambidextrous design of the Cintiq 22HD touch features a pair of
> rear-mounted Touch Strips, along with accompanying Touch Strip Toggle
> buttons.
> Each controls up to four application-specific functions, such as brush
> size,
> zooming, scrolling and on-screen canvas rotation."
> https://buywacom.com.au/cintiq-22hd-touch.html
>
> Signed-off-by: Peter Hutterer >
> ---
>  data/cintiq-22hd.tablet  | 2 ++
>  data/cintiq-22hdt.tablet | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/data/cintiq-22hd.tablet b/data/cintiq-22hd.tablet
> index 54f3219..9c32131 100644
> --- a/data/cintiq-22hd.tablet
> +++ b/data/cintiq-22hd.tablet
> @@ -54,3 +54,5 @@ Right=K;L;M;N;J;O;P;Q;R
>
>  Touchstrip=A
>  Touchstrip2=J
> +# Note: no physical LEDs to show mode
> +StripsNumModes=4
> diff --git a/data/cintiq-22hdt.tablet b/data/cintiq-22hdt.tablet
> index 9e74c41..63c5bc5 100644
> --- a/data/cintiq-22hdt.tablet
> +++ b/data/cintiq-22hdt.tablet
> @@ -56,3 +56,5 @@ Right=K;L;M;N;J;O;P;Q;R
>
>  Touchstrip=A
>  Touchstrip2=J
> +# Note: no physical LEDs to show mode
> +StripsNumModes=4
> --
> 2.9.3
>
>
--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 1/2] Increase full-scale pressure range from 0..2047 to 0..65535

2016-10-27 Thread Peter Hutterer
On Wed, Oct 26, 2016 at 06:24:48PM -0700, Ping Cheng wrote:
> On Fri, Oct 7, 2016 at 10:25 AM, 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 
> 
> Reviewed-by: Ping Cheng  for the set of 2 patches.
> 
> Thank you for considering backward compatibility. That's a bonus for
> many system admins who use xsetwacom/xinput to configure the driver.
> 
> Please update this patch as Peter suggested though.

uhm, just something else I noticed. we precalculate the pressure curve, so
we now have 256 KB in the driver allocated just for the values. We should
probably split this out to be allocated on demand (not everyone needs the
pressure curve) and to avoid blowing up our struct sizes even more.

Or, event better would be to have the pressure curve calculated based on the
device's actual min/max, so we only carry around as much as we need.

Cheers,
   Peter
 
> >  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 */
> > 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 == )
> >
> > -#define FILTER_PRESSURE_RES2048/* maximum points in pressure curve 
> > */
> > +#define FILTER_PRESSURE_RES65536   /* 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
> >

--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel