batocera-linux / batocera.linux

batocera.linux
https://batocera.org
Other
2k stars 515 forks source link

LEDSpicer tries to read .conf file from wrong location #10388

Open ZombieGraves opened 1 year ago

ZombieGraves commented 1 year ago

Batocera build version

v38

Your architecture

x64

Your Graphic Processor Unit (GPU)

Dedicated (e.g. GTX 1050; Radeon R9 380)

Graphical brand

Nvidia

Issue description

By default, LEDSpicer tries to read .conf file from /etc/ledspicer.conf instead of /userdata/system/configs/ledspicer/ledspicer.conf

Expected result

I would expect that running a command like ledspicerd -l or emitter LoadProfile default would run without a file not found error.

Reproduction steps

Check that ledspicer.conf exists in /userdata/system/configs/ledspicer. I believe it's there by default. SSH into the system terminal and call an ledspicer command that would require it to check the config file, like ledspicerd -e. The service exits with a file not found error. Data directory is correctly listed as /userdata/system/configs/ledspicer/ There's a line in the help doc that says that if -c or --config is not provided LEDSpicer will use /etc/ledspicer.conf. However if I point it to the correct .conf file in /userdata/system/configs/ledspicer, it still fails to find it.

Logs and data

Running on v38, fresh install. As I understand it, the original version of this service was supposed to run out of the /usr/share/ledspicer directory, and there had to be some reshuffling to make it work with batocera's /userdata/ based file structure. Since this service is brand new to batocera, there's a good chance that I'm using it wrong. If that's the case, some batocera specific setup documentation would be very welcome, since right now this feels pretty opaque.

KarampArist commented 1 year ago

Same thing happens to me. If you copy ledspicer.conf to /etc , Emitter will work. Try this after batocera starts: cp /userdata/system/configs/ledspicer/ledspicer.conf /etc
The file will stay there until reboot. Maybe I will add this to a script to make it permanent. But there is also another problem. When I try to run "emitter LoadProfileByEmulator romname arcade" the ledspicerd service stops. I tried different romnames but same thing happens. Anyone knows if ledspicer keeps logs somewhere so I can see what is happening?

Update: I found the logs and solved the problem. Emitter couldn't read the profile_arcade.xml that I had made. Copy the profile_empty.xml from the doc folder and edit that one. It's working now.

cp /usr/share/ledspicer/doc/examples/profile_empty.xml /userdata/system/configs/ledspicer/profiles/profile_arcade.xml

ZombieGraves commented 12 months ago

Same thing happens to me. If you copy ledspicer.conf to /etc , Emitter will work. Try this after batocera starts: cp /userdata/system/configs/ledspicer/ledspicer.conf /etc The file will stay there until reboot. Maybe I will add this to a script to make it permanent. But there is also another problem. When I try to run "emitter LoadProfileByEmulator romname arcade" the ledspicerd service stops. I tried different romnames but same thing happens. Anyone knows if ledspicer keeps logs somewhere so I can see what is happening?

Update: I found the logs and solved the problem. Emitter couldn't read the profile_arcade.xml that I had made. Copy the profile_empty.xml from the doc folder and edit that one. It's working now.

cp /usr/share/ledspicer/doc/examples/profile_empty.xml /userdata/system/configs/ledspicer/profiles/profile_arcade.xml

Where was the log file? I'm still having trouble getting it to recognize groups and load profiles properly. It'd be really nice if I had access to an error log so I can see what I'm doing.

Additionally, I bumped into a permissions error with PulseAudio, it didn't like that ledspicer was running as root. Loading the pulse animation triggered it.

KarampArist commented 12 months ago

Try to connect with ssh and run this :
cat /var/log/messages | grep ledspicer It will show ledspicer logs. I haven't tried pulse animation yet. I'm still working on animations and profiles. For the moment I have Batocera loading my default profile when boots (which is a circular animation) and when I choose MAME (I have only MAME Roms for now) and hover over games , ledspicer lights the control buttons of the specific game . Same profile when I I play the game and when I get back to the main wheel default profile loads again.

ZombieGraves commented 12 months ago

Try to connect with ssh and run this : cat /var/log/messages | grep ledspicer It will show ledspicer logs. I haven't tried pulse animation yet. I'm still working on animations and profiles. For the moment I have Batocera loading my default profile when boots (which is a circular animation) and when I choose MAME (I have only MAME Roms for now) and hover over games , ledspicer lights the control buttons of the specific game . Same profile when I I play the game and when I get back to the main wheel default profile loads again.

Thank you, that was really helpful! For the devs working this ticket in the future, I'd like to add that ledspicer also tries to load colors.ini from a non /userdata dir. It tries to load it from /usr/share/ledspicer.

KarampArist commented 12 months ago

I have the same problem with pulseaudio. If you find any solution, please let me know.

nadenislamarre commented 11 months ago

i don't understand how you launch ledspicer. if you use the standard scripts (via menu > system > services) it starts with the option --config /userdata/system/configs/ledspicer/ledspicer.conf no need to copy file to /etc. Are you trying to do things manually ?

ZombieGraves commented 11 months ago

Ledspicer is built around loading different profiles for animations or system events. For example, when you load a game that only uses 3 buttons, ledspicer can load a profile where only 3 buttons are lit, then load the basic led layout profile when you return to the ES menu. In order to use these features, you have to make emitter calls on system events, and when emitter calls are made, it looks in the wrong directory for ledspicer.conf and errors out, breaking the core functionality. Also, the setup for ledspicer isn't straightforward. Testing is very important, which is why terminal commands like ledspicerd -l are necessary, but those error out as well for the same reason. It may in fact start with the --config option pointing to the correct ledspicer.conf file, but I mentioned in my original post that even if it's explicitly directed to the correct file with --config, it still fails to find it. It looks in the wrong directory for colors.ini as well.

nadenislamarre commented 11 months ago

yes, according to the code, colors.ini is taken from sysconfdir and other data from datarootdir at compilation time. i've modified the configuration so that it takes in /userdata but it is not correct while it installed default there too (and /userdata can't be filed at compilation time). I could make a patch to fix all that, but i've not ledspicer to work with, and just via this issues, it would take several round. we have similar issues with animations and so on. the main issue is that ledspicer takes only one folder, not 2. we could make it go all to /userdata, but it requires some modificaiton at install step to copy the init files in /usr, not /userdata.

datarootdir='${prefix}/share' includedir='${prefix}/include' prefix='/usr' sharedstatedir='${prefix}/com' sysconfdir='/etc'