From patchwork Mon Jul 1 16:38:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Nocera X-Patchwork-Id: 11026451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B4CB1398 for ; Mon, 1 Jul 2019 16:38:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3A1B2874E for ; Mon, 1 Jul 2019 16:38:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6C2928759; Mon, 1 Jul 2019 16:38:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A33F62874E for ; Mon, 1 Jul 2019 16:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729297AbfGAQiQ (ORCPT ); Mon, 1 Jul 2019 12:38:16 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:47163 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729230AbfGAQiQ (ORCPT ); Mon, 1 Jul 2019 12:38:16 -0400 X-Originating-IP: 83.155.44.161 Received: from classic.redhat.com (mon69-7-83-155-44-161.fbx.proxad.net [83.155.44.161]) (Authenticated sender: hadess@hadess.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 372861C0002 for ; Mon, 1 Jul 2019 16:38:15 +0000 (UTC) From: Bastien Nocera To: linux-media@vger.kernel.org Subject: [PATCH 1/2] keytable: Add source information in generated keymaps Date: Mon, 1 Jul 2019 18:38:12 +0200 Message-Id: <20190701163813.25032-1-hadess@hadess.net> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add comments to mention that keymap files are generated, and that they shouldn't be modified by hand. Also list which tool was used to generate them and the kernel source filename. Signed-off-by: Bastien Nocera --- utils/keytable/gen_keytables.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl index 4124e366..3dc74ba6 100755 --- a/utils/keytable/gen_keytables.pl +++ b/utils/keytable/gen_keytables.pl @@ -36,10 +36,17 @@ sub flush($$) my $filename = shift; my $legacy = shift; my $defined; + my $relative_filename = $filename; return if (!$keyname || !$out); - print "Creating $dir/$keyname.toml\n"; + $relative_filename =~ s/^$kernel_dir//; + $relative_filename =~ s/^\///; + print "Creating $dir/$keyname.toml from $relative_filename\n"; open OUT, ">$dir/$keyname.toml"; + print OUT "# This file is a generated data file, do not modify manually\n"; + print OUT "#\n"; + print OUT "# Generated with gen_keytables.pl in v4l-utils\n"; + print OUT "# using $relative_filename as a source file\n"; print OUT "[[protocols]]\n"; print OUT "name = \"$keyname\"\n"; print OUT "protocol = \"$type\"\n"; From patchwork Mon Jul 1 16:38:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bastien Nocera X-Patchwork-Id: 11026453 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C77951398 for ; Mon, 1 Jul 2019 16:38:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B87992874E for ; Mon, 1 Jul 2019 16:38:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACA9228755; Mon, 1 Jul 2019 16:38:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E88942874F for ; Mon, 1 Jul 2019 16:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729301AbfGAQiR (ORCPT ); Mon, 1 Jul 2019 12:38:17 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:42267 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729264AbfGAQiR (ORCPT ); Mon, 1 Jul 2019 12:38:17 -0400 X-Originating-IP: 83.155.44.161 Received: from classic.redhat.com (mon69-7-83-155-44-161.fbx.proxad.net [83.155.44.161]) (Authenticated sender: hadess@hadess.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id B8A551C0007 for ; Mon, 1 Jul 2019 16:38:15 +0000 (UTC) From: Bastien Nocera To: linux-media@vger.kernel.org Subject: [PATCH 2/2] keytable: Remove comments before processing keymaps Date: Mon, 1 Jul 2019 18:38:13 +0200 Message-Id: <20190701163813.25032-2-hadess@hadess.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190701163813.25032-1-hadess@hadess.net> References: <20190701163813.25032-1-hadess@hadess.net> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Do our best to remove comments from each line we process from the keymap sources, so as to avoid commented duplicates and false positives sneaking in to the keymap definitions. Signed-off-by: Bastien Nocera --- utils/keytable/gen_keytables.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl index 3dc74ba6..d73daf58 100755 --- a/utils/keytable/gen_keytables.pl +++ b/utils/keytable/gen_keytables.pl @@ -138,6 +138,9 @@ sub parse_file($$) } if ($read) { + # Remove comments + ~ s#/\*.*?\*/##sg; + ~ s#.*\*/##sg; if (m/(0x[\dA-Fa-f]+)[\s\,]+(KEY|BTN)(\_[^\s\,\}]+)/) { $out .= "$1 = \"$2$3\"\n"; next;