[LINUX] HOW-TO shutdown applications runned by launcher plugin with a remote control
#31
Temar Wrote:Should be enough to remove "pulseaudio". To allow applications to use ALSA directly you have to add the users to the group "audio":

Code:
sudo usermod -a -G audio xbmc

This will add the user "xbmc" to the group "audio". You can repeat this command for any user who needs access to the sound devices.

I've found article about removing pulse autio - looks bit more complicated then your idea Smile

http://idyllictux.wordpress.com/2009/04/...io-at-bay/

Looks like there is a lot of discussion about pulse audio being default sound server in ubuntu - people have mixed feelings about it cause it makes hard for some inexperienced users to run basic software like skype or flash in mozilla :|
Reply
#32
bedek Wrote:I've found article about removing pulse autio - looks bit more complicated then your idea Smile

http://idyllictux.wordpress.com/2009/04/...io-at-bay/

Looks like there is a lot of discussion about pulse audio being default sound server in ubuntu - people have mixed feelings about it cause it makes hard for some inexperienced users to run basic software like skype or flash in mozilla :|

Well, the situation gets better with each release. Basically pulseaudio is a good thing but it had some problems in the past and still not all applications support it. Pulseaudio is definetly the future for Desktop Linux.

For XBMC however you do not really need it as the sound devices never change. As long as you do not want to plugin bluetooth headsets or send the audio stream via network to another computer, you do not need it at all. I never install it on my XBMC boxes.

If removal is too much of an effort, you can just add the xbmc user to the audio group as described above. This gives applications access to the ALSA sound devices. For some apps this might be enough as long as the pulse audio server does not block the sound device (it shouldn't). This way you can use pulseaudio and ALSA at the same time.
Reply
#33
Temar Wrote:A solution which would allow you to either exit the emu manually or kill it using a button on your remote, could look like this:

/home/xbmc/launcher.sh
Code:
#!/bin/sh

/usr/bin/killall -STOP xbmc.bin

/home/xbmc/launcher-run.sh "$@"

/usr/bin/killall -CONT xbmc.bin


/home/xbmc/launcher-run.sh
Code:
#!/bin/sh

echo $$ > /home/xbmc/launcher.pid

exec "$@"


/home/xbmc/launcher-kill.sh
Code:
#!/bin/sh

kill `cat /home/xbmc/launcher.pid`

what exactly is the "$@" for?
iOS XBMC users PLEASE use the advanced search function before starting a new thread. Make sure to click on 'XBMC for iOS Specific Support' so your results are narrowed down correctly.

Please make sure to visit the Sticky section for common issues/questions/etc. Also, XBMC for iOS information
Reply
#34
still unsure what that command mentioned previously does, but for anyone curious here is what i have working now.

im running xbmc-live obviously on an ion chipset (asus at3n7ai).

my advanced launcher loads my emus with:

zsnes.sh
Code:
#!/bin/bash

/usr/bin/killall -STOP xbmc.bin

/usr/bin/zsnes -ad alsa -v 22 -s "$1"

/usr/bin/killall -CONT xbmc.bin

mednafen.sh
Code:
#!/bin/bash

/usr/bin/killall -STOP xbmc.bin

/usr/games/mednafen -vdriver opengl -glvsync 1 -nes.xres 640 -nes.yres 480 -nes.stretch 0 -fs 1 "$1"

/usr/bin/killall -CONT xbmc.bin

for the arguements in advanced launcher, i just used "%rom%" so $1 in the .sh == rom filename. obviously, it loads the proper .sh feeding the rom filename.

i also created a .sh (kill-emus.sh) to kill the emulators. im new to this, so i didn't get fancy killing specific PIDs.

Code:
#!/bin/bash

/usr/bin/killall mednafen

/usr/bin/killall zsnes

i have the kill-emus.sh mapped to my home button on my mceusb compatible remote using irexec.
.lircrc
Code:
# Kill Emulators
begin
prog = irexec
button = Home
config = /home/htpc/kill-emus.sh
end

and to start irexec (which doesnt start automatically) i just inserted it into the xbmc launch script /usr/bin/xbmc (checked the proper key using irw):
Code:
...

LIBDIR="${exec_prefix}/lib"

# start irexec to handle emu kill scripts via remote
irexec &

# Check for some options used by this script
while [ "$#" -gt "0" ]
do

...

everything is working fine. according to 'top', xbmc is paused while the emus launch, and continues just fine when the emu is exited both using the normal method (escape key) and using the home button.

the only issue ive found so far is when xbmc is paused and the 'guide' (home) key is pressed to kill the emulators it does a double press so not only does it exit the emu, but it also reverts to the xbmc home screen.

anyone got some tips to help clean this setup up or fix the double key press? (there is normally no double key presses when xbmc is running).
iOS XBMC users PLEASE use the advanced search function before starting a new thread. Make sure to click on 'XBMC for iOS Specific Support' so your results are narrowed down correctly.

Please make sure to visit the Sticky section for common issues/questions/etc. Also, XBMC for iOS information
Reply
#35
okay so after some trial and error i've come up with what seems to be a universal and working solution for all the emus i have.

every emu launched has its own dedicated script. i do this so its universal between all launchers as the launcher apps themselves can be a pain to edit arguments (i like to be able to just simply edit the script specifying arguments for tweaking on the fly).

this script pauses xbmc.bin, executes the emulator of your choice ("$1" == the first arguement givin by the launcher itself (aka %rom%)
Code:
#!/bin/sh

/user/bin/killall -STOP xbmc.bin
echo $$ > ~/scripts/kill.pid
exec /location/to/app --arguments "$1"
/usr/bin/killall -CONT xbmc.bin

this next script kills that specific process launched in the previous script and then deletes the kill.pid file (to keep things clean).
Code:
#!/bin/sh
kill -9 `cat ~/scripts/kill.pid`
rm ~/scripts/kill.pid

for someone who likes to have arguments specified in the launcher program itself, they should replace the $1 with the previous reports. this is just specific to my setup.

i use kill -9 as it seems to work for emulators like fceux which do not respond to the normal killall or kill commands.
iOS XBMC users PLEASE use the advanced search function before starting a new thread. Make sure to click on 'XBMC for iOS Specific Support' so your results are narrowed down correctly.

Please make sure to visit the Sticky section for common issues/questions/etc. Also, XBMC for iOS information
Reply
#36
Question 
I have a very simple killall-script bound to my red teletext button as described in the first post - works fine for me when, in my case, ZSNES is running. However, when pushing the button (and thus invoking the script) while in XBMC, XBMC switches to windowed mode and is only visible in the upper left corner, with the X mouse cursor visible in the center. This can be fixed by switching to fullscreen in the settings again, but it's still annoying so I wondered as to how to avoid this?

For the record, I'm on Live 10.1. Thanks!
Reply
#37
TheDeadSerious Wrote:I have a very simple killall-script bound to my red teletext button as described in the first post - works fine for me when, in my case, ZSNES is running. However, when pushing the button (and thus invoking the script) while in XBMC, XBMC switches to windowed mode and is only visible in the upper left corner, with the X mouse cursor visible in the center. This can be fixed by switching to fullscreen in the settings again, but it's still annoying so I wondered as to how to avoid this?

For the record, I'm on Live 10.1. Thanks!

I use Rom Collection Browser with a killall script through irexec and use 'solo mode' to launch my emulators (this terminates xbmc completely, I find this causes less issues with the running emulators) and I have xbmc always launching in full screen mode via the advancedsettings.xml file. RCB has a script file to launch the emu then when the emu closes xbmc is relaunched and I modded this to only have irexec running while the emulator is.
Reply
#38
I upgraded my xbmc, now the trick from 1st post not work. Something changed?
Reply

Logout Mark Read Team Forum Stats Members Help
[LINUX] HOW-TO shutdown applications runned by launcher plugin with a remote control1