You are not logged in.

#26 2023-09-28 16:34:06

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=Generic_1
    HD-Audio Generic, ALCS1200A Analog
    Default Audio Device
sysdefault:CARD=Generic_1
    HD-Audio Generic, ALCS1200A Analog
    Default Audio Device
front:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    Front output / input
surround21:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Generic_1,DEV=0
    HD-Audio Generic, ALCS1200A Digital
    IEC958 (S/PDIF) Digital Audio Output
hdmi:CARD=Generic,DEV=0
    HD-Audio Generic, HDMI 0
    HDMI Audio Output
hdmi:CARD=Generic,DEV=1
    HD-Audio Generic, HP E243d
    HDMI Audio Output
**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: Generic_1 [HD-Audio Generic], Gerät 0: ALCS1200A Analog [ALCS1200A Analog]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 0: Generic_1 [HD-Audio Generic], Gerät 1: ALCS1200A Digital [ALCS1200A Digital]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 1: Generic [HD-Audio Generic], Gerät 3: HDMI 0 [HDMI 0]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 1: Generic [HD-Audio Generic], Gerät 7: HDMI 1 [HP E243d]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

If I play with

$mpv cdda://

on TTY3 and switch to TTY1 (kodi), same behavior.
Is it normal that there is no jump to next track if TTY is inactive?

Offline

#27 2023-09-28 17:11:00

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

I dug out an optical drive, created a dummy user w/ essentially no rights whatsoever, logged into another TTY and had the dummy user mpv play a CD (first one I could get hold on - not a good idea) and moved back to the main TTY as regular user and checked that the ACLs for sr0 had changed to that user as expected.
Then I endured the first track of the disc I picked, noticed too late that I could just have muted the sound… and it moved on to the next track w/o problems, so no: that's not normal.
(It also had been going on to cache the first 5 tracks, it's also not /that/ surprising since the device gets opened only once at the start)

Sorry if you'd mentioned that before but how is the optical drive attached? SATA or USB?

Offline

#28 2023-09-28 17:14:50

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

seth wrote:

Sorry if you'd mentioned that before but how is the optical drive attached? SATA or USB?

USB

Big thanks for your advice :-)

Offline

#29 2023-09-28 17:24:37

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

https://wiki.archlinux.org/title/Power_ … utosuspend

usbcore.autosuspend=-1 will disable it, but nb. that tools like TLP will override that at runtime and you'll have to configure it there (ad well)

---
"sacrifice", the discs that are not in a box in the attic are delegated as scarecrows...

Offline

#30 2023-09-28 17:26:35

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

I tried vlc with mp3 album on TTY3 openbox and switched to TTY2 midnightcommander with same user. The track jumping was working!

But: If switch to TTY1 kodi or TTY2 not logged in vlc says:

Audio output failed: The audio device "iec958:CARD=Generic_1,DEV=0" could not be used: No matching device found.

Interessting: The mp3 track will be played, I switch to TTY1 kodi or not-logged-in-shell the sound stops after track end. But if I switch back to TTY with same user, track was started it plays/sounds the track "forwarded".

So maybe there is a problem with finding correct audiodevice while switching TTYs ?! Seems to be that mp3 album uses different audio device after TTY-switching...

With AudioCD theres no forwarded playing, it is playing tracks from beginning after switching to "correct" TTY.

Last edited by realmatrix (2023-09-28 17:49:16)

Offline

#31 2023-09-28 18:09:56

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

Ok, so I added all involved user to the group 'audio' and now

a) Sound started in TTY3 jumping is working in ALL TTYs with different users
b) But sound started on TTY1 kodi is not available to ALL TTYs with different users, so kodi user has not enough rights!!!

Sorry for my slowly insights... I just working with try and error :-)

Offline

#32 2023-09-28 19:43:34

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

What's the output of

id kodi

and did you re-login as "kodi" on tty1? Do you log-in as kodi at all or do you just start a service (that ends up running a process as kodi)?

Offline

#33 2023-09-28 19:48:53

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

id kodi

results:

uid=971(kodi) gid=971(kodi) Gruppen=971(kodi),996(audio),990(optical),985(video)

I started kodi as service, here is the systemd:

[Unit]
Description=Kodi standalone (X11)
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service

[Service]
User=kodi
Group=kodi
EnvironmentFile=-/etc/conf.d/kodi-standalone
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
Restart=on-abort
StandardInput=tty
StandardOutput=journal

[Install]
Alias=display-manager.service

Offline

#34 2023-09-28 19:58:29

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

Try to add

SupplementaryGroups=audio optical

Did you restart the service after adding it to optical & audio groups?

Offline

#35 2023-09-28 20:12:48

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

This doesn't work:

[Unit]
Description=Kodi standalone (X11)
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service

[Service]
User=kodi
Group=kodi
EnvironmentFile=-/etc/conf.d/kodi-standalone
SupplementaryGroups=audio optical
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
Restart=on-abort
StandardInput=tty
StandardOutput=journal

[Install]
Alias=display-manager.service

I restarting the service normally with

$systemctl daemon-reload + $systemctl restart kodi-x11

Offline

#36 2023-09-29 07:13:17

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

According to https://bbs.archlinux.org/viewtopic.php … 4#p2122554 kodi had actually run w/ those groups anyway sad
If you login as kodi (you might have to unlock the account and add a password) and run "/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1" from there, can you make it keep playing audio?

Offline

#37 2023-09-29 16:40:03

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

Tested

/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1

playing mp3 album

with user machine
uid=1003(machine) gid=1003(machine) Gruppen=1003(machine),108(vboxusers)
=>working

with user woody
uid=1000(woody) gid=984(users) Gruppen=984(users),998(wheel),996(audio),985(video),666(vdr),971(kodi),1003(machine)
=>working

with user kodi (via systemd)
uid=971(kodi) gid=971(kodi) Gruppen=971(kodi),996(audio),990(optical),985(video)
=> not working

correction: after jumping between TTY1, TTY2 and TTY3 more than one times
=> not working

it seems that after jumping the system cannot find the correct alsa-card !?

Last edited by realmatrix (2023-09-29 16:52:21)

Offline

#38 2023-09-29 18:33:22

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

correction: after jumping between TTY1, TTY2 and TTY3 more than one times
=> not working

This is for kodi (only)?

logind juggles permissions, though I don't see how that would be a problem except that kodi isn't in the users group (which I btw. also set as defauld and only group for the dummy user…) - doesn't fit w/ the observation for the "machine" user, though hmm

Offline

#39 2023-09-29 18:36:08

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: [SOLVED] kodi as systemd-service and playing AudioCD

@OP - you appear to be using my kodi-standalone-service.  I am not closely following this thread, but if you arrive at a solution to your problem, please let me know if my files need to be modified to satisfy this use case.

Last edited by graysky (2023-09-29 18:36:25)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#40 2023-09-29 19:11:18

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

seth wrote:

This is for kodi (only)?

No, it is also for vlc playing mp3 album...

First switching from TTY3 woody vlc playing to another TTY => track jump is working
Second switching back to TTY3 woody
Third switching to another TTY => track jump is not working anymore

graysky wrote:

@OP - you appear to be using my kodi-standalone-service.  I am not closely following this thread, but if you arrive at a solution to your problem, please let me know if my files need to be modified to satisfy this use case.

Ok :-)

Offline

#41 2023-09-29 19:12:42

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

I meant the user "kodi", not the process.

Offline

#42 2023-09-29 19:24:14

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

I think it is broken after switching to TTY1 (kodi)

First switch from TTY3 (user woody) to TTY4 (user woody) > working
Second switch back from TTY4 to TTY3
Third switch from TTY3 to TTY4 > working
Fourth switch back from TTY4 to TTY3
Fifth switch from TTY3 to TTY1 (user kodi) > not working

This was tested with vlc mp3 album started on TTY3 (user woody).

---

Switch from TTY1 (user kodi) to any other TTY > not working

This was tested with kodi-standalone mp3 album started on TTY1 (user kodi)

---

So in the end: Only with user woody track jumping on different TTYs (with user woody) is working.

Last edited by realmatrix (2023-09-29 19:44:59)

Offline

#43 2023-09-29 20:43:23

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

Starting

/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt2

on TTY2 (user machine).

First playing mp3 album
Second switch to TTY3 (user woody) > track jumping works
Third switch back to TTY2
Fourth switch to TTY3 again (user woody) > track jumping don't work anymore

Offline

#44 2023-09-30 11:25:13

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

Correction:

playing vlc mp3 album, started on TTY3 (user woody) => works as it should be now, I can switch to any TTY with any user or not logged in AND the track jumping works !!!

id woody

=

uid=1000(woody) gid=984(users) Gruppen=984(users),998(wheel),996(audio),985(video),666(vdr),1003(machine)

So the question should be: What I have to change in case of user 'kodi'?

id kodi

=

uid=971(kodi) gid=971(kodi) Gruppen=971(kodi),996(audio),990(optical),985(video)

user kodi is for the software media center "kodi-standalone" and should have minimal rights. The idea is a working media center in background on TTY1, which automatically jumps from one to next track with mp3 and AudioCD.

Thanks for your advice.

Last edited by realmatrix (2023-09-30 11:28:42)

Offline

#45 2023-09-30 17:51:55

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

I tried this modified kodi-standalone:

[Unit]
Description=Kodi standalone (X11)
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service

[Service]
User=kodi
Group=kodi
EnvironmentFile=-/etc/conf.d/kodi-standalone
PAMName=login
TTYPath=/dev/tty1
#ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
ExecStart=/usr/bin/xinit /usr/bin/vlc -- :0 -quiet -nolisten tcp vt1
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
Restart=on-abort
StandardInput=tty
StandardOutput=journal

[Install]
Alias=display-manager.service

and after setting vlc to use ALSA IEC958 digital device it works perfectly!

=> So the problem is kodi-software !!! Anybody knows how I can force kodi to use a custom soundcard?

Offline

#46 2023-09-30 19:38:12

seth
Member
Registered: 2012-09-03
Posts: 51,143

Offline

#47 2023-10-01 09:20:38

realmatrix
Member
Registered: 2019-01-10
Posts: 29

Re: [SOLVED] kodi as systemd-service and playing AudioCD

@seth: Thanks for your great support!!!

For radio, mp3 and AudioCD now I am using mediaplayer "QMPlay2" with the limited kodi-account on TTY1. Everything works fine.

For TV and movies using vlc on openbox TTY3 now.

Here's my systemd if somebody is interested:

[Unit]
Description=QMPlay2 Radio/AudioCD
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service

[Service]
User=kodi
Group=kodi
PAMName=login
TTYPath=/dev/tty1
ExecStart=/usr/bin/xinit /usr/bin/QMPlay2 /var/lib/kodi/radio.xspf -- :1 -quiet -nolisten tcp vt1
ExecStop=/usr/bin/killall --user kodi
Restart=on-abort
StandardInput=tty
StandardOutput=journal

[Install]
Alias=display-manager.service

have a nice day
realmatrix

[solved]

Offline

#48 2023-10-01 13:12:22

seth
Member
Registered: 2012-09-03
Posts: 51,143

Re: [SOLVED] kodi as systemd-service and playing AudioCD

Mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

Board footer

Powered by FluxBB