How to execute a resume script when XBMC initiates Suspend
#1
Code:
#!/bin/bash

# XBMC Live ATIUSB Resume script.  I wave all rights.
# This script uses curl.  Install curl by "apt-get install curl" from a terminal.   This script restarts any
# ATI USB compatable device, including the Snapstream Firefly.  It accomplishes this by first restarting the
# ATIUSB device, then restarting LIRC, porting the resident memory command to IRW, kills IRW, then restarts
# the XBMC LIRC port.    This script goes in /etc/acpi/resume.d
sleep 5
sudo rmmod lirc_atiusb
sudo modprobe lirc_atiusb
sudo /etc/init.d/lirc restart
irw & sleep 1; killall irw
sudo curl "http://127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Start"
echo "lirc_atiusb resume script completed" >/tmp/script.log

This is my code for my restart script. I cannot get XBMC to call it up. It is executable and restores function when run. It is located at /etc/acpi/resume.d/99-lircresume.sh

It does not run when XBMC resumes from standby. How can I remedy this? Is there a way that I can map a key on my remote to call a .sh script?

No
#2
XBMC Doesn't call a resume script, this is up to the OS to handle. In karmic this is handled by DeviceKit.Power and probably down to pm-utils. So ubuntuforums is a great start.

You can call a script using System.Exec Builtin function, look in wiki about it. But you probably shouldn't do that and instead get to the root of your issues over at ubuntuforums.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
#3
iirc you have to create a proper resume script:
Code:
#!/bin/sh

case "$1" in
    resume)
        [i]<your commands>[/i]
        ;;
esac

and put it in /etc/pm/sleep.d
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
#4
This script is located in /etc/acpi/resume.d/99-lircresume.sh. \

Located in the /etc/acpi/resume.sh command is another command which calls /etc/acpi/resume.d/*.sh

All resume commands are called by the /etc/acpi/sleep.sh which refers to /etc/acpi/resume.sh at the end.

This script works fine when the command /etc/acpi/sleep.sh is activated. This is the way the OS was designed to go to sleep. So my script would look like this?

Code:
#!/bin/sh

case "$1" in
    resume)
        /etc/acpi/resume.sh
        ;;
esac
#5
as far as i know acpi is deprecated and replaced by pm-utils.

sure that script would work, but why not put your commands in there, like:

Code:
#!/bin/sh

case "$1" in
    resume)
        sleep 5
        sudo rmmod lirc_atiusb
        sudo modprobe lirc_atiusb
        sudo /etc/init.d/lirc restart
        irw & sleep 1; killall irw
        sudo curl "http://127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Start"
        echo "lirc_atiusb resume script completed" >/tmp/script.log
    ;;
esac
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
#6
so why does everyone say look up /etc/acpi/resume.d for resume scripts?

Ubuntu is supposed to execute every script in that folder upon resume.
#7
This isn't a XBMC problem I'm locking this, please search and discuss over at ubuntuforums.org instead.

EDIT: To clarify some more, XBMC calls DeviceKit.Power or HAL depending on subsystem underneath used, if those systems does not call the resume script something is wrong, and either way it's not XBMC related per say and as such it's better discussed on other forums were it's more likely to be fixed. If I get a good enough reason to unlock it I ofcourse will but as it stands now I see no reason for it to be here.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."

Logout Mark Read Team Forum Stats Members Help
How to execute a resume script when XBMC initiates Suspend0