[PATCH synaptics 2/2] Export device node as property.
Peter Hutterer
peter.hutterer at who-t.net
Mon May 30 19:46:52 PDT 2011
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/properties.c | 16 +++++++++++++++-
src/synaptics.c | 2 ++
src/synapticsstr.h | 1 +
3 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/src/properties.c b/src/properties.c
index 4e831dc..ea6e40f 100644
--- a/src/properties.c
+++ b/src/properties.c
@@ -47,6 +47,10 @@
#define XI_PROP_PRODUCT_ID "Device Product ID"
#endif
+#ifndef XI_PROP_DEVICE_NODE
+#define XI_PROP_DEVICE_NODE "Device Node"
+#endif
+
static Atom float_type;
Atom prop_edges = 0;
@@ -89,6 +93,7 @@ Atom prop_resolution = 0;
Atom prop_area = 0;
Atom prop_noise_cancellation = 0;
Atom prop_product_id = 0;
+Atom prop_device_node = 0;
static Atom
InitAtom(DeviceIntPtr dev, char *name, int format, int nvalues, int *values)
@@ -299,6 +304,15 @@ InitDeviceProperties(InputInfoPtr pInfo)
prop_product_id = InitAtom(pInfo->dev, XI_PROP_PRODUCT_ID, 32, 2, values);
}
+ if (priv->device)
+ {
+ prop_device_node = MakeAtom(XI_PROP_DEVICE_NODE, strlen(XI_PROP_DEVICE_NODE), TRUE);
+ XIChangeDeviceProperty(pInfo->dev, prop_device_node, XA_STRING, 8,
+ PropModeReplace, strlen(priv->device),
+ priv->device, FALSE);
+ XISetDevicePropertyDeletable(pInfo->dev, prop_device_node, FALSE);
+ }
+
}
int
@@ -680,7 +694,7 @@ SetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop,
return BadValue;
para->hyst_x = hyst[0];
para->hyst_y = hyst[1];
- } else if (property == prop_product_id)
+ } else if (property == prop_product_id || property == prop_device_node)
return BadValue; /* read-only */
return Success;
diff --git a/src/synaptics.c b/src/synaptics.c
index 40cf6b9..55ef68b 100644
--- a/src/synaptics.c
+++ b/src/synaptics.c
@@ -694,6 +694,8 @@ SynapticsPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
goto SetupProc_fail;
}
+ priv->device = xf86FindOptionValue(pInfo->options, "Device");
+
/* open the touchpad device */
pInfo->fd = xf86OpenSerial(pInfo->options);
if (pInfo->fd == -1) {
diff --git a/src/synapticsstr.h b/src/synapticsstr.h
index e9ac7cb..35331b2 100644
--- a/src/synapticsstr.h
+++ b/src/synapticsstr.h
@@ -175,6 +175,7 @@ typedef struct _SynapticsPrivateRec
struct SynapticsHwState hwState;
+ char *device; /* device node */
Bool shm_config; /* True when shared memory area allocated */
OsTimerPtr timer; /* for up/down-button repeat, tap processing, etc */
--
1.7.5.1
More information about the xorg-devel
mailing list