diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-08-12 10:03:06 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2023-08-12 10:03:06 +0000 |
commit | b67baca3143ae9e35a2cab87599de5ddee889a37 (patch) | |
tree | a18c7a64c2376141f443445373416261fac997fc /sys/dev | |
parent | 00e111fbedd61afb0d3b5497048ad048769e46db (diff) |
Don't power down if the device is already opened. This happens when an
ikbd(4) attaches and becomes the console keyboard. We would power down
the device but never power it on again when userland opened ikbd(4) as
an input device since that is only done on the first open. The result
was a non-functioning keyboard if the hardware actually implemented the
power down command. A lot of hardware actually doesn't (which is why
this wasn't noticed for some time) but the ASUS X205T does.
ok miod@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/i2c/ihidev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/i2c/ihidev.c b/sys/dev/i2c/ihidev.c index 233739404d1..d028930347a 100644 --- a/sys/dev/i2c/ihidev.c +++ b/sys/dev/i2c/ihidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ihidev.c,v 1.28 2022/08/31 15:14:01 kettenis Exp $ */ +/* $OpenBSD: ihidev.c,v 1.29 2023/08/12 10:03:05 kettenis Exp $ */ /* * HID-over-i2c driver * @@ -198,6 +198,9 @@ ihidev_attach(struct device *parent, struct device *self, void *aux) sc->sc_subdevs[repid] = (struct ihidev *)dev; } + if (sc->sc_refcnt > 0) + return; + /* power down until we're opened */ if (ihidev_hid_command(sc, I2C_HID_CMD_SET_POWER, &I2C_HID_POWER_OFF)) { printf("%s: failed to power down\n", sc->sc_dev.dv_xname); |