From nobody Thu Oct 2 16:42:01 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ccyHs21CFz69WJs; Thu, 02 Oct 2025 16:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ccyHs1LRgz3jrn; Thu, 02 Oct 2025 16:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759423321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g0Lhjn59Sa5s76+qQr5m8mxJjHMr9AOH2Y+eY/UsW2o=; b=fCPvlwMUKszsQak3JYPxhCfmEEb5demfAVnMaPa/ut0yo9+yquSiJrf/CNLfaDctm9u27w Qebnr12gNebF6mM3Kh9miycsn9qtfg/gPvk8YPZAyFOG2gZoYmQHjRSD0tCuh6exzTDoYJ iraxeKg5MHsYWprRDMiHwCYU1mij7GiasfHHgDl9NEiznP/O7Y3gdfKlhs6b2vPlcDt1tu u0qyRuUuoe/2ypDgWP51LHd5GrVLfPxlIxS90Co5Ntv4+yxhPVPbgPW9ickrT7X61ddl9Z zzSRO5npXwxYoxwYw0leSWrXx/28WRwHgn3hs/w32avop8YeLAmcr7pPctzj4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759423321; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=g0Lhjn59Sa5s76+qQr5m8mxJjHMr9AOH2Y+eY/UsW2o=; b=wC7VC9z2cKv70JE703ys0U8Bofsbvh4ipB5++l8uWAr1Y7981vBoupjyjlc10KPz+ufpU+ Vevqy42GrG7baI8sHNwmS6OeQBkxFBFL8kBqak90l8jALJA7Y/Yv0RtPcX/R0PZ/eBEXMl JY8BaJEX2OXs5Kau1+2yW+/uRwW5gxAm+niXI//7FclYeiemROW3422wtwJumGK83aqrCX 6OfwVnTZ0taFp6kXGo3KRxofyt3xxWSfOM6PaSOszAJi2N/rU7wWF5ROdIIFWyxF+G/yJd RJX9lXC9ziYZjHGXCQM3oFv5nn0rMrvvLgRWxL9ZulLpDAKhWkynmAimi92+PQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759423321; a=rsa-sha256; cv=none; b=RtvjgHEIRzAUTm2DfPFvYS4n5Dpsilz/R3p0Li5QVr/AF4X85ZkesA3B9XzfFVY/yFUJyz hP11B9W+OmTLPvCMcxPselq4UOz5oUttj+jmG1KeEvY5mN0oYzWbLXx4mcDH9r95iA8/64 vqLTAEKOWtUQddP4Borys0SostUZ3KRbBrJNIbCnaMRrClbn3NCC0QhYLyWpX30UmgivCz yat7AGWueo2zFgyu4YaO/6Lj4ho/VeajmJYCmYVLK90wBWd+6hEb1+G/dBU/Xoc1pbav23 5sjmOw/GJF9AtczZYyxFQoZqvafxCGjxQPbSxPhdGBFejNiulCCyKo3PRkEb2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ccyHs0fvSz1p7; Thu, 02 Oct 2025 16:42:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 592Gg1a1003657; Thu, 2 Oct 2025 16:42:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 592Gg18C003654; Thu, 2 Oct 2025 16:42:01 GMT (envelope-from git) Date: Thu, 2 Oct 2025 16:42:01 GMT Message-Id: <202510021642.592Gg18C003654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 2acabc7318ac - stable/14 - hkbd: remove error detection in KDSKBSTATE ioctl List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2acabc7318ac47401e078de28e7b89a38b356cb9 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2acabc7318ac47401e078de28e7b89a38b356cb9 commit 2acabc7318ac47401e078de28e7b89a38b356cb9 Author: ShengYi Hung AuthorDate: 2025-08-21 17:59:15 +0000 Commit: Ed Maste CommitDate: 2025-10-02 16:41:17 +0000 hkbd: remove error detection in KDSKBSTATE ioctl The KDSKBSTATE ioctl brings the LED up. However, some keyboards (like qemu keyboard) may not have LED or failed to set the LED due to unexpected reason. Therefore, removing the error check as ukbd(4) does allow the keyboard works correctly with kbdcontrol(4). Also move hw.hid.hkbd.no_leds sysctl out of HID_BUG thus users can disable setting LEDs PR: 288968 Reviewed by: wulf Tested by: trashcan@ellael.org, marklmi26-fbsd@yahoo.com, trkellers@gmail.coom Approved by: lwsu (mentor), markj (mentor) MFC after 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52101 (cherry picked from commit 1685192ea1faac28f2d4feede53e70b6a380500f) (cherry picked from commit 6ea7e1f92882706cc8818a13e8bd55b7d2f48e27) --- sys/dev/hid/hkbd.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 5eff7557bc42..6255c42d3b62 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -95,14 +95,16 @@ #ifdef HID_DEBUG static int hkbd_debug = 0; +#endif static int hkbd_no_leds = 0; static SYSCTL_NODE(_hw_hid, OID_AUTO, hkbd, CTLFLAG_RW, 0, "USB keyboard"); +#ifdef HID_DEBUG SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, debug, CTLFLAG_RWTUN, &hkbd_debug, 0, "Debug level"); +#endif SYSCTL_INT(_hw_hid_hkbd, OID_AUTO, no_leds, CTLFLAG_RWTUN, &hkbd_no_leds, 0, "Disables setting of keyboard leds"); -#endif #define INPUT_EPOCH global_epoch_preempt @@ -1596,8 +1598,16 @@ hkbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg) sc->sc_state &= ~LOCK_MASK; sc->sc_state |= *(int *)arg; - /* set LEDs and quit */ - return (hkbd_ioctl_locked(kbd, KDSETLED, arg)); + /* + * Attempt to set the keyboard LEDs; ignore the return value + * intentionally. Note: Some hypervisors/emulators (e.g., QEMU, + * Parallels—at least as of the time of writing) may fail when + * setting LEDs. This can prevent kbdmux from attaching the + * keyboard, which in turn may block the console from accessing + * it. + */ + (void)hkbd_ioctl_locked(kbd, KDSETLED, arg); + return (0); case KDSETREPEAT: /* set keyboard repeat rate (new * interface) */ @@ -1766,10 +1776,8 @@ hkbd_set_leds(struct hkbd_softc *sc, uint8_t leds) SYSCONS_LOCK_ASSERT(); DPRINTF("leds=0x%02x\n", leds); -#ifdef HID_DEBUG if (hkbd_no_leds) return (0); -#endif memset(sc->sc_buffer, 0, HKBD_BUFFER_SIZE); @@ -1820,6 +1828,7 @@ hkbd_set_leds(struct hkbd_softc *sc, uint8_t leds) SYSCONS_UNLOCK(); error = hid_write(sc->sc_dev, buf, len); SYSCONS_LOCK(); + DPRINTF("error %d", error); return (error); }