From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 688373307B for ; Sat, 29 Jun 2024 10:24:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719656680; cv=none; b=VAM9PT/ntl/YDxU0Ir85N3fRnO17znrZ6g8JQM4AhjaR7wpx3oGh4f/e5jgQPTaKdCU0ZCzbaiSZjTNADIal/6VgA+il/uRNYfMaVGKEuVizGrLDmc02qy+CAjMlElG5dYfDDbafH7F/Ti/eMb5a3oskt1jff0ZwnL05pSdTBrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719656680; c=relaxed/simple; bh=OapE7sg65WMiSu49NyLirbHlOt1IbYD+5ireh8Xu5TY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RpgxqxDslaWBCHM+HIQ4odUAt5juKU8gsYNOabAFKZI54w3F0lP+xEnzymzXOncp4hNTHhhzhiFRbfVr3MGgdoaXQztLd/kXnTWD8ovCORDjWBA3h/7UWts6CPzKJa76TcgTbrGHaSXEl1jNes/GQgbxPi7mX2BQ0YzQZwf7Zi8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tXG5i/Wz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tXG5i/Wz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3307CC2BBFC; Sat, 29 Jun 2024 10:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719656679; bh=OapE7sg65WMiSu49NyLirbHlOt1IbYD+5ireh8Xu5TY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tXG5i/WzIdOk266l0eo49U384ty9vF0UPc7gXy+ixX4CWpBgunmxWotqQyOBlRevL WPDVBXmSuiS2tLLuurXPhbjN9kRhUh0JsgjsJJENfqNxBkewCPc9WYJtWz3r8ys7+8 px2miuaXe4/8+pS9uAyLChJkqdXu8N2IBZpiGmaOqEgFW4E0fn4qowVEND7I9WYFNh BzUDjGLfaJXlSR86QP6dBv6ESmtZlZoD+sLBK3/T6kFovrf3/zd7mrJ+Ff4QArInEs HRMM0nXT3y5fdvan5CenyCU8y/pB/mR7CGkoomIpG4x5gzLgSI8PDchJou1+C9aVVk XH1ZP3tpNpBSg== Date: Sat, 29 Jun 2024 12:24:35 +0200 From: Alexey Gladkov To: Oleg Bulatov Cc: kbd@lists.linux.dev Subject: Re: [PATCH] libkeymap: dump action codes for keycode 0 Message-ID: References: <20240621214116.209379-1-oleg@bulatov.me> Precedence: bulk X-Mailing-List: kbd@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240621214116.209379-1-oleg@bulatov.me> On Fri, Jun 21, 2024 at 11:41:09PM +0200, Oleg Bulatov wrote: > Keymaps in mac/* use keycode 0. For example, mac-qwerty-layout has the > following definition: >=20 > keycode 0 =3D a >=20 > Therefore, dumpkeys should print definitions starting from 0, not 1. >=20 > Signed-off-by: Oleg Bulatov Applied. Thanks! > --- > src/libkeymap/dump.c | 4 +-- > .../dumpkeys-fulltable/mac-qwerty-layout.map | 28 +++++++++++++++++++ > .../dumpkeys-fulltable/ruwin_cplk-UTF-8.map | 1 + > tests/libkeymap.at | 9 ++++++ > 4 files changed, 40 insertions(+), 2 deletions(-) > create mode 100644 tests/data/dumpkeys-fulltable/mac-qwerty-layout.map >=20 > diff --git a/src/libkeymap/dump.c b/src/libkeymap/dump.c > index 4dee51b..499cafd 100644 > --- a/src/libkeymap/dump.c > +++ b/src/libkeymap/dump.c > @@ -429,7 +429,7 @@ void lk_dump_keys(struct lk_ctx *ctx, FILE *fd, lk_ta= ble_shape table, char numer > if (!(j !=3D ja && lk_map_exists(ctx, j) && lk_map_exists(ctx, ja))) > continue; > =20 > - for (i =3D 1; i < NR_KEYS; i++) { > + for (i =3D 0; i < NR_KEYS; i++) { > int buf0, buf1, type; > =20 > buf0 =3D lk_get_key(ctx, j, i); > @@ -455,7 +455,7 @@ void lk_dump_keys(struct lk_ctx *ctx, FILE *fd, lk_ta= ble_shape table, char numer > not_alt_is_meta: > no_shorthands: > =20 > - for (i =3D 1; i < NR_KEYS; i++) { > + for (i =3D 0; i < NR_KEYS; i++) { > all_holes =3D 1; > =20 > for (j =3D 0; j < keymapnr; j++) { > diff --git a/tests/data/dumpkeys-fulltable/mac-qwerty-layout.map b/tests/= data/dumpkeys-fulltable/mac-qwerty-layout.map > new file mode 100644 > index 0000000..8313b0c > --- /dev/null > +++ b/tests/data/dumpkeys-fulltable/mac-qwerty-layout.map > @@ -0,0 +1,28 @@ > +keymaps 0 > +alt_is_meta > +keycode 0 =3D a =20 > +keycode 1 =3D s =20 > +keycode 2 =3D d =20 > +keycode 3 =3D f =20 > +keycode 4 =3D h =20 > +keycode 5 =3D g =20 > +keycode 6 =3D z =20 > +keycode 7 =3D x =20 > +keycode 8 =3D c =20 > +keycode 9 =3D v =20 > +keycode 11 =3D b =20 > +keycode 12 =3D q =20 > +keycode 13 =3D w =20 > +keycode 14 =3D e =20 > +keycode 15 =3D r =20 > +keycode 16 =3D y =20 > +keycode 17 =3D t =20 > +keycode 31 =3D o =20 > +keycode 32 =3D u =20 > +keycode 34 =3D i =20 > +keycode 35 =3D p =20 > +keycode 37 =3D l =20 > +keycode 38 =3D j =20 > +keycode 40 =3D k =20 > +keycode 45 =3D n =20 > +keycode 46 =3D m =20 > diff --git a/tests/data/dumpkeys-fulltable/ruwin_cplk-UTF-8.map b/tests/d= ata/dumpkeys-fulltable/ruwin_cplk-UTF-8.map > index 80c6672..625b76a 100644 > --- a/tests/data/dumpkeys-fulltable/ruwin_cplk-UTF-8.map > +++ b/tests/data/dumpkeys-fulltable/ruwin_cplk-UTF-8.map > @@ -1,4 +1,5 @@ > keymaps 0-255 > +keycode 0 =3D 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 =20 > keycode 1 =3D 0x001b 0x001b 0x001b 0x001= b 0x0200 0x0200 0x0200 0x0200 = 0x081b 0x0200 0x081b 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 =20 > keycode 2 =3D 0x0031 0x0021 0x0031 0x002= 1 0x0200 0x0200 0x0200 0x0200 = 0x0831 0x0821 0x0831 0x0821 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 =20 > keycode 3 =3D 0x0032 0x0040 0x0032 0x002= 2 0x0000 0x0200 0x0000 0x0200 = 0x0832 0x0840 0x0832 0x0840 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0= 200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x02= 00 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0= x0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x020= 0 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x= 0200 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 = 0x0200 0x0200 0x0200 0x0200 0x0200= 0x0200 0x0200 0x0200 0x0200 = 0x0200 =20 > diff --git a/tests/libkeymap.at b/tests/libkeymap.at > index 929d1cc..a7f8ccc 100644 > --- a/tests/libkeymap.at > +++ b/tests/libkeymap.at > @@ -147,6 +147,15 @@ AT_CHECK([$abs_builddir/helpers/libkeymap-dumpkeys $= abs_srcdir/data/dumpkeys-ful > [0], [expout]) > AT_CLEANUP > =20 > +AT_SETUP([test 25 (keycode 0)]) > +AT_KEYWORDS([libkeymap unittest]) > +cp -f -- \ > + "$abs_srcdir/data/dumpkeys-fulltable/mac-qwerty-layout.map" \ > + expout > +AT_CHECK([$abs_builddir/helpers/libkeymap-dumpkeys $abs_srcdir/data/dump= keys-fulltable/mac-qwerty-layout.map DEFAULT FALSE], > + [0], [expout]) > +AT_CLEANUP > + > AT_SETUP([binary keymap (us.map)]) > AT_KEYWORDS([libkeymap unittest]) > AT_SKIP_IF([ test "$(arch)" !=3D "x86_64" ]) > --=20 > 2.44.2 >=20 >=20 --=20 Rgrds, legion