blob: 53aa4f0b79d64194ce95a33c1721e5deb29a0a33 [file] [log] [blame]
diff --git a/man/evdev.man b/man/evdev.man
index adb3f8d..a202ae8 100644
--- a/man/evdev.man
+++ b/man/evdev.man
@@ -66,7 +66,8 @@ is used. Buttons not specified in the user's mapping use the default mapping.
.BI "Option \*qDevice\*q \*q" string \*q
Specifies the device through which the device can be accessed. This will
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
-The mapping from device node to hardware is system-dependent.
+The mapping from device node to hardware is system-dependent. Property:
+"Device Node" (read-only).
.TP 7
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
diff --git a/src/evdev.c b/src/evdev.c
index c888d6a..5faf548 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -131,6 +131,7 @@ static Atom prop_swap = 0;
static Atom prop_axis_label = 0;
static Atom prop_btn_label = 0;
static Atom prop_phys = 0;
+static Atom prop_device = 0;
#endif
/* All devices the evdev driver has allocated and knows about.
@@ -2691,6 +2692,7 @@ EvdevInitProperty(DeviceIntPtr dev)
int rc;
BOOL invert[2];
char phys[256];
+ char *device_node;
if (ioctl(pInfo->fd, EVIOCGPHYS(sizeof(phys) - 1), phys) >= 0)
{
@@ -2702,6 +2704,21 @@ EvdevInitProperty(DeviceIntPtr dev)
return;
}
+ /* Device node property */
+ device_node = strdup(pEvdev->device);
+ prop_device = MakeAtom(XI_PROP_DEVICE_NODE,
+ strlen(XI_PROP_DEVICE_NODE), TRUE);
+ rc = XIChangeDeviceProperty(dev, prop_device, XA_STRING, 8,
+ PropModeReplace,
+ strlen(device_node), device_node,
+ FALSE);
+ free(device_node);
+
+ if (rc != Success)
+ return;
+
+ XISetDevicePropertyDeletable(dev, prop_device, FALSE);
+
if (pEvdev->flags & (EVDEV_RELATIVE_EVENTS | EVDEV_ABSOLUTE_EVENTS))
{
invert[0] = pEvdev->invert_x;
@@ -2781,7 +2798,9 @@ EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
InputInfoPtr pInfo = dev->public.devicePrivate;
EvdevPtr pEvdev = pInfo->private;
- if (atom == prop_invert)
+ if (atom == prop_device)
+ return BadValue;
+ else if (atom == prop_invert)
{
BOOL* data;
if (val->format != 8 || val->size != 2 || val->type != XA_INTEGER)
diff --git a/src/evdev.h b/src/evdev.h
index 4102672..f9d8906 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -80,6 +80,10 @@
#define MAX_VALUATORS 36
#endif
+#ifndef XI_PROP_DEVICE_NODE
+#define XI_PROP_DEVICE_NODE "Device Node"
+#endif
+
#define MT_AXIS_FIRST ABS_MT_TOUCH_MAJOR
#define MT_NUM_AXES (ABS_MT_PRESSURE - MT_AXIS_FIRST + 1)
#define MT_AXIS(x) (x) - MT_AXIS_FIRST