I want to get a working argon40 remote with argon40 case
What I have already done?
- irexec.nix with default settings
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.irexec;
in {
###### interface
options = {
services.irexec = {
enable = mkEnableOption "Handle events from IR remotes decoded by lircd(8)";
configs = mkOption {
type = types.nullOr types.lines;
description = "Configurations for irexec to load, see man:irexec(1) for details (<filename>irexec.lircrc</filename>)";
example = ''
#
# Initial test configuration for systemwide irexec service.
#
# Note that the system-wide service is useful only in corner-cases.
# Most scenarios are better off with a session service as described in the
# Configuration Guide. However, note that both can also be combined.
#
# Also note that the system-wide service runs without a terminal. To
# check the output generated use something like
# 'journalctl -b0 /usr/bin/irexec'. This service just echoes some keys
# commonly available.
#
begin
prog = irexec
button = KEY_RED
config = echo "KEY_RED"
end
begin
prog = irexec
button = KEY_BLUE
config = echo "KEY_BLUE"
end
begin
prog = irexec
button = KEY_1
config = echo "KEY_1"
end
begin
prog = irexec
button = KEY_2
config = echo "KEY_2"
end
begin
prog = irexec
button = KEY_3
config = echo "KEY_3"
end
begin
prog = irexec
button = KEY_OK
config = echo "KEY_OK"
end
begin
prog = irexec
button = KEY_LEFT
config = echo "KEY_LEFT"
end
begin
prog = irexec
button = KEY_RIGHT
config = echo "KEY_RIGHT"
end
'';
};
};
};
###### implementation
config = mkIf cfg.enable {
environment.etc."lirc/irexec.lircrc".text = cfg.configs;
environment.systemPackages = [ pkgs.lirc ];
systemd.services.irexec = let
configFile = pkgs.writeText "irexec.lircrc" (cfg.configs);
in {
description = "Handle events from IR remotes decoded by lircd(8)";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
unitConfig.Documentation = [ "man:irexec(1)" "http://lirc.org/html/configure.html" "http://lirc.org/html/configure.html#lircrc_format" ];
serviceConfig = {
RuntimeDirectory = ["lirc" "lirc/lock"];
RuntimeDirectoryPreserve = true;
PermissionsStartOnly = true;
ExecStartPre = [
"${pkgs.coreutils}/bin/chown lirc /run/lirc/"
];
ExecStart = ''
${pkgs.lirc}/bin/irexec ${configFile}
'';
};
};
};
}
- configuration.nix with almost full support argon40 case and remote
{ config, lib, pkgs, ... }:
{
imports = [
./irexec.nix
];
(cut)
boot = {
tmpOnTmpfs = true;
kernelPackages = pkgs.linuxPackages_rpi4;
kernelParams = [
"8250.nr_uarts=1"
"console=tty1"
"cma=256M"
"verbose"
"boot.shell_on_fail"
];
initrd = {
availableKernelModules = [
"bcm2835_dma"
"gpio"
"i2c-dev"
"i2c_bcm2835"
"pcie_brcmstb"
"reset-raspberrypi"
"uas"
"usb_storage"
"usbhid"
"xhci_pci"
"vc4"
];
kernelModules = [ ];
};
kernelModules = [
"bluetooth"
"bnep"
"btbcm"
"btusb"
"hci_uart"
];
blacklistedKernelModules = [
"8192cu"
"rtl8xxxu"
];
extraModulePackages = [ ];
loader = {
grub.enable = false;
generic-extlinux-compatible.enable = false;
raspberryPi = {
enable = true;
version = 4;
firmwareConfig = ''
(cut)
[all]
dtoverlay=gpio-fan,gpiopin=14,temp=80000
dtoverlay=gpio-ir,gpio_pin=23
'';
};
};
};
sound.enable = true;
hardware = {
raspberry-pi."4" = {
apply-overlays-dtmerge.enable=true;
i2c1.enable=true; # i2c
fkms-3d.enable = true;
};
# high-resolution display
video.hidpi.enable = lib.mkDefault true;
enableAllFirmware = true;
# Required for the Wireless firmware
enableRedistributableFirmware = true;
pulseaudio = {
enable = true;
support32Bit = true;
package = pkgs.pulseaudioFull;
tcp.enable = true;
tcp.anonymousClients.allowAll = true;
zeroconf.discovery.enable = false;
systemWide=true;
};
bluetooth = {
package = pkgs.bluez;
enable = true;
powerOnBoot = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
deviceTree.enable=true;
deviceTree.filter = "bcm2711-rpi-*.dtb";
};
services.blueman.enable = true;
services.hardware.argonone.enable = true;
environment.systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
systemd.services.lircd.serviceConfig.User = lib.mkForce "root";
services.lirc = {
enable = true;
options = ''
# These are the default options to lircd, if installed as
# /etc/lirc/lirc_options.conf. See the lircd(8) and lircmd(8)
# manpages for info on the different options.
#
# Some tools including mode2 and irw uses values such as
# driver, device, plugindir and loglevel as fallback values
# in not defined elsewhere.
[lircd]
nodaemon = False
# driver = devinput
driver = default
# device = auto
device = /dev/lirc0
output = /var/run/lirc/lircd
pidfile = /var/run/lirc/lircd.pid
# plugindir = /usr/lib/lirc/plugins
plugindir = ${pkgs.lirc}/lib/lirc/plugins
permission = 666
allow-simulate = No
repeat-max = 600
# effective-user =
# listen = [address:]port
# connect = host[:port]
# loglevel = 6
# release = true
# release_suffix = _EVUP
# logfile = ...
# driver-options = ...
[lircmd]
uinput = False
nodaemon = False
# [modinit]
# code = /usr/sbin/modprobe lirc_serial
# code1 = /usr/bin/setfacl -m g:lirc:rw /dev/uinput
# code2 = ...
# [lircd-uinput]
# add-release-events = True
# release-timeout = 50
# release-suffix = _EVUP
'';
configs = [
''
# 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.9.4c(devinput) on Tue May 25 12:17:02 2021
# Command line used: -d /dev/lirc0 /home/osmc/lircd.conf
# Kernel version (uname -r): 5.10.32-1-osmc
#
# Remote name (as of config file): argonforty
# 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 argon
driver devinput
bits 56
eps 30
aeps 100
one 0 0
zero 0 0
pre_data_bits 72
pre_data 0x23
gap 107949
toggle_bit_mask 0x0
frequency 38000
begin codes
KEY_UP 0x3F010000001197
KEY_RIGHT 0x5B01000000118C
KEY_DOWN 0x59010000001193
KEY_LEFT 0x5701000000119C
KEY_OK 0x51010000001198
KEY_INFO 0x57010000001196
KEY_HOME 0x56010000001181
KEY_BACK 0x57010000001197
KEY_VOLUMEUP 0x5A010000001194
KEY_VOLUMEDOWN 0x50010000001198
KEY_POWER 0x55010000001197
end codes
end remote
''
];
};
systemd.services.irexec.enable = true;
services.irexec = {
enable = true;
configs = ''
begin
prog = irexec
remote= *
button = KEY_VOLUMEUP
config = sudo -u '#1000' XDG_RUNTIME_DIR=/run/user/1000 pactl set-sink-volume alsa_output.platform-bcm2835_audio.stereo-fallback +1%
repeat = 1
delay = 0
end
begin
prog = irexec
remote= *
button = KEY_VOLUMEDOWN
config = sudo -u '#1000' XDG_RUNTIME_DIR=/run/user/1000 pactl set-sink-volume alsa_output.platform-bcm2835_audio.stereo-fallback -1%
repeat = 1
delay = 0
end
'';
};
LIRC sees all buttons!!!
But despite this, only the shutdown button works
I try sudo -u USERNAME pactl --server unix:/run/user/1000/pulse/native set-sink-volume alsa_output.platform-bcm2835_audio.stereo-fallback +1%
with the same result.