mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2025-12-27 22:00:07 +01:00
touchpad: unify internal/external touchpad tagging
To unify this we need to move the tagging process forward so tp_init() can rely on it for config setup. This means moving it to the touchpad init code. Other than that no real functional changes, the rules stay the same: * serial/i2c/etc. are considered internal touchpads * Bluetooth is always external * USB is external for Logitech devices * USB is external for Wacom devices * USB is internal for Apple touchpads And if we can't figure it out, we assume it's external and log a message so we can put a quirk in place. https://bugs.freedesktop.org/show_bug.cgi?id=96735 Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
4923c404e8
commit
0c51a52389
3 changed files with 55 additions and 20 deletions
|
|
@ -1421,11 +1421,10 @@ tp_dwt_device_is_blacklisted(struct evdev_device *device)
|
|||
unsigned int bus = libevdev_get_id_bustype(device->evdev);
|
||||
|
||||
/* evemu will set the right bus type */
|
||||
if (bus == BUS_BLUETOOTH || bus == BUS_VIRTUAL)
|
||||
if (bus == BUS_VIRTUAL)
|
||||
return true;
|
||||
|
||||
/* Wacom makes touchpads, but not internal ones */
|
||||
if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD)
|
||||
if (device->tags & EVDEV_TAG_EXTERNAL_TOUCHPAD)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -1449,10 +1448,6 @@ tp_want_dwt(struct evdev_device *touchpad,
|
|||
if (bus_tp == BUS_I8042 && bus_kbd != bus_tp)
|
||||
return false;
|
||||
|
||||
/* Logitech does not have internal touchpads */
|
||||
if (vendor_tp == VENDOR_ID_LOGITECH)
|
||||
return false;
|
||||
|
||||
/* For Apple touchpads, always use its internal keyboard */
|
||||
if (vendor_tp == VENDOR_ID_APPLE) {
|
||||
return vendor_kbd == vendor_tp &&
|
||||
|
|
@ -1573,11 +1568,25 @@ tp_interface_device_removed(struct evdev_device *device,
|
|||
tp_resume(tp, device);
|
||||
}
|
||||
|
||||
void
|
||||
static inline void
|
||||
evdev_tag_touchpad_internal(struct evdev_device *device)
|
||||
{
|
||||
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
||||
device->tags &= ~EVDEV_TAG_EXTERNAL_TOUCHPAD;
|
||||
}
|
||||
|
||||
static inline void
|
||||
evdev_tag_touchpad_external(struct evdev_device *device)
|
||||
{
|
||||
device->tags |= EVDEV_TAG_EXTERNAL_TOUCHPAD;
|
||||
device->tags &= ~EVDEV_TAG_INTERNAL_TOUCHPAD;
|
||||
}
|
||||
|
||||
static void
|
||||
evdev_tag_touchpad(struct evdev_device *device,
|
||||
struct udev_device *udev_device)
|
||||
{
|
||||
int bustype;
|
||||
int bustype, vendor;
|
||||
|
||||
/* simple approach: touchpads on USB or Bluetooth are considered
|
||||
* external, anything else is internal. Exception is Apple -
|
||||
|
|
@ -1585,11 +1594,39 @@ evdev_tag_touchpad(struct evdev_device *device,
|
|||
* external USB touchpads anyway.
|
||||
*/
|
||||
bustype = libevdev_get_id_bustype(device->evdev);
|
||||
if (bustype == BUS_USB) {
|
||||
vendor = libevdev_get_id_vendor(device->evdev);
|
||||
|
||||
switch (bustype) {
|
||||
case BUS_USB:
|
||||
if (device->model_flags & EVDEV_MODEL_APPLE_TOUCHPAD)
|
||||
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
||||
} else if (bustype != BUS_BLUETOOTH)
|
||||
device->tags |= EVDEV_TAG_INTERNAL_TOUCHPAD;
|
||||
evdev_tag_touchpad_internal(device);
|
||||
break;
|
||||
case BUS_BLUETOOTH:
|
||||
evdev_tag_touchpad_external(device);
|
||||
break;
|
||||
default:
|
||||
evdev_tag_touchpad_internal(device);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (vendor) {
|
||||
/* Logitech does not have internal touchpads */
|
||||
case VENDOR_ID_LOGITECH:
|
||||
evdev_tag_touchpad_external(device);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Wacom makes touchpads, but not internal ones */
|
||||
if (device->model_flags & EVDEV_MODEL_WACOM_TOUCHPAD)
|
||||
evdev_tag_touchpad_external(device);
|
||||
|
||||
if ((device->tags &
|
||||
(EVDEV_TAG_EXTERNAL_TOUCHPAD|EVDEV_TAG_INTERNAL_TOUCHPAD)) == 0) {
|
||||
log_bug_libinput(evdev_libinput_context(device),
|
||||
"%s: Internal or external? Please file a bug.\n",
|
||||
device->devname);
|
||||
evdev_tag_touchpad_external(device);
|
||||
}
|
||||
}
|
||||
|
||||
static struct evdev_dispatch_interface tp_interface = {
|
||||
|
|
@ -2309,6 +2346,8 @@ evdev_mt_touchpad_create(struct evdev_device *device)
|
|||
{
|
||||
struct tp_dispatch *tp;
|
||||
|
||||
evdev_tag_touchpad(device, device->udev_device);
|
||||
|
||||
tp = zalloc(sizeof *tp);
|
||||
if (!tp)
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -2243,7 +2243,6 @@ evdev_configure_device(struct evdev_device *device)
|
|||
"input device '%s', %s is a touchpad\n",
|
||||
device->devname, devnode);
|
||||
|
||||
evdev_tag_touchpad(device, device->udev_device);
|
||||
return device->dispatch == NULL ? -1 : 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,8 +68,9 @@ enum evdev_device_seat_capability {
|
|||
enum evdev_device_tags {
|
||||
EVDEV_TAG_EXTERNAL_MOUSE = (1 << 0),
|
||||
EVDEV_TAG_INTERNAL_TOUCHPAD = (1 << 1),
|
||||
EVDEV_TAG_TRACKPOINT = (1 << 2),
|
||||
EVDEV_TAG_KEYBOARD = (1 << 3),
|
||||
EVDEV_TAG_EXTERNAL_TOUCHPAD = (1 << 2),
|
||||
EVDEV_TAG_TRACKPOINT = (1 << 3),
|
||||
EVDEV_TAG_KEYBOARD = (1 << 4),
|
||||
};
|
||||
|
||||
enum evdev_middlebutton_state {
|
||||
|
|
@ -333,10 +334,6 @@ evdev_tablet_create(struct evdev_device *device);
|
|||
struct evdev_dispatch *
|
||||
evdev_tablet_pad_create(struct evdev_device *device);
|
||||
|
||||
void
|
||||
evdev_tag_touchpad(struct evdev_device *device,
|
||||
struct udev_device *udev_device);
|
||||
|
||||
void
|
||||
evdev_device_led_update(struct evdev_device *device, enum libinput_led leds);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue