Skip to content

Instantly share code, notes, and snippets.

@ggirou
Last active June 16, 2022 20:33
Show Gist options
  • Save ggirou/0fd2cb3af7a6eb8124dc64795ee47023 to your computer and use it in GitHub Desktop.
Save ggirou/0fd2cb3af7a6eb8124dc64795ee47023 to your computer and use it in GitHub Desktop.
LIRC carmp3 remote config
# Please take the time to finish this file as described in
# https://sourceforge.net/p/lirc-remotes/wiki/Checklist/
# and make it available to others by sending it to
# <lirc@bartelmus.de>
#
# This config file was automatically generated
# using lirc-0.10.1(default) on Wed Jun 15 19:30:21 2022
# Command line used: -d /dev/lirc0 this_special_remote.conf
# Kernel version (uname -r): 5.10.92+
#
# Remote name (as of config file): carmp3
# Brand of remote device, the thing you hold in your hand:
# Remote device model nr:
# Remote device info url:
# Does remote device has a bundled capture device e. g., a
# usb dongle? :
# For bundled USB devices: usb vendor id, product id
# and device string (use dmesg or lsusb):
# Type of device controlled
# (TV, VCR, Audio, DVD, Satellite, Cable, HTPC, ...) :
# Device(s) controlled by this remote:
begin remote
name carmp3
bits 24
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 8932 4492
one 520 1729
zero 520 583
ptrail 517
repeat 8934 2267
pre_data_bits 8
pre_data 0x0
gap 107472
toggle_bit_mask 0x0
frequency 38000
begin codes
KEY_CHANNELDOWN 0xFFA25D
KEY_CHANNEL 0xFF629D
KEY_CHANNELUP 0xFFE21D
KEY_PREVIOUS 0xFF22DD
KEY_NEXT 0xFF02FD
KEY_PLAYPAUSE 0xFFC23D
KEY_VOLUMEDOWN 0xFFE01F
KEY_VOLUMEUP 0xFFA857
KEY_EQUAL 0xFF906F
KEY_0 0xFF6897
KEY_F1 0xFF9867
KEY_F2 0xFFB04F
KEY_1 0xFF30CF
KEY_2 0xFF18E7
KEY_3 0xFF7A85
KEY_4 0xFF10EF
KEY_5 0xFF38C7
KEY_6 0xFF5AA5
KEY_7 0xFF42BD
KEY_8 0xFF4AB5
KEY_9 0xFF52AD
end codes
end remote
define_remotes()
{
REMOTES=(
[carmp3]="
KEY_CHANNELDOWN
KEY_CHANNEL=KEY_MENU
KEY_CHANNELUP
KEY_PREVIOUS
KEY_NEXT
KEY_PLAYPAUSE=KEY_PAUSE
KEY_VOLUMEDOWN
KEY_VOLUMEUP
KEY_EQUAL=KEY_MUTE
KEY_0
KEY_F1=KEY_A
KEY_F2=KEY_B
KEY_1
KEY_2
KEY_3
KEY_4
KEY_5
KEY_6
KEY_7
KEY_8
KEY_9
"
)
}
@ggirou
Copy link
Author

ggirou commented Jun 15, 2022

Instructions

Uncomment the following line in /boot/config.txt and reboot:

dtoverlay=gpio-ir,gpio_pin=17

Install lirc

sudo apt update
sudo apt install lirc

Edit /etc/lirc/lirc_options.conf:

11,12c11,12
< driver          = devinput
< device          = auto
---
> driver          = default
> device          = /dev/lirc0

And restart lirc:

sudo systemctl restart lircd

Record remote keys

# List available key name
sudo irrecord --list-namespace
# Record keys in ~/carmp3.lircd.conf 
sudo irrecord -d /dev/lirc0 ~/carmp3.lircd.conf
# Remove ending codes from each of the lines https://sourceforge.net/p/lirc/tickets/168/#4010
sed -i 's/ 0x000000//' ~/carmp3.lircd.conf
# Copy to lirc conf
sudo cp carmp3.lircd.conf  /etc/lirc/lircd.conf.d/
# Restart lirc
sudo systemctl restart lircd

Test remote:

irw
# or
mode2 -d /dev/lirc0

Remote control MPD server (RCMPD)

sudo apt install mpd mpc
sudo wget -O /usr/local/bin/rcmpd https://raw.githubusercontent.com/gchriz/rcmpd/main/rcmpd
sudo chmod a+x /usr/local/bin/rcmpd
rcmpd --checkinstall
# Edit rcmpd and in function define_remotes() adapt the keys of your remote control(s) you want to use
sudo nano /usr/local/bin/rcmpd
# Create an appropriate ~/.lircrc file for handling the RC commands
rcmpd --createlircrc
# (Re)start irexec to let it know about the new ~/.lircrc
rcmpd --restartirexec

Sources:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment