Results 1 to 5 of 5

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

Threaded View

  1. #1
    Join Date
    May 2009
    Beans
    79
    Distro
    Ubuntu 12.04 Precise Pangolin

    How-To use lirc to automate receiver and tv power w/scripts

    Ever wish your TV and receiver would power on and off with your PC and screensaver? With these scripts and instructions you can.

    Now there are some assumptions here and you would have to tailor this to your setup as this is only an example of mine.
    Most importantly I'm using mythbuntu and xscreensaver is the screensaver used in this distribution for which my script has been written for. I have conf files for the devices I want to control and the scripts are setup for my home directory and devices.

    Now on to the fun stuff.

    You'll need conf files for the devices you want to control.
    http://lirc.sourceforge.net/remotes/
    If you can't find your device here or in /usr/share/lirc/extras/transmitters/ you can create one using irrecord but that is beyond the scope of this how-to. I'll reply with that if you ask though.
    If you have more than one device, you obviously need more than one transmitter but the thing I'd like to stress is that you can copy and paste all the devices into one conf file for lirc to load.
    It should look like my example master.conf below.
    Code:
    # this config file was automatically generated
    # using lirc-0.9.0(default) on Mon Oct 22 12:53:42 2012
    #
    # contributed by David Gilson <gilson585@gmail.com>
    #
    # brand: Westinghouse
    # model no. of remote control: UNKNOWN
    # devices being controlled by this remote: 40" Westinghouse TV VR-4085DF
    #
    # This TV was only available on Black Friday of 2011 in limited quantities
    # from Target
    #
    
    begin remote
    
      name  VR4085DF
      bits           16
      flags SPACE_ENC|CONST_LENGTH
      eps            30
      aeps          100
    
      header       9000  4500
      one           563  1687
      zero          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
    
    #
    # this config file was automatically generated
    # using lirc-0.8.1-CVS(default) on Sat Oct 21 18:34:58 2006
    #
    # contributed by Ben Bronk <rukh13|hotmail.com>
    #
    # brand:                       Kenwood
    # model no. of remote control: RC-R0813
    # devices being controlled by this remote: Kenwood VR-6070
    #
    
    begin remote
    
      name  Kenwood_RC-R0813
      bits           24
      flags SPACE_ENC|CONST_LENGTH
      eps            30
      aeps          100
    
      header       9065  4480
      one           580  1660
      zero          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
            up          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 that file in /usr/share/lirc/extras/transmitters/
    If you're wondering how use, where master.conf is the file you want to use
    Code:
    sudo cp master.conf /usr/share/lirc/extras/transmitters/master.conf
    Now configure lirc so it knows what to 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 even if there seems to be a good config file
    #START_LIRCMD="false"
    
    #Try to load appropriate kernel modules
    LOAD_MODULES="true"
    
    # Default configuration files for your hardware if any
    LIRCMD_CONF=""
    
    #Forcing noninteractive reconfiguration
    #If lirc is to be reconfigured by an external application
    #that doesn't have a debconf frontend available, the noninteractive
    #frontend can be invoked and set to parse REMOTE and TRANSMITTER
    #It will then populate all other variables without any user input
    #If you would like to configure lirc via standard methods, be sure
    #to leave this set to "false"
    FORCE_NONINTERACTIVE_RECONFIGURATION="false"
    START_LIRCMD=""
    We also need to edit lircd.conf to 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 the default configuration for the remote and/or
    #transmitter that you have selected during package installation.
    #
    #Feel free to add any custom remotes to the configuration
    #via additional include directives or below the existing
    #Ubuntu include directives from your selected remote and/or
    #transmitter.
    
    #Configuration for the Windows Media Center Transceivers/Remotes (all) remote:
    include "/usr/share/lirc/remotes/mceusb/lircd.conf.mceusb"
    
    #Configuration for the Microsoft Windows Media Center V2 (usb) : Master:
    include "/usr/share/lirc/extras/transmitters/master.conf"

    OK cool lirc is now configured. Reboot and see if lirc can actually send ir commands.
    I would hope you already have an ir transmitter setup in front of the ir eye of the device you are controlling.
    Using the format irsend DIRECTIVE REMOTE CODE for example
    Code:
    irsend SEND_ONCE VR4085DF KEY_POWER
    Should net the desired action. (FYI remote and code names are in your conf file.)
    If not fix your lirc config before continuing.
    Last edited by gilson585; October 23rd, 2012 at 07:24 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •