summaryrefslogtreecommitdiffstats
path: root/sys/dev/i2c/ihidev.c
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2016-01-13 10:25:31 +0000
committerkettenis <kettenis@openbsd.org>2016-01-13 10:25:31 +0000
commite08b9924103eabf1c0a3087a43a2983006f0031f (patch)
tree923e96fa6ad25795c3842b0a82b26749c5cf1420 /sys/dev/i2c/ihidev.c
parentAdd data structures and defines for Generic and I2C Serial Bus Connection (diff)
downloadwireguard-openbsd-e08b9924103eabf1c0a3087a43a2983006f0031f.tar.xz
wireguard-openbsd-e08b9924103eabf1c0a3087a43a2983006f0031f.zip
Don't confuse the HID descriptor address (which really is an office into the
register space of the i2c device) with the i2c address. For i2c busses enumerated by ACPI we get the address from the I2C Serial Bus Connection Resource Descriptor returned by the _CRS methide of the i2c device. Pass the HID descriptor address in the ia_size member. ok jcs@
Diffstat (limited to 'sys/dev/i2c/ihidev.c')
-rw-r--r--sys/dev/i2c/ihidev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c
index b594836d86a..a65e372762c 100644
--- a/sys/dev/i2c/ihidev.c
+++ b/sys/dev/i2c/ihidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ihidev.c,v 1.2 2016/01/12 17:30:23 deraadt Exp $ */
+/* $OpenBSD: ihidev.c,v 1.3 2016/01/13 10:25:31 kettenis Exp $ */
/*
* HID-over-i2c driver
*
@@ -117,6 +117,7 @@ ihidev_attach(struct device *parent, struct device *self, void *aux)
sc->sc_tag = ia->ia_tag;
sc->sc_addr = ia->ia_addr;
+ sc->sc_hid_desc_addr = ia->ia_size;
printf(": int %d", ia->ia_int);
@@ -239,10 +240,10 @@ ihidev_hid_command(struct ihidev_softc *sc, int hidcmd, void *arg)
* register is passed from the controller, and is probably just
* the address of the device
*/
- uint8_t cmdbuf[] = { htole16(sc->sc_addr), 0x0 };
+ uint8_t cmdbuf[] = { htole16(sc->sc_hid_desc_addr), 0x0 };
DPRINTF(("%s: HID command I2C_HID_CMD_DESCR at 0x%x\n",
- sc->sc_dev.dv_xname, htole16(sc->sc_addr)));
+ sc->sc_dev.dv_xname, htole16(sc->sc_hid_desc_addr)));
/* 20 00 */
res = iic_exec(sc->sc_tag, I2C_OP_WRITE, sc->sc_addr, &cmdbuf,