Skip to main content

Thread: How-To use lirc to control receiver and tv power


ever wish tv , receiver power on , off pc , screensaver? these scripts , instructions can.

there assumptions here , have tailor setup example of mine.
importantly i'm using mythbuntu , xscreensaver screensaver used in distribution script has been written for. have conf files devices want control , scripts setup home directory , devices.

on fun stuff.

you'll need conf files devices want control.
http://lirc.sourceforge.net/remotes/
if can't find device here or in /usr/share/lirc/extras/transmitters/ can create 1 using irrecord beyond scope of how-to. i'll reply if ask though.
if have more 1 device, need more 1 transmitter thing i'd stress can copy , paste devices 1 conf file lirc load.
should example master.conf below.
code:
# config file automatically generated  # using lirc-0.9.0(default) on mon oct 22 12:53:42 2012  #  # contributed david gilson <gilson585@gmail.com>  #  # brand: westinghouse  # model no. of remote control: unknown  # devices being controlled remote: 40" westinghouse tv vr-4085df  #  # tv available on black friday of 2011 in limited quantities  # target  #    begin remote      name  vr4085df    bits           16    flags space_enc|const_length    eps            30    aeps          100      header       9000  4500    1           563  1687    0          563   562    ptrail        563    repeat       9000  2250    pre_data_bits   16    pre_data       0x807f    gap          108000    toggle_bit_mask 0x0    frequency    38000    duty_cycle   33          begin codes            key_power                0x08f7            key_mute                 0x8877            key_1                    0x807f            key_2                    0x40bf            key_3                    0xc03f            key_4                    0x20df            key_5                    0xa05f            key_6                    0x609f            key_7                    0xe01f            key_8                    0x10ef            key_9                    0x906f            key_last                 0xda25            key_0                    0x00ff            key_minus                0x50af            key_volumeup             0x708f            key_volumedown           0xf00f            key_channelup            0x30cf            key_channeldown          0xb04f            key_displaytoggle        0xc837            key_zoom                 0x42bd            key_menu                 0xa857            key_exit                 0x6897            key_sleep                0xe817            key_switchvideomode      0x48b7            key_a                    0x2ad5            key_b                    0x32cd            key_c                    0x6a95            key_d                    0xaa55            key_up                   0x9867            key_left                 0xd827            key_enter                0xb847            key_right                0x38c7            key_down                 0x58a7            key_text                 0xea15            key_favorites            0x1ae5            key_list                 0x9a65            key_language             0x5aa5        end codes    end remote    #  # config file automatically generated  # using lirc-0.8.1-cvs(default) on sat oct 21 18:34:58 2006  #  # contributed ben bronk <rukh13|hotmail.com>  #  # brand:                       kenwood  # model no. of remote control: rc-r0813  # devices being controlled remote: kenwood vr-6070  #    begin remote      name  kenwood_rc-r0813    bits           24    flags space_enc|const_length    eps            30    aeps          100      header       9065  4480    1           580  1660    0          580   550    ptrail        580    repeat       9060  2230    pre_data_bits   8    pre_data       0x1d    gap          108434    toggle_bit      0            begin codes          power       0x00b946          thx         0x8043bc          listenmodeup 0x00fb04          listenmodedown 0xe0f807          activeeq    0x60e21d          speakereq   0x60926d          inputmode   0x20f906          dspmode     0x8030cf          mute        0x0039c6          stereo      0x00eb14          vol+        0x00d926          vol-        0x0059a6          setup       0xc09867          sound       0x80ea15                   0x80aa55          down        0x802ad5          left        0x4000ff          right       0x40807f          tunerev     0x4040bf          tunefwd     0x40c03f          flip        0xc0906f          band        0xc0609f          inputsel    0xc06a95          a/b         0x0010ef          auto        0x4020df          dimmer      0x40b847          dvd6ch      0xc001fe          cd/dvd      0x0049b6          phono       0x0009f6          tuner       0x008976          video1      0x006996          video2      0x0040bf          video3      0xc0b847          md/tape     0x00a956          avaux       0x00c936          loudness    0x00fa05          tone        0x80ab54          bass        0x40ea15                              1       0x00817e          2       0x0041be          3       0x00c13e          4       0x0021de          5       0x00a15e          6       0x00619e          7       0x00e11e          8       0x0011ee          9       0x00916e          0       0x0001fe          +10     0x00b04f          +100    0x40f20d                    end codes    end remote
put file in /usr/share/lirc/extras/transmitters/
if you're wondering how use, master.conf file want use
code:
sudo cp master.conf /usr/share/lirc/extras/transmitters/master.conf
now configure lirc knows transmit.
code:
sudo gedit /etc/lirc/hardware.conf
and edit transmitter_lircd_conf
code:
# /etc/lirc/hardware.conf  #  #chosen remote control  remote="windows media center transceivers/remotes (all)"  remote_modules="lirc_dev mceusb"  remote_driver=""  remote_device="/dev/lirc0"  remote_socket=""  remote_lircd_conf="mceusb/lircd.conf.mceusb"  remote_lircd_args=""    #chosen ir transmitter  transmitter="microsoft windows media center v2 (usb) : kenwood"  transmitter_modules="lirc_dev mceusb"  transmitter_driver=""  transmitter_device=""  transmitter_socket=""  transmitter_lircd_conf="master.conf"  transmitter_lircd_args=""    #enable lircd  start_lircd="true"    #don't start lircmd if there seems config file  #start_lircmd="false"    #try load appropriate kernel modules  load_modules="true"    # default configuration files hardware if  lircmd_conf=""    #forcing noninteractive reconfiguration  #if lirc reconfigured external application  #that doesn't have debconf frontend available, noninteractive  #frontend can invoked , set parse remote , transmitter  #it populate other variables without user input  #if configure lirc via standard methods, sure  #to leave set "false"  force_noninteractive_reconfiguration="false"  start_lircmd=""
we need edit lircd.conf include master.conf
code:
sudo gedit /etc/lirc/lircd.conf
code:
#this configuration has been automatically generated via  #the ubuntu lirc package maintainer scripts.  #  #it includes default configuration remote and/or  #transmitter have selected during package installation.  #  #feel free add custom remotes configuration  #via additional include directives or below existing  #ubuntu include directives selected remote and/or  #transmitter.    #configuration windows media center transceivers/remotes (all) remote:  include "/usr/share/lirc/remotes/mceusb/lircd.conf.mceusb"    #configuration microsoft windows media center v2 (usb) : master:  include "/usr/share/lirc/extras/transmitters/master.conf"

ok cool lirc configured. reboot , see if lirc can send ir commands.
hope have ir transmitter setup in front of ir eye of device controlling.
using format irsend directive remote code example
code:
irsend send_once vr4085df key_power
should net desired action. (fyi remote , code names in conf file.)
if not fix lirc config before continuing.

now scripting goodness.
lets start xscreensaver.sh
code:
gedit xscreensaver.sh
code:
#!/bin/bash  cd /home/gilson585/  xscreensaver-command -watch|  while read status;    case "$status" in      blank*)        /home/gilson585/sysoff.sh;blanked=1;echo $blanked > blanked        ;;      unblank*)        /home/gilson585/syson.sh;blanked=0;echo $blanked > blanked        ;;    esac  done
please edit that 3 instances of home folder point yours.
fix permissions
code:
chmod 777 xscreensaver.sh
now put in startup applications.
in mythbuntu thats applications > settings > session , startup
in ubuntu thats system > preferences > sessions (or startup applications)
create new entry, name it, , use example below create command.
code:
/home/gilson585/xscreensaver.sh
now lets add scripts xscreensaver.sh calls
code:
gedit syson.sh
code:
#!/bin/sh  cd /home/gilson585/  blanked=`cat blanked`  if [ $blanked -eq 0 ] ;  	blanked=1;echo $blanked > blanked  else  	irsend send_once vr4085df key_power;irsend send_once kenwood_rc-r0813 power;blanked=0;echo $blanked > blanked  	sleep 1  	irsend send_once kenwood_rc-r0813 cd/dvd  fi
obvious edits required here, 1 home directory, devices , codes sent.
should added startup applications.
think know how
fix permissions
code:
chmod 777 syson.sh
code:
gedit sysoff.sh
code:
#!/bin/sh  cd /home/gilson585/  blanked=`cat blanked`  if [ $blanked -eq 0 ] ;  	irsend send_once kenwood_rc-r0813 power;irsend send_once vr4085df key_power;blanked=1;echo $blanked > blanked  fi
again same obvious edits before.
fix permissions
code:
chmod 777 sysoff.sh
we call script upon shutdown within lirc init.d script.
code:
sudo gedit /etc/init.d/lirc
now if search stopping remote control daemon happen across section of code.
code:
		if [ "$start_lircd" = "true" ];  			log_daemon_msg "stopping remote control daemon(s): lirc"  			start-stop-daemon --stop --quiet --exec /usr/sbin/lircd  			log_end_msg $?  			[ -h "$old_socket" ] && rm -f $old_socket  			[ -h "${old_socket}1" ] && rm -f ${old_socket}1  		fi
add su gilson585 -c "/home/gilson585/sysoff.sh" gilson585 username looks this
code:
		if [ "$start_lircd" = "true" ];  			log_daemon_msg "stopping remote control daemon(s): lirc"  			su gilson585 -c "/home/gilson585/sysoff.sh"  			start-stop-daemon --stop --quiet --exec /usr/sbin/lircd  			log_end_msg $?  			[ -h "$old_socket" ] && rm -f $old_socket  			[ -h "${old_socket}1" ] && rm -f ${old_socket}1  		fi
awesome if reboot should turn on , off wanted, same goes screensaver state changes. if not check work.
if don't use xscreensaver script won't when screensaver state changes. can either rewrite sys or use xscreensaver.


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [all variants] How-To use lirc to control receiver and tv power


Ubuntu

Comments

Popular posts from this blog

Could not place because the source rectangle is empty

Thread: Using smartcard reader with vpnc

Adobe Font Folio 7.0 or just 7?