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@
-/* $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
*
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);