Archive:Automatic lirc resume script: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
m (Bot: Automated text replacement (-XBMC +{{name}}))
Line 1: Line 1:
This guide assumes that you have installed [[XBMC Live]] or have at least performed all steps outlined in one of the articles listed here [[Installing XBMC for Linux]] and here [[HOW-TO setup Lirc to talk to XBMC]]. This guide assumes that your remote works well upon startup. If it does not, then do not proceed with this article.
This guide assumes that you have installed [[{{name}} Live]] or have at least performed all steps outlined in one of the articles listed here [[Installing {{name}} for Linux]] and here [[HOW-TO setup Lirc to talk to {{name}}]]. This guide assumes that your remote works well upon startup. If it does not, then do not proceed with this article.


You will also need a [http://en.wikipedia.org/wiki/SFTP SFTP] client and a [http://en.wikipedia.org/wiki/Terminal_emulator terminal emulator] like [http://winscp.net/eng/index.php WinSCP] and [http://www.chiark.greenend.org.uk/~sgtatham/putty/ Putty].  
You will also need a [http://en.wikipedia.org/wiki/SFTP SFTP] client and a [http://en.wikipedia.org/wiki/Terminal_emulator terminal emulator] like [http://winscp.net/eng/index.php WinSCP] and [http://www.chiark.greenend.org.uk/~sgtatham/putty/ Putty].  
Line 14: Line 14:
   
   
  # This script uses curl. Install curl using the following command from your terminal apt-get install curl
  # This script uses curl. Install curl using the following command from your terminal apt-get install curl
  # This script will restart lirc drivers, Lirc, and XBMC's lirc interperater upon resume.
  # This script will restart lirc drivers, Lirc, and {{name}}'s lirc interperater upon resume.
   
   
  case "$1" in   
  case "$1" in   

Revision as of 00:58, 5 June 2014

This guide assumes that you have installed XBMC Live or have at least performed all steps outlined in one of the articles listed here Installing XBMC for Linux and here HOW-TO setup Lirc to talk to XBMC. This guide assumes that your remote works well upon startup. If it does not, then do not proceed with this article.

You will also need a SFTP client and a terminal emulator like WinSCP and Putty.

To enable resume from your remote see the following article Enable Wake-On-Device

You will need root access for the following commands.

Creating a resume file

  • Using your SFTP client create a file called /etc/pm/sleep.d/99lirc-resume.sh
  • copy the following information into the file 99lirc-resume.sh
#!/bin/sh

# This script uses curl. Install curl using the following command from your terminal apt-get install curl
# This script will restart lirc drivers, Lirc, and XBMC's lirc interperater upon resume.

case "$1" in  
	resume)
		lircDriver=$(dmesg | grep usbcore | grep -i 'lirc' | sed -e "s/.* \(lirc*\)/\1/" | head -n 1)
 		curl "http://127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Stop"
		/etc/init.d/lirc stop 
		rmmod $lircDriver
		modprobe $lircDriver
		/etc/init.d/lirc start 
		#remove the comment if the computer automatically sleeps after resume
		#irw & sleep 1; killall irw
		curl "http://127.0.0.1:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=LIRC.Start" 
		echo "lirc resume script completed!!!" >>/tmp/script.log
	;;
esac

note: the #irw line ports the resident memory command to irw, then kills irw. This is useful on the Snapstream devices.

  • make it executable using the following command in your terminal
chmod +x /etc/pm/sleep.d/99lirc-resume.sh
  • Get curl by typing the following
sudo apt-get install curl

You are now done.