Add "Device Node" xinput property containing the device node path to all input devices with a device property. This is useful to figure out the relation between xinput ids and kernel devices.
Signed-off-by: Peter Korsgaard <[email protected]> --- As requested by Peter Hutterer during the "Evdev Physical Path" discussion. Xi/xiproperty.c | 4 +++- hw/xfree86/common/xf86Xinput.c | 13 +++++++++++++ include/xserver-properties.h | 3 +++ 3 files changed, 19 insertions(+), 1 deletions(-) diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index be07831..d265b67 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -177,7 +177,9 @@ static struct dev_properties {0, BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP}, {0, BTN_LABEL_PROP_BTN_GEAR_DOWN}, - {0, BTN_LABEL_PROP_BTN_GEAR_UP} + {0, BTN_LABEL_PROP_BTN_GEAR_UP}, + + {0, XI_PROP_DEVICE_NODE} }; static long XIPropHandlerID = 1; diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index a1a5527..b88baae 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -328,6 +328,7 @@ int xf86ActivateDevice(LocalDevicePtr local) { DeviceIntPtr dev; + char *device; if (local->flags & XI86_CONFIGURED) { dev = AddInputDevice(serverClient, local->device_control, TRUE); @@ -357,6 +358,18 @@ xf86ActivateDevice(LocalDevicePtr local) RegisterOtherDevice(dev); XkbSetExtension(dev, ProcessKeyboardEvent); + device = xf86CheckStrOption(local->conf_idev->commonOptions, + "Device", NULL); + if (device) + { + XIChangeDeviceProperty(dev, XIGetKnownProperty(XI_PROP_DEVICE_NODE), + XA_STRING, 8, PropModeReplace, + strlen(device), device, FALSE); + XISetDevicePropertyDeletable(dev, XIGetKnownProperty(XI_PROP_DEVICE_NODE), + FALSE); + xfree(device); + } + if (serverGeneration == 1) xf86Msg(X_INFO, "XINPUT: Adding extended input device \"%s\" (type: %s)\n", local->name, local->type_name); diff --git a/include/xserver-properties.h b/include/xserver-properties.h index 30e8efb..6a05178 100644 --- a/include/xserver-properties.h +++ b/include/xserver-properties.h @@ -35,6 +35,9 @@ /* BOOL. If present, device is a virtual XTEST device */ #define XI_PROP_XTEST_DEVICE "XTEST Device" +/* STRING. Device node path of device */ +#define XI_PROP_DEVICE_NODE "Device Node" + /* Pointer acceleration properties */ /* INTEGER of any format */ #define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile" -- 1.7.0 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
