[Pommed-commits] [SCM] pommed - hotkeys handler for Apple laptops branch, master, updated. 1.37-8-g7046842
Julien BLACHE
jb at jblache.org
Sat Mar 19 13:42:45 UTC 2011
The following commit has been merged in the master branch:
commit feb4ae2511754a003f014934db80a41cbc0af596
Author: Julien BLACHE <jb at jblache.org>
Date: Wed Mar 16 18:58:04 2011 +0100
Allow disabling audio support entirely
diff --git a/ChangeLog b/ChangeLog
index a9d5ad4..f404c2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ version 1.38:
- pommed: add support for the Early 2011 MacBook Pro:
MacBookPro8,1 (13"), MacBookPro8,2 (15"), MacBookPro8,3 (17").
- pommed: add acpi_video0 as a possible sysfs backlight driver.
+ - pommed: allow disabling audio support entirely.
version 1.37:
- pommed: fix oversight in applesmc probing change.
diff --git a/pommed.conf.mactel b/pommed.conf.mactel
index d4d2d2c..2a4f592 100644
--- a/pommed.conf.mactel
+++ b/pommed.conf.mactel
@@ -57,6 +57,9 @@ lcd_nv8600mgt {
# Audio support
audio {
+ # disable audio support entirely
+ disabled = no
+
# Use amixer or alsamixer/alsamixergui to determine the sound card
# and the mixer elements to use here.
@@ -104,6 +107,7 @@ eject {
# Beeper
beep {
# enable/disable beeper
+ # automatically disabled if audio support disabled above
enabled = no
# WAV file to use (from pommed: goutte.wav or click.wav in /usr/share/pommed)
beepfile = "/usr/share/pommed/goutte.wav"
diff --git a/pommed.conf.pmac b/pommed.conf.pmac
index 899fb79..9e7a2c2 100644
--- a/pommed.conf.pmac
+++ b/pommed.conf.pmac
@@ -31,6 +31,9 @@ lcd_sysfs {
# Audio support
audio {
+ # disable audio support entirely
+ disabled = no
+
# Use amixer or alsamixer/alsamixergui to determine the sound card
# and the mixer elements to use here.
@@ -78,6 +81,7 @@ eject {
# Beeper
beep {
# enable/disable beeper
+ # automatically disabled if audio support disabled above
enabled = no
# WAV file to use (from pommed: goutte.wav or click.wav in /usr/share/pommed)
beepfile = "/usr/share/pommed/goutte.wav"
diff --git a/pommed/audio.c b/pommed/audio.c
index fb20867..2a6c410 100644
--- a/pommed/audio.c
+++ b/pommed/audio.c
@@ -150,6 +150,15 @@ audio_init(void)
spkr_elem = NULL;
head_elem = NULL;
+ if (audio_cfg.disabled)
+ {
+ audio_info.level = 0;
+ audio_info.max = 0;
+ audio_info.muted = 1;
+
+ return 0;
+ }
+
play = 1;
ret = snd_mixer_open(&mixer_hdl, 0);
diff --git a/pommed/conffile.c b/pommed/conffile.c
index bec7118..bf9aa3e 100644
--- a/pommed/conffile.c
+++ b/pommed/conffile.c
@@ -95,6 +95,7 @@ static cfg_opt_t lcd_nv8600mgt_opts[] =
static cfg_opt_t audio_opts[] =
{
+ CFG_BOOL("disabled", 0, CFGF_NONE),
CFG_STR("card", "default", CFGF_NONE),
CFG_INT("init", -1, CFGF_NONE),
CFG_INT("step", 10, CFGF_NONE),
@@ -213,13 +214,18 @@ config_print(void)
printf(" on_batt: %d\n", lcd_nv8600mgt_cfg.on_batt);
#endif /* !__powerpc__ */
printf(" + Audio volume control:\n");
- printf(" card: %s\n", audio_cfg.card);
- printf(" initial volume: %d%s\n", audio_cfg.init, (audio_cfg.init > -1) ? "%" : "");
- printf(" step: %d%%\n", audio_cfg.step);
- printf(" beep: %s\n", (audio_cfg.beep) ? "yes" : "no");
- printf(" volume element: %s\n", audio_cfg.vol);
- printf(" speaker element: %s\n", audio_cfg.spkr);
- printf(" headphones element: %s\n", audio_cfg.head);
+ if (audio_cfg.disabled)
+ printf(" disabled: yes\n");
+ else
+ {
+ printf(" card: %s\n", audio_cfg.card);
+ printf(" initial volume: %d%s\n", audio_cfg.init, (audio_cfg.init > -1) ? "%" : "");
+ printf(" step: %d%%\n", audio_cfg.step);
+ printf(" beep: %s\n", (audio_cfg.beep) ? "yes" : "no");
+ printf(" volume element: %s\n", audio_cfg.vol);
+ printf(" speaker element: %s\n", audio_cfg.spkr);
+ printf(" headphones element: %s\n", audio_cfg.head);
+ }
printf(" + Keyboard backlight control:\n");
printf(" default level: %d\n", kbd_cfg.auto_lvl);
printf(" step: %d\n", kbd_cfg.step);
@@ -344,6 +350,7 @@ config_load(void)
#endif /* !__powerpc__ */
sec = cfg_getsec(cfg, "audio");
+ audio_cfg.disabled = cfg_getbool(sec, "disabled");
audio_cfg.card = strdup(cfg_getstr(sec, "card"));
audio_cfg.init = cfg_getint(sec, "init");
audio_cfg.step = cfg_getint(sec, "step");
@@ -369,7 +376,10 @@ config_load(void)
cd_eject_fix_config();
sec = cfg_getsec(cfg, "beep");
- beep_cfg.enabled = cfg_getbool(sec, "enabled");
+ if (audio_cfg.disabled)
+ beep_cfg.enabled = 0;
+ else
+ beep_cfg.enabled = cfg_getbool(sec, "enabled");
beep_cfg.beepfile = strdup(cfg_getstr(sec, "beepfile"));
beep_fix_config();
diff --git a/pommed/conffile.h b/pommed/conffile.h
index 6082160..8b26bfa 100644
--- a/pommed/conffile.h
+++ b/pommed/conffile.h
@@ -37,6 +37,7 @@ struct _lcd_nv8600mgt_cfg {
#endif /* !__powerpc__ */
struct _audio_cfg {
+ int disabled;
char *card;
int init;
int step;
--
pommed - hotkeys handler for Apple laptops
More information about the Pommed-commits
mailing list