| diff --git a/include/evdev-properties.h b/include/evdev-properties.h |
| index 7df2876..6ab42b3 100644 |
| --- a/include/evdev-properties.h |
| +++ b/include/evdev-properties.h |
| @@ -66,4 +66,7 @@ |
| /* BOOL */ |
| #define EVDEV_PROP_SWAP_AXES "Evdev Axes Swap" |
| |
| +/* Physical location of input device as defined by the kernel */ |
| +#define EVDEV_PROP_PHYSICAL "Evdev Physical" |
| + |
| #endif |
| diff --git a/src/evdev.c b/src/evdev.c |
| index ccea90d..accc1d4 100644 |
| --- a/src/evdev.c |
| +++ b/src/evdev.c |
| @@ -118,6 +118,7 @@ static Atom prop_calibration = 0; |
| static Atom prop_swap = 0; |
| static Atom prop_axis_label = 0; |
| static Atom prop_btn_label = 0; |
| +static Atom prop_phys = 0; |
| #endif |
| |
| /* All devices the evdev driver has allocated and knows about. |
| @@ -2453,6 +2454,17 @@ EvdevInitProperty(DeviceIntPtr dev) |
| EvdevPtr pEvdev = pInfo->private; |
| int rc; |
| BOOL invert[2]; |
| + char phys[256]; |
| + |
| + if (ioctl(pInfo->fd, EVIOCGPHYS(sizeof(phys) - 1), phys) >= 0) |
| + { |
| + prop_phys = MakeAtom(EVDEV_PROP_PHYSICAL, |
| + strlen(EVDEV_PROP_PHYSICAL), TRUE); |
| + rc = XIChangeDeviceProperty(dev, prop_phys, XA_STRING, 8, |
| + PropModeReplace, strlen(phys), phys, FALSE); |
| + if (rc != Success) |
| + return; |
| + } |
| |
| if (pEvdev->flags & (EVDEV_RELATIVE_EVENTS | EVDEV_ABSOLUTE_EVENTS)) |
| { |
| @@ -2561,8 +2573,8 @@ EvdevSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val, |
| |
| if (!checkonly) |
| pEvdev->swap_axes = *((BOOL*)val->data); |
| - } else if (atom == prop_axis_label || atom == prop_btn_label) |
| - return BadAccess; /* Axis/Button labels can't be changed */ |
| + } else if (atom == prop_axis_label || atom == prop_btn_label || atom == prop_phys) |
| + return BadAccess; /* Axis/Button labels + phys can't be changed */ |
| |
| return Success; |
| } |