sensors.conf: explain how to enable/disable beeps
Hi all,
Currently there isn't any documentation on how to enable/disable beeps globally in lm-sensors, except when looking into the sources.
I propose to add some comments about that into sensors.conf. The attached patch add a few lines about beeps at the beginning of that file, and also a line to the "heavily commented LM78 example".
Bye,
Aurelien
Signature · 35 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineering Student `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net -------------- next part -------------- diff -urN lm_sensors2.orig/etc/sensors.conf.eg lm_sensors2/etc/sensors.conf.eg --- lm_sensors2.orig/etc/sensors.conf.eg 2004-05-09 22:37:06.000000000 +0200 +++ lm_sensors2/etc/sensors.conf.eg 2004-05-10 00:16:19.000000000 +0200 @@ -221,6 +221,18 @@ # yet supported; spaces at the end are ignored, though. # # +# BEEPS +# ----- +# Some chips support alarms with beep warnings. When an alarm is triggered +# you can be warned by a beeping signal through your computer speaker. It +# is possible to enable all beeping globally using the following line: +# +# set beep_enable 1 +# +# or disable them using: +# +# set beep_enable 0 +# ########################################################################## #### Here begins the real configuration file @@ -312,6 +324,8 @@ # the CPU temperature. # label temp "M/B Temp" +# Uncomment the followingline to enable all beeping globally +# set beep_enable 1 chip "lm75-*"
Quoted 3 lines · Philip Pokorny
I'd suggest you not use the term "globally" as that implies (to *me* anyway) that it applies to all chips in the system, when in fact it only applies to the chip in which it appears.
You're right. I didn't think to the fact that this file is the same for all chips when writing this comment.
I fixed it using your suggestion, please find a new patch attached.
Signature · 36 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineering Student `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net -------------- next part -------------- diff -urN lm_sensors2.orig/etc/sensors.conf.eg lm_sensors2/etc/sensors.conf.eg --- lm_sensors2.orig/etc/sensors.conf.eg 2004-05-10 14:55:55.000000000 +0200 +++ lm_sensors2/etc/sensors.conf.eg 2004-05-10 14:52:16.000000000 +0200 @@ -221,6 +221,19 @@ # yet supported; spaces at the end are ignored, though. # # +# BEEPS +# ----- +# Some chips support alarms with beep warnings. When an alarm is triggered +# you can be warned by a beeping signal through your computer speaker. It +# is possible to enable beeps for all alarms on a chip using the following +# line: +# +# set beep_enable 1 +# +# or disable them using: +# +# set beep_enable 0 +# ########################################################################## #### Here begins the real configuration file @@ -312,6 +325,8 @@ # the CPU temperature. # label temp "M/B Temp" +# Uncomment the following line to enable all beeping globally +# set beep_enable 1 chip "lm75-*"
Quoted 10 lines · Philip Pokorny
That's great, but I think you missed one:
(quoted diff) +2
-0@@ -312,6 +325,8 @@ # the CPU temperature. # label temp "M/B Temp" +# Uncomment the following line to enable all beeping globally +# set beep_enable 1chip "lm75-*"
That's because I am the specialist of broken patches or patches with problems... In almost all cases, I need to send a patch three times until it is correct :-)
New patch attached, hope this time it will be ok.
Signature · 37 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineering Student `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net -------------- next part -------------- diff -urN lm_sensors2.orig/etc/sensors.conf.eg lm_sensors2/etc/sensors.conf.eg --- lm_sensors2.orig/etc/sensors.conf.eg 2004-05-11 02:12:44.000000000 +0200 +++ lm_sensors2/etc/sensors.conf.eg 2004-05-11 02:12:36.000000000 +0200 @@ -221,6 +221,19 @@ # yet supported; spaces at the end are ignored, though. # # +# BEEPS +# ----- +# Some chips support alarms with beep warnings. When an alarm is triggered +# you can be warned by a beeping signal through your computer speaker. It +# is possible to enable beeps for all alarms on a chip using the following +# line: +# +# set beep_enable 1 +# +# or disable them using: +# +# set beep_enable 0 +# ########################################################################## #### Here begins the real configuration file @@ -312,6 +325,9 @@ # the CPU temperature. # label temp "M/B Temp" +# Uncomment the following line to enable beeps for all alarms on this chip +# set beep_enable 1 + chip "lm75-*"
Quoted 4 lines
That's because I am the specialist of broken patches or patches with problems... In almost all cases, I need to send a patch three times until it is correct :-)
Some people are specialist of sending no patch at all. I prefer your way ;)
It may take a few tries to get to the correct patch but at least we end up with something great everyone can enjoy.
Quoted 1 line
New patch attached, hope this time it will be ok.
It's fine, I'll apply that.
Maybe it would be worth adding that some chips also have individual beep enable/disable bits mapped on alarm bits? Not sure though, since the rest of the sensors.conf.eg file does mention neither the alarms nor the beeps entries.
Jean
Quoted 8 lines · Jean Delvare
Quoted 1 line
New patch attached, hope this time it will be ok.
It's fine, I'll apply that.
Maybe it would be worth adding that some chips also have individual beep enable/disable bits mapped on alarm bits? Not sure though, since the rest of the sensors.conf.eg file does mention neither the alarms nor the beeps entries.
I have thinked of that, however it may be difficult for the users to look into the sources to get the masks to enable or disable individual alarms.
Maybe the first thing to do is to list the masks for each chip that support individual alarms in the documentation.
Signature · 4 lines
.''`. Aurelien Jarno GPG: 1024D/F1BCDB73 : :' : Debian GNU/Linux developer | Electrical Engineering Student `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 6 lines
Quoted 5 lines
Maybe it would be worth adding that some chips also have individual beep enable/disable bits mapped on alarm bits? Not sure though, since the rest of the sensors.conf.eg file does mention neither the alarms nor the beeps entries.
Quoted 6 lines
I have thinked of that, however it may be difficult for the users to look into the sources to get the masks to enable or disable individual alarms.
Maybe the first thing to do is to list the masks for each chip that support individual alarms in the documentation.
You're right. The fact that it's chip dependant doesn't help. Documenting all chips would be much work, not necessarily worth it (most people probably don't care about enabling individual beeps).
BTW, this is something that we are supposed to work on for the sysfs (2.6) interface: splitting alarm files over individual files, such as temp1_status, etc... so that the interface is truly chip-independant.
There are several approaches to the problem. Either we attach alarms to a channel, or to a limit. And beeps can be part of it or in different files. If we leave beeps apart for now, here are the two possibilities I see:
1* One status file per channel:
in0_inputin0_minin0_maxin0_status <-- new filetemp1_inputtemp1_mintemp1_maxtemp1_crittemp1_status <-- new file
Each status file would be a bitfield.0x01 = min limit alarm0x02 = max limit alarm0x04 = crit limit alarm0x08 = open diode
etc... The value of each bit would have to be defined once for all, and be as common as possible between channel types, where it makes sense. Of course, not all alarms would be possible for every type, nor for every real channel within a type (depending on what the chip implements).
2* One file by limit:
in0_inputin0_minin0_min_alarm <-- new filein0_maxin0_max_status <-- new filetemp1_inputtemp1_input_alarm <-- new filetemp1_mintemp1_min_alarm <-- new filetemp1_maxtemp1_max_alarm <-- new filetemp1_crittemp1_crit_alarm <-- new file
Here, each file would simply contain 1 or 0. The temp1_input_alarm file is used for non-limit related alarms (open diode for example). I can't think of a case where the alarm files would have non-boolean values, but maybe there are.
Each approach has its pros and cons:
Method #1: Pros: Fewer files, scripts can easily know if there is any alarm set for a channel (non-zero value). Cons: The user-space needs to know the meaning of the bits. The bits have to be wisely chosen once and for all, covering all possibilities (at lest of all chips we know of as of today).
Method #2: Pros: No preliminary knowledge necessary, the interface is self explaining. Can be easily implemented and extended. Cons: almost doubles the number of files in the sysfs interface.
I have no string preference (yet). Insight welcome.
(After that, the same shall be done for the individual beep bits, of course.
Note that in any case the old alarm files will have to be kept, at least in a first time, so as to preserve compatibility with existing tools (sensors & libsensors).
Thanks,
Jean
Quoted 11 lines · Jean Delvare
Method #1: Pros: Fewer files, scripts can easily know if there is any alarm set for a channel (non-zero value). Cons: The user-space needs to know the meaning of the bits. The bits have to be wisely chosen once and for all, covering all possibilities (at lest of all chips we know of as of today).
Method #2: Pros: No preliminary knowledge necessary, the interface is self explaining. Can be easily implemented and extended. Cons: almost doubles the number of files in the sysfs interface.
I have no string preference (yet). Insight welcome.
I prefer method 2. It also allows languages that can't handle bit operations easily to access the values (like bash...)
thanks,
greg k-h
Quoted 6 lines · Philip Pokorny
bash can handle bit operations just fine.
bash$ echo $(( 7 & 2 ))
2
bash$ echo $(( 8 & 2 ))
0
Heh, you can tell I am not a good bash programmer :)
Quoted 1 line
So that shouldn't be a concern.
Ok, nevermind.
Quoted 10 lines
I'd like to make another suggestion. Put meaningful text strings as the contents of the
_statusfile:LOW (for low alarm)
HIGH (for high alarm)
FAIL (for diode failure)
ALARM (for generic alarm)
HIGH, FAIL (for multiple alarms)
"" (null string for no alarm)
Quoted 3 lines
Then the sensors library and other
tools/languagescan just "cat" the contents to get the status and test for non-null string to see if there is an active alarm or not.
Ah, I like this even better. We would never need to display more than one status at a time per device, right?
thanks,
greg k-h
Quoted 19 lines
Quoted 11 lines
Quoted 11 lines
I'd like to make another suggestion. Put meaningful text strings as the contents of the
_statusfile:LOW (for low alarm)
HIGH (for high alarm)
FAIL (for diode failure)
ALARM (for generic alarm)
HIGH, FAIL (for multiple alarms)
"" (null string for no alarm)Quoted 6 lines
Quoted 3 lines
Then the sensors library and other
tools/languagescan just "cat" the contents to get the status and test for non-null string to see if there is an active alarm or not.Ah, I like this even better. We would never need to display more than one status at a time per device, right?
Quoted 8 lines
I suppose it depends on what you mean. As I said, there is a case like:
"ALARM, FAIL" (for multiple alarms)
Which could be construed as "more than one status" but they are all alarms for the same parameter so I see this as a single value.
Correct, some chips have individual alarm bits for several failure conditions, so there could be more than one alarm.
For example, the PC87366 temperature channels have a low limit alarm, a high limit alarm, a critical limit alarm and a diode fault alarm. Plus a common alarm bit which is set if any of the individual bits is. This common bit can additionally be masked out.
Unless we only show the more relevant element each time? FAIL would take precedence over alarms, CRIT over HIGH, HIGH over LOW (although this conflict denotes a configuration error).
I guess that different chips have more or less individual bits (to start with, they may have less than three limits), each of which could be individually maskable. All in all this means that hendling all possible cases will probably lead us to an unnecessary complex interface.
My point is that most users probably won't need these fine-grained controls. They typically want to know what temperature their system is, and be warned if it's too hot. Some chips have become over-featured and I don't think we need to export all the configurability to user-space. For one thing, the BIOS is supposed to have set most things up for us, and the reasonable chip defaults should do the rest. Having too much files in our sysfs interface is likely to just confuse the user with no benefit.
For this reason, I think that the first question we should ask ourselves is what we really want the user to see and have control on. Are we interested in exporting individual alarms for, say, low, high and critical limits? Most chips have a single bit for all these. Maybe we can make the other chips look the same, if we think that there is not much added value in detailing the alarms. Probably it's different for failed readings, for which we want a different bit, because the error is of a different nature.
Then there's the same question for alarm masks where they exists, and beep mask where they exist. Is it worth giving the user full control over these? I'm not sure. BIOS is supposed to have done it properly, and I believe most users don't care.
The choice of individual files vs. commom files and strings vs. numbers merely depends on the level of details we want to give to the user, IMHO.
Quoted 3 lines
But having to read multiple files to get the complete alarm status for a given input would be annoying. Especially if it means having to read all of (
_min_status,_max_status,_crit_status,_fail_status, etc...)
I think I agree with that. Having separate files is probably not very script-friendly.
All in all, Philip's proposal seems to be the best one (single file with comma-separated strings), although I was a bit reluctant with exporting alarms as strings in the first place (because it promises some parsing overhead for the future libsensors). Looks like we are condemned to choosing between script-oriented or library-oriented optimizations?
It could also be discussed whether we want to add ALARM when any of LOW, HIGH or CRIT is set so that scripts can simply grep for ALARM.
A completely different approach is to hide these fine grained alarms to the user. This means we have just two possible alarms (at most) for each
channel: limit crossed or hardware failure. Since these are two different things, having two different (boolean) files may make sense.
As you can see, I really have no strong opinion on what should be done... I hate this when we just can't figure out the "correct" approach to follow, because most likely we'll find out why we did not choose the correct one *after* the decision was made and the choice implemented ;(
Jean
I'd suggest you not use the term "globally" as that implies (to *me* anyway) that it applies to all chips in the system, when in fact it only applies to the chip in which it appears.
Rather use something more verbose like "enable beeps for all alarms on this chip"
:v)
Quoted 49 lines · Aurelien Jarno
Hi all,
Currently there isn't any documentation on how to enable/disable beeps globally in lm-sensors, except when looking into the sources.
I propose to add some comments about that into sensors.conf. The attached patch add a few lines about beeps at the beginning of that file, and also a line to the "heavily commented LM78 example".
Bye,
Aurelien------------------------------------------------------------------------
diff -urN lm_sensors2.orig/etc/sensors.conf.eg lm_sensors2/etc/sensors.conf.eg
etc/sensors.conf.eg +14
-0@@ -221,6 +221,18 @@ # yet supported; spaces at the end are ignored, though. # # +# BEEPS +# ----- +# Some chips support alarms with beep warnings. When an alarm is triggered +# you can be warned by a beeping signal through your computer speaker. It +# is possible to enable all beeping globally using the following line: +# +# set beep_enable 1 +# +# or disable them using: +# +# set beep_enable 0 +# ########################################################################## #### Here begins the real configuration file@@ -312,6 +324,8 @@ # the CPU temperature. # label temp "M/B Temp" +# Uncomment the followingline to enable all beeping globally +# set beep_enable 1chip "lm75-*"
That's great, but I think you missed one:
@@ -312,6 +325,8 @@
# the CPU temperature. # label temp "M/B Temp"
+# Uncomment the following line to enable all beeping globally
+# set beep_enable 1
chip "lm75-*"
Quoted 16 lines · Aurelien Jarno
Quoted 5 lines · Philip Pokorny
I'd suggest you not use the term "globally" as that implies (to *me* anyway) that it applies to all chips in the system, when in fact it only applies to the chip in which it appears.
You're right. I didn't think to the fact that this file is the same for all chips when writing this comment.
I fixed it using your suggestion, please find a new patch attached.
Signature · 4 lines
Philip Pokorny, Director of Engineering Tel: 415-954-2823 Fax: 415-954-2899 Toll Free: 888-PENGUIN PENGUIN COMPUTING, INC. www.penguincomputing.com
[grin] I've been there and done that as well...
Looks great!
:v)
Quoted 62 lines · Aurelien Jarno
Quoted 9 lines · Philip Pokorny
That's great, but I think you missed one:
(quoted diff) +2
-0@@ -312,6 +325,8 @@ # the CPU temperature. # label temp "M/B Temp" +# Uncomment the following line to enable all beeping globally +# set beep_enable 1Quoted 3 lines
chip "lm75-*"
That's because I am the specialist of broken patches or patches with problems... In almost all cases, I need to send a patch three times until it is correct :-)
New patch attached, hope this time it will be ok.
------------------------------------------------------------------------
diff -urN lm_sensors2.orig/etc/sensors.conf.eg lm_sensors2/etc/sensors.conf.eg
etc/sensors.conf.eg +16
-0@@ -221,6 +221,19 @@ # yet supported; spaces at the end are ignored, though. # # +# BEEPS +# ----- +# Some chips support alarms with beep warnings. When an alarm is triggered +# you can be warned by a beeping signal through your computer speaker. It +# is possible to enable beeps for all alarms on a chip using the following +# line: +# +# set beep_enable 1 +# +# or disable them using: +# +# set beep_enable 0 +# ########################################################################## #### Here begins the real configuration file@@ -312,6 +325,9 @@ # the CPU temperature. # label temp "M/B Temp" +# Uncomment the following line to enable beeps for all alarms on this chip +# set beep_enable 1 +chip "lm75-*"
Signature · 4 lines
Philip Pokorny, Director of Engineering Tel: 415-954-2823 Fax: 415-954-2899 Toll Free: 888-PENGUIN PENGUIN COMPUTING, INC. www.penguincomputing.com
Quoted 13 lines · Greg KH
Quoted 10 lines · Jean Delvare
Method #1: Pros: Fewer files, scripts can easily know if there is any alarm set for a channel (non-zero value). Cons: The user-space needs to know the meaning of the bits. The bits have to be wisely chosen once and for all, covering all possibilities (at lest of all chips we know of as of today).
Method #2: Pros: No preliminary knowledge necessary, the interface is self explaining. Can be easily implemented and extended. Cons: almost doubles the number of files in the sysfs interface.
Quoted 8 lines
Quoted 3 lines
I have no string preference (yet). Insight welcome.
I prefer method 2. It also allows languages that can't handle bit operations easily to access the values (like bash...)
bash can handle bit operations just fine.
bash$ echo $(( 7 & 2 ))
2
bash$ echo $(( 8 & 2 ))
0
So that shouldn't be a concern.
I'd like to make another suggestion. Put meaningful text strings as the contents of the _status file:
LOW (for low alarm)
HIGH (for high alarm)
FAIL (for diode failure)
ALARM (for generic alarm)
HIGH, FAIL (for multiple alarms)
"" (null string for no alarm)
Then the sensors library and other tools/languages can just "cat" the contents to get the status and test for non-null string to see if there is an active alarm or not.
:v)
Signature · 4 lines
Philip Pokorny, Director of Engineering Tel: 415-954-2823 Fax: 415-954-2899 Toll Free: 888-PENGUIN PENGUIN COMPUTING, INC. www.penguincomputing.com
Quoted 34 lines · Greg KH
Quoted 8 lines · Philip Pokorny
bash can handle bit operations just fine.
bash$ echo $(( 7 & 2 ))
2
bash$ echo $(( 8 & 2 ))
0Heh, you can tell I am not a good bash programmer :)
Quoted 3 lines
So that shouldn't be a concern.
Ok, nevermind.
Quoted 10 lines
I'd like to make another suggestion. Put meaningful text strings as the contents of the
_statusfile:LOW (for low alarm)
HIGH (for high alarm)
FAIL (for diode failure)
ALARM (for generic alarm)
HIGH, FAIL (for multiple alarms)
"" (null string for no alarm)
Quoted 10 lines
Quoted 5 lines
Then the sensors library and other
tools/languagescan just "cat" the contents to get the status and test for non-null string to see if there is an active alarm or not.Ah, I like this even better. We would never need to display more than one status at a time per device, right?
I suppose it depends on what you mean. As I said, there is a case like:
"ALARM, FAIL" (for multiple alarms)
Which could be construed as "more than one status" but they are all alarms for the same parameter so I see this as a single value.
One other thing to consider is if individual alarms can be masked (similar to the way interrupts can be masked) then we might want yet another parameter to mask a given alarm. If "ALARM" is individually maskable from "FAIL", then they would need to be split into multiple foo_status parameters with matching foo_status_mask values.
For example, the EMC6D100 which is supported by the LM85 driver has seperate status bits for diode faults and over limit conditions. Each status is individually maskable, but only the over/under limit status can generate an interrupt. And you can't tell an over-limit from an under-limit condition unless you check the current input, and limits.
temp0_input
temp0_alarm_status
temp0_alarm_status_mask
temp0_fail_status
temp0_fail_status_mask
temp0_min
temp0_max
But having to read multiple files to get the complete alarm status for a given input would be annoying. Especially if it means having to read all of (_min_status, _max_status, _crit_status, _fail_status, etc...)
:v)
Signature · 4 lines
Philip Pokorny, Director of Engineering Tel: 415-954-2823 Fax: 415-954-2899 Toll Free: 888-PENGUIN PENGUIN COMPUTING, INC. www.penguincomputing.com