#include "config.h"
#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "linux/input.h"
}
static void
+evdev_tag_external_mouse(struct evdev_device *device,
+ struct udev_device *udev_device)
+{
+ int bustype;
+
+ bustype = libevdev_get_id_bustype(device->evdev);
+ if (bustype == BUS_USB || bustype == BUS_BLUETOOTH) {
+ if (device->seat_caps & EVDEV_DEVICE_POINTER)
+ device->tags |= EVDEV_TAG_EXTERNAL_MOUSE;
+ }
+}
+
+static void
fallback_process(struct evdev_dispatch *dispatch,
struct evdev_device *device,
struct input_event *event,
free(dispatch);
}
+static void
+fallback_tag_device(struct evdev_device *device,
+ struct udev_device *udev_device)
+{
+ evdev_tag_external_mouse(device, udev_device);
+}
+
static int
evdev_calibration_has_matrix(struct libinput_device *libinput_device)
{
fallback_destroy,
NULL, /* device_added */
NULL, /* device_removed */
+ fallback_tag_device,
};
static uint32_t
return 0;
}
+
static inline int
evdev_need_mtdev(struct evdev_device *device)
{
!libevdev_has_event_code(evdev, EV_ABS, ABS_MT_SLOT));
}
+static void
+evdev_tag_device(struct evdev_device *device)
+{
+ struct udev *udev;
+ struct udev_device *udev_device = NULL;
+
+ udev = udev_new();
+ if (!udev)
+ return;
+
+ udev_device = udev_device_new_from_syspath(udev, device->syspath);
+ if (udev_device) {
+ if (device->dispatch->interface->tag_device)
+ device->dispatch->interface->tag_device(device, udev_device);
+ udev_device_unref(udev_device);
+ }
+ udev_unref(udev);
+}
+
static int
evdev_configure_device(struct evdev_device *device)
{
goto err;
list_insert(seat->devices_list.prev, &device->base.link);
+
+ evdev_tag_device(device);
evdev_notify_added_device(device);
return device;
EVDEV_DEVICE_TOUCH = (1 << 2)
};
+enum evdev_device_tags {
+ EVDEV_TAG_EXTERNAL_MOUSE = (1 << 0),
+ EVDEV_TAG_INTERNAL_TOUCHPAD = (1 << 1),
+};
+
struct mt_slot {
int32_t seat_slot;
int32_t x, y;
enum evdev_event_type pending_event;
enum evdev_device_seat_capability seat_caps;
+ enum evdev_device_tags tags;
int is_mt;
/* A device was removed */
void (*device_removed)(struct evdev_device *device,
struct evdev_device *removed_device);
+
+ /* Tag device with one of EVDEV_TAG */
+ void (*tag_device)(struct evdev_device *device,
+ struct udev_device *udev_device);
};
struct evdev_dispatch {