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: 133
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.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2592
Location: UK

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: 133
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
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