diff options
author | 2016-01-13 10:25:31 +0000 | |
---|---|---|
committer | 2016-01-13 10:25:31 +0000 | |
commit | e08b9924103eabf1c0a3087a43a2983006f0031f (patch) | |
tree | 923e96fa6ad25795c3842b0a82b26749c5cf1420 /sys/dev/i2c | |
parent | Add data structures and defines for Generic and I2C Serial Bus Connection (diff) | |
download | wireguard-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')
-rw-r--r-- | sys/dev/i2c/ihidev.c | 7 | ||||
-rw-r--r-- | sys/dev/i2c/ihidev.h | 3 |
2 files changed, 6 insertions, 4 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, diff --git a/sys/dev/i2c/ihidev.h b/sys/dev/i2c/ihidev.h index d65498735cd..47c0e153c11 100644 --- a/sys/dev/i2c/ihidev.h +++ b/sys/dev/i2c/ihidev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.h,v 1.1 2016/01/12 01:11:15 jcs Exp $ */ +/* $OpenBSD: ihidev.h,v 1.2 2016/01/13 10:25:31 kettenis Exp $ */ /* * HID-over-i2c driver * @@ -71,6 +71,7 @@ struct ihidev_softc { i2c_addr_t sc_addr; void *sc_ih; + u_int sc_hid_desc_addr; union { uint8_t hid_desc_buf[sizeof(struct i2c_hid_desc)]; struct i2c_hid_desc hid_desc; |