diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-01-15 01:19:30 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2015-01-15 01:19:30 +0000 |
commit | 8076624d9dfde8b7563d84d44776195d61522ceb (patch) | |
tree | f8eb69ec2103afc1313ee850131560350d95b9f6 /sys/dev/acpi | |
parent | 5987b29cd61d146aaa789012cc34ddeffd6a0c21 (diff) |
Define a new wscons mouse type for Synaptics clickpad devices that lack
physical buttons. This will be used if the acpi pnpid for the mouse
matches a list provided by Synaptics found in Linux.
Combined with the xenocara changes this will remove the need for an xorg
config file for the x240/t440/t540 generation of thinkpads.
ok matthieu@ shadchin@ kettenis@
Diffstat (limited to 'sys/dev/acpi')
-rw-r--r-- | sys/dev/acpi/acpi.c | 84 | ||||
-rw-r--r-- | sys/dev/acpi/acpireg.h | 3 |
2 files changed, 84 insertions, 3 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 4860aa2cdf7..28e0e2ac186 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.279 2015/01/11 19:59:56 kettenis Exp $ */ +/* $OpenBSD: acpi.c,v 1.280 2015/01/15 01:19:28 jsg Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -170,6 +170,55 @@ struct acpi_softc *acpi_softc; #define acpi_bus_space_map _bus_space_map #define acpi_bus_space_unmap _bus_space_unmap +#ifndef SMALL_KERNEL +/* + * This is a list of Synaptics devices with a 'top button area' + * based on the list in Linux supplied by Synaptics + * Synaptics clickpads with the following pnp ids will get a unique + * wscons mouse type that is used to define trackpad regions that will + * emulate mouse buttons + */ +static const char *sbtn_pnp[] = { + "LEN0017", + "LEN0018", + "LEN0019", + "LEN0023", + "LEN002A", + "LEN002B", + "LEN002C", + "LEN002D", + "LEN002E", + "LEN0033", + "LEN0034", + "LEN0035", + "LEN0036", + "LEN0037", + "LEN0038", + "LEN0039", + "LEN0041", + "LEN0042", + "LEN0045", + "LEN0046", + "LEN0047", + "LEN0048", + "LEN0049", + "LEN2000", + "LEN2001", + "LEN2002", + "LEN2003", + "LEN2004", + "LEN2005", + "LEN2006", + "LEN2007", + "LEN2008", + "LEN2009", + "LEN200A", + "LEN200B", +}; + +int mouse_has_softbtn; +#endif + int acpi_gasio(struct acpi_softc *sc, int iodir, int iospace, uint64_t address, int access_size, int len, void *buffer) @@ -2458,8 +2507,31 @@ acpi_foundhid(struct aml_node *node, void *arg) struct acpi_softc *sc = (struct acpi_softc *)arg; struct device *self = (struct device *)arg; const char *dev; + char cdev[16]; struct aml_value res; - struct acpi_attach_args aaa; + struct acpi_attach_args aaa; + int i; + + /* NB aml_eisaid returns a static buffer, this must come first */ + if (aml_evalname(acpi_softc, node->parent, "_CID", 0, NULL, &res) == 0) { + switch (res.type) { + case AML_OBJTYPE_STRING: + dev = res.v_string; + break; + case AML_OBJTYPE_INTEGER: + dev = aml_eisaid(aml_val2int(&res)); + break; + default: + dev = "unknown"; + break; + } + strlcpy(cdev, dev, sizeof(cdev)); + aml_freevalue(&res); + + dnprintf(10, "compatible with device: %s\n", cdev); + } else { + cdev[0] = '\0'; + } dnprintf(10, "found hid device: %s ", node->parent->name); if (aml_evalnode(sc, node, 0, NULL, &res) != 0) @@ -2508,6 +2580,14 @@ acpi_foundhid(struct aml_node *node, void *arg) acpi_toshiba_enabled = 1; } + if (!strcmp(cdev, ACPI_DEV_MOUSE)) { + for (i = 0; i < nitems(sbtn_pnp); i++) { + if (!strcmp(dev, sbtn_pnp[i])) { + mouse_has_softbtn = 1; + break; + } + } + } if (aaa.aaa_name) config_found(self, &aaa, acpi_print); diff --git a/sys/dev/acpi/acpireg.h b/sys/dev/acpi/acpireg.h index 420fe9173e8..839a954a859 100644 --- a/sys/dev/acpi/acpireg.h +++ b/sys/dev/acpi/acpireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: acpireg.h,v 1.29 2013/11/06 10:40:36 mpi Exp $ */ +/* $OpenBSD: acpireg.h,v 1.30 2015/01/15 01:19:28 jsg Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> @@ -729,6 +729,7 @@ struct acpi_ivrs { #define ACPI_DEV_SBD "PNP0C0E" /* Sleep Button Device */ #define ACPI_DEV_PILD "PNP0C0F" /* PCI Interrupt Link Device */ #define ACPI_DEV_MEMD "PNP0C80" /* Memory Device */ +#define ACPI_DEV_MOUSE "PNP0F13" /* PS/2 Mouse */ #define ACPI_DEV_SHC "ACPI0001" /* SMBus 1.0 Host Controller */ #define ACPI_DEV_SMS1 "ACPI0002" /* Smart Battery Subsystem */ #define ACPI_DEV_AC "ACPI0003" /* AC Device */ |