0

I've set up pianobar using the Adafruit instructions with the exception of the LCD panel. I also have my IR remote working using lirc and these instructions. I can get irexec to do simple shell commands such as mpg321 song.mp3 and even start pianobar by setting something like this in my .lircrc file:

begin
  button = KEY_F 
  prog = irexec
  repeat = 0
  config = pianobar
end

(In the above, my KEY_F is mapped to the FM key on my IR remote.) I'd like to map volume up and down (pianobar uses ( and ) for volume control) and quit q to keys on the remote, however setting prog = echo "q" or prog = q don't pass those buttons to pianobar. Does anyone have any experience with controlling pianobar with an IR remote? I don't have to use irexec but that's about where my knowledge caps out at the moment.

5
  • Just re-read the instruction on the page you linked to. You need to have lirc learn what ir-codes are generated by the other keys on the remote, and what keyboard-key it needs to assign to them. You can get a list of available keys by running the irrecord --list-namespace command. You don't have to add to to .lircrc, as lirc will just make them behave like keyboard presses.
    – Gerben
    Aug 16, 2013 at 20:33
  • @Gerben true, I can assign the various keys of my IR-remote to the keys that pianobar is expecting, but pianobar doesn't know to look for keypresses from the IR receiver, so there's something else missing. Aug 16, 2013 at 20:56
  • When I setup the keys on my remote and used something like KEY_7, when I pressed the key on the remote, the number 7 would appear on the console. Just as if I were to press the 7 on the keyboard. So lirc will kind of simulate a keyboard. So in my case I had to rename the keys to none-predefined once, to prevent this unwanted behavior. But in your case that is exactly what you want.
    – Gerben
    Aug 16, 2013 at 21:27
  • @Gerben Can you elaborate on your system further? I don't get the same response, but I am also accessing my RPi via SSH so am not looking at the console per se. Aug 17, 2013 at 0:23
  • Via SSH you wouldn't see this output. I don't really recall anything else, besides what I posted here above. As it wasn't what I wanted.
    – Gerben
    Aug 17, 2013 at 20:33

1 Answer 1

1

It seems you can also control pianobar from the command line, instead of the UI. I see a file called remote.sh in the git-repository. Either find it in your filesystem, or just copy and past in into your own remote.sh file.

To let the remote select the next song, add the following in your .lircrc file

begin
  button = NAME_YOU_GAVE_BUTTON_IN_IRRECORD 
  prog = irexec
  repeat = 0
  config = /path/to/remote.sh next
end

remote.sh is very limited it what you can do with it, but I wouldn't be surprised if you could just add other option.

for volume-up you could use

begin
  button = NAME_YOU_GAVE_BUTTON_IN_IRRECORD 
  prog = irexec
  repeat = 0
  config = amixer set Master 5+
end

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.