~mmach/netext73/lm-sensors

« back to all changes in this revision

Viewing changes to debian/patches/02-sensors-conf-convert-improvements.patch

  • Committer: mmach
  • Date: 2020-02-05 20:28:34 UTC
  • Revision ID: netbit73@gmail.com-20200205202834-zc3sla47j9e700w5
3.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
---
 
2
 etc/sensors-conf-convert |   17 ++++++++++++++++-
 
3
 1 file changed, 16 insertions(+), 1 deletion(-)
 
4
 
 
5
--- a/etc/sensors-conf-convert
 
6
+++ b/etc/sensors-conf-convert
 
7
@@ -34,7 +34,7 @@
 
8
 # the user doesn't have a bad surprise when uncommenting them.
 
9
 
 
10
 use strict;
 
11
-use vars qw($debug $chip %trans @delete %chip_trans %chip_delete);
 
12
+use vars qw($debug $chip %trans @delete %chip_trans %chip_delete $first_part $second_part $compute_next);
 
13
 
 
14
 BEGIN
 
15
 {
 
16
@@ -480,3 +480,18 @@
 
17
                $_ = substitute_line($chip, $_);
 
18
        }
 
19
 }
 
20
+
 
21
+# Formula changes (in0 -> in0_input)
 
22
+if (m/^([\s#]*compute\s+\S+)(.*)/) {
 
23
+       $first_part = $1;
 
24
+       $second_part = $2;
 
25
+       $second_part =~ s/in(\d+)/in$1_input/gi;
 
26
+       $_ = "$first_part$second_part\n";
 
27
+       $compute_next = 1 if (m/\\$/);
 
28
+} elsif ($compute_next) {
 
29
+       s/in(\d+)/in$1_input/gi;
 
30
+       $compute_next = 0 if (! m/\\$/);
 
31
+} else {
 
32
+       $compute_next = 0;
 
33
+}
 
34
+