X Tutup
Skip to content

Commit de43294

Browse files
committed
Merge branch 'ApproxEng:master'
2 parents dc8fa0f + f7b53f7 commit de43294

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

evdev/device.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class InputDevice(EventIO):
108108
A linux input device from which input events can be read.
109109
'''
110110

111-
__slots__ = ('fn', 'fd', 'info', 'name', 'phys', '_rawcapabilities',
111+
__slots__ = ('fn', 'fd', 'info', 'name', 'phys', 'uniq', '_rawcapabilities',
112112
'version', 'ff_effects_count')
113113

114114
def __init__(self, dev):
@@ -144,6 +144,9 @@ def __init__(self, dev):
144144
#: The physical topology of the device.
145145
self.phys = info_res[5]
146146

147+
#: The unique address of the device
148+
self.uniq = info_res[6]
149+
147150
#: The evdev protocol version.
148151
self.version = _input.ioctl_EVIOCGVERSION(self.fd)
149152

evdev/input.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ ioctl_devinfo(PyObject *self, PyObject *args)
216216
struct input_id iid;
217217
char name[MAX_NAME_SIZE];
218218
char phys[MAX_NAME_SIZE] = {0};
219+
char uniq[MAX_NAME_SIZE] = {0};
219220

220221
int ret = PyArg_ParseTuple(args, "i", &fd);
221222
if (!ret) return NULL;
@@ -225,11 +226,13 @@ ioctl_devinfo(PyObject *self, PyObject *args)
225226
if (ioctl(fd, EVIOCGID, &iid) < 0) goto on_err;
226227
if (ioctl(fd, EVIOCGNAME(sizeof(name)), name) < 0) goto on_err;
227228

229+
ioctl(fd, EVIOCGUNIQ(sizeof(uniq)), uniq);
230+
228231
// Some devices do not have a physical topology associated with them
229232
ioctl(fd, EVIOCGPHYS(sizeof(phys)), phys);
230233

231-
return Py_BuildValue("hhhhss", iid.bustype, iid.vendor, iid.product, iid.version,
232-
name, phys);
234+
return Py_BuildValue("hhhhsss", iid.bustype, iid.vendor, iid.product, iid.version,
235+
name, phys, uniq);
233236

234237
on_err:
235238
PyErr_SetFromErrno(PyExc_IOError);

0 commit comments

Comments
 (0)
X Tutup