From nobody Wed Jan 24 16:40:26 2024 X-Original-To: freebsd-usb@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 4TKqSw3NPdz58KVV for ; Wed, 24 Jan 2024 16:40:32 +0000 (UTC) (envelope-from frank.hilgendorf@posteo.de) Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4TKqSv4JDfz4wGh for ; Wed, 24 Jan 2024 16:40:31 +0000 (UTC) (envelope-from frank.hilgendorf@posteo.de) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=posteo.de header.s=2017 header.b=PYrLQ8qH; dmarc=pass (policy=none) header.from=posteo.de; spf=pass (mx1.freebsd.org: domain of frank.hilgendorf@posteo.de designates 185.67.36.66 as permitted sender) smtp.mailfrom=frank.hilgendorf@posteo.de Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E9AEC240101 for ; Wed, 24 Jan 2024 17:40:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.de; s=2017; t=1706114427; bh=wIWViS1yhdAxoDyHjMmzUwQ9AsSSVcXAsrpboYVg5rI=; h=From:Content-Type:Content-Transfer-Encoding:Mime-Version:Subject: Message-Id:Date:To:From; b=PYrLQ8qHoW/WocdAzTPDprThzbtSgrOSK0gpEMAhPjPjYq9jFWVb1norlITL6cXO4 le5C5IcsmpbfLvQhTDUCiqAB0w5x5s93GqKQCwwOqq1b4NQgDirSZgN+50T17nPTbr h2MILp1H661kStd1LPMUJnkNq9Il0DMgwSJGBYz3mdkCNTxciZCU+H/YvSLTn5vJOm djilVZCASk77xCrc3FVe7WeURqT7DbDNfBbJQqbH/NpxZnnmOAmmqep8FigyLTcOOi xP9fTUhutmipAj+taiE0FD5BHuDNwIJX/CvQ+U1XcX5vEW4vamL+FDem3AehivZd3J KmCrT1jGRo8dg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TKqSq3nTrz9rxM for ; Wed, 24 Jan 2024 17:40:27 +0100 (CET) From: Frank Hilgendorf Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: ukbd - Different approach for key swap on Apple keyboards Message-Id: <9D6F7423-185F-4446-9DB2-8FAE8065E67B@posteo.de> Date: Wed, 24 Jan 2024 16:40:26 +0000 To: freebsd-usb@freebsd.org X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.10 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; DWL_DNSWL_LOW(-1.00)[posteo.de:dkim]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_DKIM_ARC_DNSWL_MED(-0.50)[]; DMARC_POLICY_ALLOW(-0.50)[posteo.de,none]; MV_CASE(0.50)[]; SUBJECT_ENDS_SPACES(0.50)[]; RWL_MAILSPIKE_EXCELLENT(-0.40)[185.67.36.66:from]; R_DKIM_ALLOW(-0.20)[posteo.de:s=2017]; R_SPF_ALLOW(-0.20)[+ip4:185.67.36.0/23]; RCVD_IN_DNSWL_MED(-0.20)[185.67.36.66:from]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-usb@freebsd.org]; ARC_NA(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; DKIM_TRACE(0.00)[posteo.de:+]; FROM_EQ_ENVFROM(0.00)[]; MISSING_XM_UA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-usb@freebsd.org]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_NONE(0.00)[]; ASN(0.00)[asn:8495, ipnet:185.67.36.0/23, country:DE]; MIME_TRACE(0.00)[0:+]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 4TKqSv4JDfz4wGh Hi, I am struggling bit with the keyboard setup on an old Apple notebook = and would like to propose a change in ukbd.c The ukbd keyboard driver contains a swap function for the [<>] and [=C2=B0= ^] keys on Apple keyboards.=20 The decision to activate the key swap is based on the presence of the = [Eject] key in the keyboard HID table. On my old MacbookPro 3,1 with german keyboard, swapping is not activated = although it would be necessary. This is because the [Eject] key is located in a separate HID table. Looking into the git log and into the archives of this mailing list, I = found that this theme has been addressed early 2010. A patch had been added that enabled the swap key logic also on the = presence of the [FN] key. After a short time this patch has been = reverted.=20 The back and forth in the patches indicates that the implemented logic = to activate key swap does not work precisely enough. Approach 1) The driver should not only check whether it is an Apple keyboard or not, = but should as well check whether it is an ANSI / ISO / JIS keyboard. The ISO keyboard has the left [SHIFT] key split into [SHIFT] and [<>] = keys. My assumption is, that key swap is necessary for ISO keyboards (as = mine is), but not for ANSI keyboards. (I don't know nothing about the = japanese JIS keyboards). This can be accomplished using the USB vendor-ID and product-ID. Apple = ANSI, ISO and JIS keyboards have different product IDs. This could simply be a static table with [product ID / swap flag] in the = driver (similar to the one in the atp trackpad driver).=20 As a disadvantage, this table would have to updated each time Apple = releases a new keyboard type. Approach 2) Simpler: don't let the driver try to figure out whether to swap or not. = Just add a sysctl variable and let the user decide. What do you think would be the best solution? Regards, Frank=