Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - levell3r

Pages: [1]
1
Scripting / Re: Using fe.plugin_command_bg to run SUDO
« on: June 09, 2020, 01:14:17 PM »
I think i'm getting close.



Code: [Select]
fe.add_transition_callback("onTransition");

function onTransition( ttype, var, ttime )
{
   if ( ttype == Transition.ToNewSelection )

  {
    local argString = "";
    fe.plugin_command_bg( "sudo", "led-image-viewer --led-rows=32 --led-cols=64 --led-chain=2 --led-slowdown-gpio=3 --led-brightness=50 --led-pwm-bits=9 --led-limit-refresh=50 --led-scan-mode=0 --led-pwm-lsb-nanoseconds=200 -C /home/pi/RetroPie/roms/" + fe.game_info( Info.Emulator ) + "/marquee/" + fe.game_info( Info.Title ) + ".png" );
  }
}


The above is working except it throws a 'Parameter word expansion failed' error. I think because its passing the rom name which has spaces in to the file path...



error log..

Quote
*** Initializing display: 'Capcom Classics'
 - Loaded master romlist 'Arcade' in 241 ms (96 entries kept, 9700 discarded)
 - Constructed 1 filters in 0 ms (96 comparisons)
Parameter word expansion failed. [led-image-viewer --led-rows=32 --led-cols=64 --led-chain=2 --led-slowdown-gpio=3 --led-brightness=50 --led-pwm-bits=9 --led-limit-refresh=50 --led-scan-mode=0 --led-pwm-lsb-nanoseconds=200 -C /home/pi/RetroPie/roms/Arcade/marquee/X-Men Children of the Atom (Euro 950331).png].


2
Scripting / Re: Using fe.plugin_command_bg to run SUDO
« on: June 09, 2020, 12:50:43 PM »
Hi,
I'm trying to run hzeller rgb-led driver with the marquee path set using a magic token function.

I have minimal coding experience but could normally frankenstein stuff together.



Code: [Select]
     fe.plugin_command_bg( "sudo", "led-image-viewer --led-rows=32 --led-cols=64 --led-chain=2 --led-slowdown-gpio=3 --led-brightness=50 --led-pwm-bits=9 --led-limit-refresh=50 --led-scan-mode=0 --led-pwm-lsb-nanoseconds=200 -C " + "/home/pi/RetroPie/roms/" + fe.game_info( "[!emuinfo]") + "/marquee/" + fe.game_info( "[!gameinfo]") + ".png"); break;

3
Scripting / Re: Using fe.plugin_command_bg to run SUDO
« on: June 09, 2020, 07:02:16 AM »
ITS WORKED!
Adding the executable as the argument did it.
Have tried system() and it really chewed the Pi up.

Now to pass some magic tokens to generate the path for images.



Thanks for the advice.

4
Scripting / Using fe.plugin_command_bg to run SUDO
« on: June 09, 2020, 06:23:55 AM »
Hi All,
I have an executable that needs to be run with sudo as it needs to use the hardware pulse generator.
But I cannot get fe.plugin_command_bg to pass a SUDO command succesfully.

If I pass the flag that lets it run without elevated privilege's it works, so I know everything else is okay.




Code: [Select]
fe.add_transition_callback( "onTransition" );

function onTransition( ttype, var, ttime ) {


switch ( ttype )
{
case Transition.ToGame:
case Transition.ToNewSelection:
case Transition.FromGame:


     fe.plugin_command_bg( "led-image-viewer","--led-no-hardware-pulse --led-rows=32 --led-cols=64 --led-chain=2 --led-slowdown-gpio=3 --led-brightness=50 --led-pwm-bits=9 --led-limit-refresh=50 --led-scan-mode=0 --led-pwm-lsb-nanoseconds=200 /home/pi/GFXdirectory*.png -C");
break;

}

return false; // must return false
}


Am I overlooking something related to fe.plugin_command_bg and SUDO?
 

Pages: [1]