Normally you have to enable the rr-config-tool addon, select your audio output, enable pulseaudio and you're done.
So, if I just use the Libreelec-RR config tool with this settings:
, I get wrongly mapped channels in Moonlight, Kodis audio output is fine, tested with a test file, that works on a Windows PC and Kodi.
pactl info shows this:
Server String: /run/pulse/native
Library Protocol Version: 34
Server Protocol Version: 34
Is Local: yes
Client Index: 17
Tile Size: 65496
User Name: root
Host Name: LibreELEC
Server Name: pulseaudio
Server Version: 14.2
Default Sample Specification: s16le 6ch 44100Hz
Default Channel Map: front-left,front-left-of-center,front-center,front-right,front-right-of-center,rear-center
Default Sink: alsa_output.temp_sink
Default Source: alsa_output.temp_sink.monitor
Cookie: ed8e:a9c7
Display More
The default- channel map seems wrong. Here are the logs: http://ix.io/3yzJ
If I select Use module-udev-detect to autodetect Pulseaudio device I get no sound at all.
This is the output of pactl info is:
Server String: /run/pulse/native
Library Protocol Version: 34
Server Protocol Version: 34
Is Local: yes
Client Index: 18
Tile Size: 65496
User Name: root
Host Name: LibreELEC
Server Name: pulseaudio
Server Version: 14.2
Default Sample Specification: s16le 6ch 44100Hz
Default Channel Map: front-left,front-left-of-center,front-center,front-right,front-right-of-center,rear-center
Default Sink: alsa_output.2.stereo-fallback
Default Source: alsa_input.usb-0d8c_USB_Sound_Device-00.analog-stereo
Display More
Here are the kodi logs :log-2021-09-11-15.15.37.zip (Pastekodi didn't work and Pastebin complains about file size, I can give individual logs if you want)
You don't have to manually edit any config files - if you do so you will break things because scripts adjust the automatically to match the audio devices
You are right with this, especially since I'm a Linux noob, but I could't help myself. If I change autostart.sh like this
pactl load-module module-udev-detect
pactl set-default-sink alsa_output.usb-0d8c_USB_Sound_Device-00.analog-surround-51
Moonlight audio does work correctly, but Kodi audio is killed. I additionally added the line
pactl load-module module-alsa-sink channel_map=front-left,front-right,rear-left,rear-right,center,lfe,
which sometimes works in Kodi, but most of the time I can't select a proper audio device in Kodi settings, so this is what you meant with breaking things. To be clear, the log files I provided are without an edited autostart.sh.
Edit: The github script udev-joystick-blacklist didn't work initially, I added the lines:
SUBSYSTEM=="input", ATTRS{name}=="eventlircd", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_INPUT_JOYSTICK}=""
SUBSYSTEM=="input", ATTRS{name}=="eventlircd", KERNEL=="js[0-9]*", MODE="0000", ENV{ID_INPUT_JOYSTICK}=""
which did the trick for me. Remote and controller are working in Kodi and if I use Moonlight only one controller was detected.