On Thu, Jun 02, 2011 at 12:44:10PM +1000, Peter Hutterer wrote:
> X doesn't provide a mapping between physical devices and X device IDs other
> than what can be extrapolated from the device name.
> Export the device node so clients that need e.g. sysfs or other information
> from the kernel can map the devices.
> 
> Signed-off-by: Peter Hutterer <[email protected]>
> ---

I should note that I had a typo in the patch, the server's define is
XI_PROP_DEVICE_NODE, not XI_PROP_DEVNODE. I fixed this up locally but it had
no effect on its working otherwise since the _name_ of the property was
identical. Even if we had ended up using two different defines, the only
result would have been that the cpp gets a bit more exercise.

Cheers,
  Peter

>  src/wcmXCommand.c |   15 ++++++++++++++-
>  1 files changed, 14 insertions(+), 1 deletions(-)
> 
> diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
> index 20e87af..65854b0 100644
> --- a/src/wcmXCommand.c
> +++ b/src/wcmXCommand.c
> @@ -26,6 +26,10 @@
>  #include <exevents.h>
>  #include <xf86_OSproc.h>
>  
> +#ifndef XI_PROP_DEVNODE
> +#define XI_PROP_DEVNODE "Device Node"
> +#endif
> +
>  static void wcmBindToSerial(InputInfoPtr pInfo, unsigned int serial);
>  
>  
> /*****************************************************************************
> @@ -72,6 +76,7 @@ int wcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, 
> int mode)
>       return wcmDevSwitchModeCall(pInfo, mode);
>  }
>  
> +Atom prop_devnode;
>  Atom prop_rotation;
>  Atom prop_tablet_area;
>  Atom prop_pressurecurve;
> @@ -144,6 +149,12 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
>  
>       DBG(10, priv, "\n");
>  
> +     prop_devnode = MakeAtom(XI_PROP_DEVNODE, strlen(XI_PROP_DEVNODE), TRUE);
> +     XIChangeDeviceProperty(pInfo->dev, prop_devnode, XA_STRING, 8,
> +                             PropModeReplace, strlen(common->device_path),
> +                             common->device_path, FALSE);
> +     XISetDevicePropertyDeletable(pInfo->dev, prop_devnode, FALSE);
> +
>       if (!IsPad(priv)) {
>               values[0] = priv->topX;
>               values[1] = priv->topY;
> @@ -597,7 +608,9 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
> XIPropertyValuePtr prop,
>  
>       DBG(10, priv, "\n");
>  
> -     if (property == prop_tablet_area)
> +     if (property == prop_devnode)
> +             return BadValue; /* Read-only */
> +     else if (property == prop_tablet_area)
>       {
>               INT32 *values = (INT32*)prop->data;
>  
> -- 
> 1.7.5.1
> 

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to