Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
ACPI not able to run amixer
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
ZmjbS
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2005
Posts: 136
Location: Reykjavík, Ísland

PostPosted: Thu Sep 04, 2014 1:43 am    Post subject: ACPI not able to run amixer Reply with quote

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
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Thu Sep 04, 2014 10:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
ZmjbS
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2005
Posts: 136
Location: Reykjavík, Ísland

PostPosted: Thu Sep 04, 2014 10:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
wahrwolf
n00b
n00b


Joined: 05 Jul 2015
Posts: 1

PostPosted: Sun Jul 05, 2015 8:35 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum