#include "test_hal_libinput_eventgen.h"
#include "test_hal_libinput_mtdev_check.h"
#include <limits.h>
+#include <errno.h>
#include <libevdev/libevdev.h>
#include <libevdev/libevdev-uinput.h>
struct udev_device *udev_device = libinput_device_get_udev_device(dev);
enum libinput_event_type type;
const char *devnode;
+ errno = 0;
switch(libinput_event_get_type(ev)) {
case LIBINPUT_EVENT_DEVICE_ADDED:
devices[devices_cnt].cap = LIBINPUT_DEVICE_CAP_KEYBOARD;
devices[devices_cnt++].path = devnode;
int fd = open(devnode, O_RDWR);
+ if (fd < 0) {
+ LOGE("ERROR: %m\n");
+ return -1;
+ }
unsigned long evbits[NLONGS(EV_CNT)] = { 0 };
ioctl(fd, EVIOCGBIT(0, sizeof(evbits)), evbits);
if (!evdev_bit_is_set(evbits, EV_KEY))
if(evdev_bit_is_set(keybits, i)){
break;
}
+ close(fd);
}
}
}
{
int fd = -1;
int n = 0;
+ errno = 0;
struct record_event rc_e;
struct record_libinput_event_pointer p[] = {
LOG("create_mouse_event\n");
fd = open(devices[idx].path, O_RDWR);
if (fd < 0) {
- LOGE("ERROR: could not open device\n");
+ LOGE("ERROR: could not open device. %m\n");
return -1;
}
{
int fd = -1;
int n = 0;
+ errno = 0;
struct record_event rc_e;
struct record_libinput_event_keyboard k[] = {
LOG("create_keyboard_event\n");
fd = open(devices[idx].path, O_RDWR);
if (fd < 0) {
- LOGE("ERROR: could not open device\n");
+ LOGE("ERROR: could not open device. %m\n");
return -1;
}
int multi_touch_support(struct libinput *li, int idx)
{
int fd = -1;
+ errno = 0;
if(devices[idx].cap == LIBINPUT_DEVICE_CAP_TOUCH){
LOG("multi_touch_support\n");
fd = open(devices[idx].path, O_RDONLY | O_NONBLOCK);
if (fd < 0) {
- LOGE("ERROR: could not open device\n");
+ LOGE("ERROR: could not open device. %m\n");
return -1;
}
if (ioctl(fd, EVIOCGRAB, 1)) {
- LOGE("ERROR: could not grab the device\n");
+ close(fd);
+ LOGE("ERROR: could not grab the device. %m\n");
return -1;
}
if (check_device_mtprops(fd) < 0) {
ioctl(fd, EVIOCGRAB, 0);
close(fd);
- LOGE("ERROR: NO mt must props\n");
+ LOGE("ERROR: NO mt must props. %m\n");
return -1;
}
ioctl(fd, EVIOCGRAB, 0);
{
int fd = -1;
int n = 0;
+ errno = 0;
struct record_event rc_e;
struct record_libinput_event_touch t[] = {
LOG("create_touch_event\n");
fd = open(devices[idx].path, O_RDWR);
if (fd < 0) {
- LOGE("ERROR: could not open device\n");
+ LOGE("ERROR: could not open device. %m\n");
return -1;
}