Skip to contentSkip to conversation

keytable: Add source information in generated keymaps

PATCH In review Bastien Nocera 2 participants 5 messages Jan 27, 2021 – Mar 7, 2021 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 keytable: Add source information in generated keymaps

Add comments to mention that keymap files are generated, and list which tool was used to generate them and the kernel source filename.

This should make it less likely that generated files are used as examples to contribute keymaps from, and more likely that upstream changes are channeled through the right source tree.

---
 utils/keytable/gen_keytables.pl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
utils/keytable/gen_keytables.pl +6 -1
index c14aded3..40556479 100755
@@ -36,10 +36,15 @@ 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 "# 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";
Signature · 1 line
2.29.2
#1 lore raw
Quoted 20 lines · Bastien Nocera

Add comments to mention that keymap files are generated, and list which tool was used to generate them and the kernel source filename.

This should make it less likely that generated files are used as examples to contribute keymaps from, and more likely that upstream changes are channeled through the right source tree.

---
 utils/keytable/gen_keytables.pl | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
utils/keytable/gen_keytables.pl +0 -0
index c14aded3..40556479 100755
@@ -36,10 +36,15 @@ sub flush($$)
 	my $filename = shift;
 	my $legacy = shift;
 	my $defined;

utils/keytable/gen_keytables.pl sub flush($$) · line 47

Quoted 10 lines
utils/keytable/gen_keytables.pl +6 -1
+	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 "# Generated with gen_keytables.pl in v4l-utils\n";
+	print OUT "# using $relative_filename as a source file\n";

So on second thought, this is a good idea. How would feel about shortening it to one line, like:

	print OUT "# Generated with gen_keytables.pl from $relative_filename\n";

Thanks

Sean

Quoted 5 lines
utils/keytable/gen_keytables.pl +0 -0
 	print OUT "[[protocols]]\n";
 	print OUT "name = \"$keyname\"\n";
 	print OUT "protocol = \"$type\"\n";
Signature · 1 line
2.29.2
#2 lore raw
Quoted 39 lines · Sean Young
Quoted 26 lines · Bastien Nocera

Add comments to mention that keymap files are generated, and list which
tool was used to generate them and the kernel source filename.

This should make it less likely that generated files are used as examples to contribute keymaps from, and more likely that upstream changes are channeled through the right source tree.

---
 utils/keytable/gen_keytables.pl | 7 ++++++-

 1 file changed, 6 insertions(+), 1 deletion(-)
utils/keytable/gen_keytables.pl +1 -0
index c14aded3..40556479 100755
@@ -36,10 +36,15 @@ sub flush($$)
         my $filename = shift;
         my $legacy = shift;
         my $defined;
+       my $relative_filename = $filename;


        return if (!$keyname || !$out);
-       print "Creating $dir/$keyname.toml\n";

Quoted 8 lines

+       $relative_filename =~ s/^$kernel_dir//;
+       $relative_filename =~ s/^\///;
+       print "Creating $dir/$keyname.toml from $relative_filename\n";
        open OUT, ">$dir/$keyname.toml";
+       print OUT "# Generated with gen_keytables.pl in v4l- utils\n";
+       print OUT "# using $relative_filename as a source file\n";

So on second thought, this is a good idea. How would feel about shortening it to one line, like:

Quoted 2 lines

        print OUT "# Generated with gen_keytables.pl from $relative_filename\n";

That would be fine, yes. Feel free to amend the wording to your liking with my SoB.

Cheers

Quoted 10 lines

Thanks

Sean

Quoted 5 lines

        print OUT "[[protocols]]\n";
        print OUT "name = \"$keyname\"\n";
        print OUT "protocol = \"$type\"\n";

Signature · 1 line
2.29.2
#3 lore raw
Quoted 40 lines · Bastien Nocera
Quoted 39 lines · Sean Young
Quoted 26 lines · Bastien Nocera

Add comments to mention that keymap files are generated, and list which
tool was used to generate them and the kernel source filename.

This should make it less likely that generated files are used as examples to contribute keymaps from, and more likely that upstream changes are channeled through the right source tree.

---
 utils/keytable/gen_keytables.pl | 7 ++++++-

 1 file changed, 6 insertions(+), 1 deletion(-)
utils/keytable/gen_keytables.pl +1 -0
index c14aded3..40556479 100755
@@ -36,10 +36,15 @@ sub flush($$)
         my $filename = shift;
         my $legacy = shift;
         my $defined;
+       my $relative_filename = $filename;


        return if (!$keyname || !$out);
-       print "Creating $dir/$keyname.toml\n";

Quoted 8 lines

+       $relative_filename =~ s/^$kernel_dir//;
+       $relative_filename =~ s/^\///;
+       print "Creating $dir/$keyname.toml from $relative_filename\n";
        open OUT, ">$dir/$keyname.toml";
+       print OUT "# Generated with gen_keytables.pl in v4l- utils\n";
+       print OUT "# using $relative_filename as a source file\n";

So on second thought, this is a good idea. How would feel about shortening it to one line, like:

Quoted 5 lines
Quoted 2 lines

        print OUT "# Generated with gen_keytables.pl from $relative_filename\n";

That would be fine, yes. Feel free to amend the wording to your liking with my SoB.

Thanks -- patch applied

Do you want to fix the rc protocol in the Dell RC 260 keymap and apply?

Sean

Quoted 14 lines

Cheers

Quoted 10 lines

Thanks

Sean

Quoted 5 lines

        print OUT "[[protocols]]\n";
        print OUT "name = \"$keyname\"\n";
        print OUT "protocol = \"$type\"\n";

Signature · 1 line
2.29.2
#4 lore raw
Quoted 48 lines · Sean Young
Quoted 47 lines · Bastien Nocera
Quoted 45 lines · Sean Young
Quoted 30 lines · Bastien Nocera

Add comments to mention that keymap files are generated, and list
which
tool was used to generate them and the kernel source filename.

This should make it less likely that generated files are used as
examples to contribute keymaps from, and more likely that upstream
changes are channeled through the right source tree.

---
 utils/keytable/gen_keytables.pl | 7 ++++++-

 1 file changed, 6 insertions(+), 1 deletion(-)
utils/keytable/gen_keytables.pl +1 -0
index c14aded3..40556479 100755
@@ -36,10 +36,15 @@ 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//;

Quoted 8 lines

+       $relative_filename =~ s/^\///;
+       print "Creating $dir/$keyname.toml from $relative_filename\n";
        open OUT, ">$dir/$keyname.toml";
+       print OUT "# Generated with gen_keytables.pl in v4l- utils\n";
+       print OUT "# using $relative_filename as a source file\n";

So on second thought, this is a good idea. How would feel about shortening it to one line, like:

        print OUT "# Generated with gen_keytables.pl from $relative_filename\n";

Quoted 8 lines
Quoted 3 lines

That would be fine, yes. Feel free to amend the wording to your liking
with my SoB.

Thanks -- patch applied

Do you want to fix the rc protocol in the Dell RC 260 keymap and apply?

I haven't had the time to modify the patch and fix it, probably next week.

Cheers