2014-03-06

Linux IR - Transmitter & Receiver


Chapter: IR - Transmitter



LIRC command: irsend
Reference: http://www.lirc.org/html/irsend.html


-- Help
-h --help display usage summary
-v --version display version
-d --device use given lircd socket [/var/run/lirc/lircd]
-a --address=host[:port] connect to lircd at this address
-# --count=n send command n times



-- DIRECTIVE can be:
SEND_ONCE - send CODE [CODE ...] once
SEND_START - start repeating CODE
SEND_STOP - stop repeating CODE
LIST - list configured remote items
SET_TRANSMITTERS - set transmitters NUM [NUM ...]
SIMULATE - simulate IR event



Procedure
Step-01
# cd lirc-0.8.6
# ./setup.sh
# make && make install


Step-02
# setserial /dev/ttyS0 uart none --> turn off running Serial
# modprobe lirc_serial irq=4 io=0x --> configure LIRC into serial port


Step-03
# lircd  --> Redo required to kill the process of lirced using command #ps aux, and then # kill PID.


Step-04
# irsend SEND_ONCE cisco-38k-100608.conf KEY_POWER  --> Send Power signal


Chapter: IR - Receiver



OS: CentOS 5.4
Kernel: 2.6.18-164.10.1.el5


Package: lirc-0.8.6.tar.bz2
Source from: http://www.lirc.org/
Reference: http://www.igphone.net/archiver/tid-10750.html



A. INSTALLATION
# cd lirc-0.8.6
# ./setup.sh
# make && make install

  • Two modules are installed on path
  • path: /lib/modules/2.6.18-194.e15/misc/
  • file: lirc_dev.ko & lirc_serial.ko


# setserial /dev/ttyS0 uart none --> turn off running Serial

  • Install "setserial" if command not found.
  • # apt-get install setserial

# modprobe lirc_serial irq=4 io=0x --> configure LIRC into serial port

  • PS: can using #dmesg command to check what's wrong after above modprobe.

# mode2  --> test your RCU
note: Ctrl+C to quit the testing.


B. Learning RCU
path: /usr/local/bin/irrecord
# irrecord cisco-38k.conf



Step-01: Information for reading.
// irrecord -  application for recording IR-codes for usage with lirc
//
// Copyright (C) 1998,1999 Christoph Bartelmus(lirc@bartelmus.de)
//
// irrecord: driver supports both sending and receiving
// This program will record the signals from your remote control and create a config file for lircd.
//
// A proper config file for lircd is maybe the most vital part of this package, so you should invest some time to
// create a working config file.
// Although I put a good deal of effort in this program it is often not possible to automatically recognize all features
// of a remote control.
// Often short-comings of the receiver hardware make it nearly impossible.
// If you have problems to create a config file READ THE DOCUMENTATION of this package, especially section /
// "Adding new remote controls" for how to get help.
//
// If there already is a remote control of the same brand available at http://www.lirc.org/remotes/ you might also
// want to try using such a remote as a template.
// The config files already contain all parameters of the protocol used by remotes of a certain brand and knowing
// these parameters makes the job of this program much easier.


// There are also template files for the most common protocols available in the remotes/generic/ directory of the
// source distribution of this package.
// You can use a template files by providing the path of the file as command line parameter.
// Please send the finished config files to <lirc@bartelmus.de> so that I can make them available to others.
// Don't forget to put all information that you can get about the remote control in the header of the file.
//
// Press RETURN to continue.



Step-02: Initial
// Now start pressing buttons on your remote control.
//
// It is very important that you press many different buttons and hold them down for approximately one second.
// Each button should generate at least one dot but in no case more than ten dots of output.
// Don't stop pressing buttons until two lines of dots (2x80) have been generated.
//
// Press RETURN now to start recording.



Step-03: Record RCU key
>>  Now enter the names for the buttons.
>>  Please enter the name for the next button (press <ENTER> to finish recording)
>>  key_1
>>
>>  Now hold down button "key_1".
>>  Got it.
>>  Signal length is 67
>>
>>  Please enter the name for the next button (press <ENTER> to finish recording)
>>  key_2
>>
>>  Now hold down button "key_2".
>>  Got it.
>>  Signal length is 67
>>
>>  Please enter the name for the next button (press <ENTER> to finish recording)
>>
# <Press Enter to stop the record>



C.
# cp cisco-38k.conf /etc/lircd.conf
# lircd  --> Redo required to kill the process of lirced using command #ps aux, and then # kill PID.
# irw --> Verify previous learning
>>  0000000000000001 00 key_1 cisco-38k.conf
>>  0000000000000002 00 key_2 cisco-38k.conf
>>  0000000000000003 00 key_3 cisco-38k.conf


NOTE: 如學習後有Learning 不到的 Key, 可獨自學習 再將code貼入原來的檔案取代.


Chapter: IR - LIRC Key Reference


沒有留言:

張貼留言