View previous topic :: View next topic |
Author |
Message |
ZmjbS Tux's lil' helper
Joined: 24 Jan 2005 Posts: 136 Location: Reykjavík, Ísland
|
Posted: Thu Sep 04, 2014 1:43 am Post subject: ACPI not able to run amixer |
|
|
I've been struggling with getting my acpi scripts working. I've narrowed the issue to what seems like a permission problem, but am unsure how to solve it.
Running commands in acpi scripts works only if they're run as a normal user. How do I run them without such a cludge?
Specifically, given (/etc/acpi/default.sh)
Code: | [...]
case "$group" in
button)
case "$action" in
power)
/etc/acpi/actions/powerbtn.sh
;;
volumedown)
/etc/acpi/actions/volume.sh down
;;
volumeup)
/etc/acpi/actions/volume.sh up
;;
[...]
|
and (/etc/acpi/actions/volume.sh)
Code: | #!/bin/bash
case "$1" in
up)
su martin -c "amixer set Master 5%+ unmute"
;;
down)
su martin -c "amixer set Master 5%- unmute"
;;
mute)
su martin -c "amixer set Master toggle"
;;
esac |
I'm able to get the volume keys to work. If I run amixer without su-ing to the user martin, things break.
Ideas? _________________ Signatures are, like, so cool... |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Thu Sep 04, 2014 10:33 pm Post subject: |
|
|
Very weird that root isn't able to see your ALSA hardware...
What does `amixer` on its own print when run as root and as normal user? |
|
Back to top |
|
|
ZmjbS Tux's lil' helper
Joined: 24 Jan 2005 Posts: 136 Location: Reykjavík, Ísland
|
Posted: Thu Sep 04, 2014 10:56 pm Post subject: |
|
|
Ant P. wrote: | Very weird that root isn't able to see your ALSA hardware...
What does `amixer` on its own print when run as root and as normal user? |
Yes, it is. I tried adding root to the audio group, but no use.
Code: | $ amixer
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 65536 [100%] [on]
Front Right: Playback 65536 [100%] [on]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch cswitch-joined
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 16462 [25%] [on]
Front Right: Capture 16462 [25%] [on] |
Code: | # amixer
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
amixer: Mixer attach default error: Connection refused |
_________________ Signatures are, like, so cool... |
|
Back to top |
|
|
wahrwolf n00b
Joined: 05 Jul 2015 Posts: 1
|
Posted: Sun Jul 05, 2015 8:35 pm Post subject: |
|
|
i have the same problem:
tried to config acpid for volume-control, but failed.
the strange thing is that i can ran any other command without trouble.
so i tried to pipe the output from amixer to logger:
My handler looks like:
Code: |
#!/bin/bash
#Handler for audio-managment
case "$1" in
+)
logger 'Volume raised'
amixer -q set Master 5%+
;;
-)
logger 'Volume down'
amixer -q set Master 5%-
;;
t)
logger 'Volume toggle mute'
amixer | logger
;;
esac
|
when i hit the button for toogle (button/mute) in my case i get:
Code: |
Jul 05 22:31:00 archwolf root[1326]: Volume toggle mute
Jul 05 22:31:00 archwolf root[1326]: Simple mixer control 'IEC958',0
Jul 05 22:31:00 archwolf root[1326]: Capabilities: pswitch pswitch-joined
Jul 05 22:31:00 archwolf root[1326]: Playback channels: Mono
Jul 05 22:31:00 archwolf root[1326]: Mono: Playback [on]
|
but when running amixer as normal user (and as root) i get:
Code: |
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 19755 [30%] [on]
Front Right: Playback 19755 [30%] [on]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch cswitch-joined
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 65535 [100%] [off]
Front Right: Capture 65535 [100%] [off]
|
I am using ALSA + Pulseaudio ...
any ideas?
ps sry for bad english |
|
Back to top |
|
|
|