Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions evdev/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,10 @@ ioctl_EVIOCGREP(PyObject *self, PyObject *args)
ret = PyArg_ParseTuple(args, "i", &fd);
if (!ret) return NULL;

ioctl(fd, EVIOCGREP, &rep);
ret = ioctl(fd, EVIOCGREP, &rep);
if (ret == -1)
return NULL;

return Py_BuildValue("(ii)", rep[0], rep[1]);
}

Expand All @@ -265,6 +268,9 @@ ioctl_EVIOCSREP(PyObject *self, PyObject *args)
if (!ret) return NULL;

ret = ioctl(fd, EVIOCSREP, &rep);
if (ret == -1)
return NULL;

return Py_BuildValue("i", ret);
}

Expand All @@ -277,6 +283,9 @@ ioctl_EVIOCGVERSION(PyObject *self, PyObject *args)
if (!ret) return NULL;

ret = ioctl(fd, EVIOCGVERSION, &res);
if (ret == -1)
return NULL;

return Py_BuildValue("i", res);
}

Expand Down Expand Up @@ -338,6 +347,9 @@ ioctl_EVIOCG_bits(PyObject *self, PyObject *args)
break;
}

if (ret == -1)
return NULL;

PyObject* res = PyList_New(0);
for (int i=0; i<max; i++) {
if (test_bit(bytes, i)) {
Expand All @@ -357,6 +369,9 @@ ioctl_EVIOCGEFFECTS(PyObject *self, PyObject *args)
if (!ret) return NULL;

ret = ioctl(fd, EVIOCGEFFECTS, &res);
if (ret == -1)
return NULL;

return Py_BuildValue("i", res);
}

Expand All @@ -381,7 +396,7 @@ void print_ff_effect(struct ff_effect* effect) {
effect->u.constant.envelope.attack_level,
effect->u.constant.envelope.fade_length,
effect->u.constant.envelope.fade_level);

break;
case FF_RUMBLE:
fprintf(stderr, " rumble: (%d, %d)\n",
effect->u.rumble.strong_magnitude,
Expand Down
2 changes: 1 addition & 1 deletion evdev/uinput.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ uinput_setup(PyObject *self, PyObject *args) {
if (!ret) return NULL;

memset(&uidev, 0, sizeof(uidev));
strncpy(uidev.name, name, UINPUT_MAX_NAME_SIZE);
strncpy(uidev.name, name, sizeof(uidev.name) - 1);
uidev.id.vendor = vendor;
uidev.id.product = product;
uidev.id.version = version;
Expand Down