Message ID | 20210126174514.1393240-1-hadess@hadess.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | keytable: Add source information in generated keymaps | expand |
On Tue, Jan 26, 2021 at 06:45:14PM +0100, Bastien Nocera wrote: > 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. > > Signed-off-by: Bastien Nocera <hadess@hadess.net> > --- > utils/keytable/gen_keytables.pl | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl > index c14aded3..40556479 100755 > --- a/utils/keytable/gen_keytables.pl > +++ b/utils/keytable/gen_keytables.pl > @@ -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"; 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 > print OUT "[[protocols]]\n"; > print OUT "name = \"$keyname\"\n"; > print OUT "protocol = \"$type\"\n"; > -- > 2.29.2
On Sat, 2021-03-06 at 14:49 +0000, Sean Young wrote: > On Tue, Jan 26, 2021 at 06:45:14PM +0100, Bastien Nocera wrote: > > 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. > > > > Signed-off-by: Bastien Nocera <hadess@hadess.net> > > --- > > utils/keytable/gen_keytables.pl | 7 ++++++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/utils/keytable/gen_keytables.pl > > b/utils/keytable/gen_keytables.pl > > index c14aded3..40556479 100755 > > --- a/utils/keytable/gen_keytables.pl > > +++ b/utils/keytable/gen_keytables.pl > > @@ -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"; > > 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"; That would be fine, yes. Feel free to amend the wording to your liking with my SoB. Cheers > > Thanks > > Sean > > > print OUT "[[protocols]]\n"; > > print OUT "name = \"$keyname\"\n"; > > print OUT "protocol = \"$type\"\n"; > > -- > > 2.29.2
On Sat, Mar 06, 2021 at 04:26:53PM +0100, Bastien Nocera wrote: > On Sat, 2021-03-06 at 14:49 +0000, Sean Young wrote: > > On Tue, Jan 26, 2021 at 06:45:14PM +0100, Bastien Nocera wrote: > > > 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. > > > > > > Signed-off-by: Bastien Nocera <hadess@hadess.net> > > > --- > > > utils/keytable/gen_keytables.pl | 7 ++++++- > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > diff --git a/utils/keytable/gen_keytables.pl > > > b/utils/keytable/gen_keytables.pl > > > index c14aded3..40556479 100755 > > > --- a/utils/keytable/gen_keytables.pl > > > +++ b/utils/keytable/gen_keytables.pl > > > @@ -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"; > > > > 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"; > > 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 > > Cheers > > > > > Thanks > > > > Sean > > > > > print OUT "[[protocols]]\n"; > > > print OUT "name = \"$keyname\"\n"; > > > print OUT "protocol = \"$type\"\n"; > > > -- > > > 2.29.2 >
On Sat, 2021-03-06 at 15:34 +0000, Sean Young wrote: > On Sat, Mar 06, 2021 at 04:26:53PM +0100, Bastien Nocera wrote: > > On Sat, 2021-03-06 at 14:49 +0000, Sean Young wrote: > > > On Tue, Jan 26, 2021 at 06:45:14PM +0100, Bastien Nocera wrote: > > > > 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. > > > > > > > > Signed-off-by: Bastien Nocera <hadess@hadess.net> > > > > --- > > > > utils/keytable/gen_keytables.pl | 7 ++++++- > > > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/utils/keytable/gen_keytables.pl > > > > b/utils/keytable/gen_keytables.pl > > > > index c14aded3..40556479 100755 > > > > --- a/utils/keytable/gen_keytables.pl > > > > +++ b/utils/keytable/gen_keytables.pl > > > > @@ -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"; > > > > > > 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"; > > > > 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
diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl index c14aded3..40556479 100755 --- a/utils/keytable/gen_keytables.pl +++ b/utils/keytable/gen_keytables.pl @@ -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";
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. Signed-off-by: Bastien Nocera <hadess@hadess.net> --- utils/keytable/gen_keytables.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)