무척 긴 글입니다. 그리고 자판기 만으로 충분하다고 생각하시는 분들깨는 쓸데없는 시
간 낭비 일수 있으니 읽지 마시기 바랍니다. 헐리우드 플러스라는 dvd 재생 카드에 딸려 나
오는 리모컨을 리눅스 설치하고 xine을 조작하여 원거리에서 재생시키면서 tv출력하여 보았
더니 너무 편리하더군요. http://www.lirc.org에 가면 프로그램이 있습니다. 그래서 다른 리
모컨을 사용해 보고자 했었는데 거원제트 오디오의 리모컨은 인식하지 못하더군요. 이
유인즉은 리모컨에 사용되는 적외선 수신센서(리모컨 수신기)를 lirc에서 지원하지 못해서
그렇습니다. 그래서 또 삽질했습니다. 수신기를 직접 만들어 보았죠. 결과는 만족입니다.
제가 이글을 올리는 이유는 리눅스에서 리모컨을 사용하고자 하는 삽질맨을 위한 것입니
다. 1. 리모컨 수신기 만들기 0 헐리우드 플러스에 딸려나오는 리모컨이나 vast같은 몇몇 tv
카드에 딸려나오는 리모컨은 lirc로 바로 지원이 됩니다. 0 그렇지 않고 일반 tv에 사용하
는 리모컨으로 컴퓨터를 제어하고 싶은 경우에는 lirc가 지원하는 리모컨 수신기를 만들면
됩니다. 0 만드는 방법은 lirc에서 잘 설명하고 있습니다. 여기 (http://www.manoweb.com/alesan/lirc)
에 보면 그림까지 상세히 설명되어 있어 만드는데 큰 문제가 있지는 않습니다. - 가격은
부품값 도합 5000원 내외, 납땜 기구 약 11000원내외 입니다. - 문제는 부품구하기 인데,
참 구하기 힘들더군요. 특히 제일 중요한 부품인 적외선 센서를 구하기가 힘들었습니다.
소매를 거의 안하더군요. 용산에 가지 마시고, 세운상가에 가십시오. 특히 적외선 센
서는 위에서 추천한 것들로 하시되 세운전자상가 주변에 가면 광덕빌딩(?)안에 "광전자"에
서 구할 수 있습니다. 제가 특정 상호를 직접 거명하는 것은 그만큼 구입에 힘이 들었
기 때문임을 양해해 주시기 바랍니다. 아직까지 허름한 세운상가가 더 많은 전자부품을 가
지고 있더군요.(광센서는 tsop 1738을 사용하는게 좋을 것 같습니다.)) - 그리고 위 홈의 그
림은 센서를 바로 시리얼박스 안에 넣어 놓았는데, 실제로 시리얼 포트는 컴퓨터 뒤쪽에
있으니까 시리얼 짹하고 센서를 선으로 연결해서 앞쪽으로 빼는 것이 좋을 겁니다. - 조
립은 그림대로 하면 특별히 어려운 것은 없습니다. tsop 1738의 경우 다리 한쪽이 넓은 곳이
있어 그곳을 기준으로 조립하면 됩니다. 다만 in4148의 경우 방향을 잘 맞추어야 하는데 몸
통의 무늬를 잘 보면 약간 굵은 줄이 있는 곳을 센서쪽으로 연결하면 됩니다.(제가 시행착
오한 부분) 0 잘 만들어 졌는지 확인하기 위하여 2번 단계로 갑니다. 2. lirc를 설치합니다.
- ./configure후 1->1->1(com1을 사용하는 경우)->ok합니다. - 다음으로 3을 선택한 후 ok합니다.
- 그 다음 make, make install합니다. - 그리고 /etc/modules.conf를 열어 다음을 추가 합니다.
alias char-major-61 lirc_serial - 그리고 재부팅합니다. 3. 수신기 확인 - 재부팅 후 콘솔에
서 mode2를 칩니다. 그런 다음 쓰고자 하는 리모컨의 버튼을 눌러 콘솔화면에 space xxxx pulse xx
x하는 것이 주르르 뜨면 성공입니다. - 여기선 반드시 만세 삼창을 하셔야 합니다. 안 그
러면 부정탄다고 합니다.^_^ 4. 리모컨 셋팅 - 이제 리모컨의 수신부호를 컴퓨터가 알아
듣도록 해야 합니다. - 콘솔에서 chmod 666 /dev/lirc* 해줍니다. - 콘솔에서 irrecord -d /dev/lirc
xxx합니다. 여기서 xxx는 컴퓨터에 쓰고자 하는 리모컨의 이름을 부여하는 것입니다. 잘 기
억해 두시고요. - 혹시 irrecord: could not open /dev/lirc irrecord: default_init(): Device or resou
rce busy 라는 메세지가 나오는 경우에는 lirc데몬이 작동중이라는 것이므로 데몬을 잠시 죽
여주시면 됩니다. - 이제 언테 두면 치고 Press RETURN now to start recording.라는 메세지가 나오
면 Found const length: 107414 please keep on pressing buttons like described above.라는 메세지가 나올때까지
리모컨의 파워버튼을 계속(손떼지 말고) 누르고 있습니다. 다음으로 Found const length: 107414
Please keep on pressing buttons like described above. 라는 메세지가 나오면 이번에는 파워버튼을 한
번씩 한번씩 계속 누릅니다. -이제 Now enter the names for the buttons. Please enter the name for the nex
t button (press <ENTER> to finish recording) 메세지가 나오면 입력하고자 하는 리모컨 버튼의 이
름(예컨데 play버튼이면 play)을 친 후 엔터합니다. - 그리고 리모컨의 해당 버튼을 한번만
누릅니다. - 위와 같은 작업을 반복한 뒤 입력할 버튼이 없으면 엔터키를 한 번 쳐 준
후 잠시 기다리면 입력이 완성됩니다. - 다음으로 방금 저장해둔 xxx 파일을 /etc/lircd.conf
로 저장합니다. cp xxx /etc/lircd.conf 5. 설정파일 만들기 - 리모컨으로 프로그램을 실행할
려면 .lircrc라는 설정파일을 만들어 자신의 홈에 넣어 둡니다. - 여기 예제를 올리니 참
조하시기 바랍니다. 제가 xine으로 dvd를 보는 파일의 일부 입니다.(참 4번까지 한 뒤 xine을
재 컴파일 하셔야 합니다. 그래야 lirc를 인식합니다.) - 아래의 예에서 remote = homeremocon
의 homeremocon은 아까 xxx를 집어 넣으면 됩니다. - 그리고 button = xxx에서 xxx는 lircd.conf에
있는 버튼의 이름과 동일해야 합니다. # # defaults: # remote = * # repeat = 0
# xine dxr3 ok(??)
begin
remote = homeremocon
button = jaesangbang
prog = irexec
repeat = 0
#config = xine -V dxr3&
config = xine -V xv
end
# xine을 xv 옵션으로 실행하라
# Retrieve playlist from NAV plugin(??)
begin
remote = homeremocon
button = jaesangsokdo
prog = xine
repeat = 0
# config = PlaylistFrom:NAV
config = PlaylistFrom:DVD
end
#xine dvd 네비게이션
#play(??)(||>)
begin
remote = homeremocon
button = doidolim
prog = xine
repeat = 1
config = Play
end
#xine dvd play
# Next event.(>>|)
begin
remote = homeremocon
button = 5
prog = xine
repeat = 0
config = EventNext
end
# xine 다음장 실행 xine의 경우 여기까지 해야 플레이가 제대로 되더군요.
#cdrom1 mount
begin
remote = homeremocon
button = 0
prog = irexec
repeat = 0
config = mount /dev/cdrom1 /mnt/cdrom1
end
#
#tv
begin
remote = homeremocon
button = 7
prog = irexec
repeat = 0
config = mplayer /mnt/cdrom1/*.avi&
end
--------
위의 파일을 잘 보면 아시겠지만 응용프로그램을 실행하기 위해서는 prog= irexec를 해주어야
함을 알수 있습니다. 반면 xine과 같이 lirc를 지원하는 경우에는 일단 xine를 실행할 때는 ire
xec가 필요하지만 일단 실행이 되고 나면 prog=xine과 같은 형태로 나가게 됩니다. 밑의 예제
파일을 보면 무슨 뜻인지 아실 겁니다. 6. 프로그램 실행 - 우선 lirc 데몬을 실행합니
다(ntsysv에서 부팅시 자동으로 실행해 놓으면 좋습니다.) - 다음으로 콘솔에서 irexec -d 합
니다.(이것도 자동실행하도록 해 놓으십시요. 저는 /root/.kde/Autostart/에 넣어 두었습니다.)
- 이제 리모컨의 버튼을 누리시면 응용프로그램이 시작됩니다. 7. 예제 및 주의점 -
몇몇 리모컨의 한 두 버튼의 신호를 인식하지 못하기도 합니다. 제 lircd.conf와 .lircrc를
올려드리니 비교해서 사용하시기 바립니다. lircd.conf
==============
# Please make this file available to others
# by sending it to <lirc at bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.6.6(serial) on Sun Jan 7 13:30:20 2018
#
# contributed by
#
# brand: lirc
# model no. of remote control:
# devices being controlled by this remote:
#
begin remote
name homeremocon
bits 16
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100
header 9067 4362
one 637 1600
zero 637 481
ptrail 640
repeat 9067 2135
pre_data_bits 16
pre_data 0x9F
gap 107406
toggle_bit 0
begin codes
jaesangbang 0x000000000000D02F
jaesangsokdo 0x00000000000030CF
sorijulim 0x00000000000020DF
doidolim 0x000000000000609F
jaesangsokdoneulige 0x00000000000010EF
timer 0x000000000000A05F
album 0x000000000000E01F
component 0x000000000000906F
rr 0x00000000000058A7
#up(select) 0x00000000009F00FF
up(select) 0x00000000000000FF
ff 0x000000000000D827
|< 0x000000000000C03F
||(pause) 0x000000000000F807
>| 0x00000000000040BF
stop 0x00000000000038C7
down(select) 0x000000000000807F
record 0x000000000000B847
1 0x0000000000008877
2 0x00000000000048B7
3 0x000000000000C837
4 0x00000000000028D7
5 0x000000000000A857
6 0x0000000000006897
7 0x000000000000E817
8 0x00000000000018E7
9 0x0000000000009867
0 0x00000000000008F7
EQ 0x000000000000B04F
eumjanghwa 0x000000000000708F
size 0x000000000000F00F
pcpoweroff 0x00000000000002FD
videocd 0x0000000000007887
end codes
end remote
==============
여기까지가 lircd.conf입니다.
.lircrc
=============
#
# defaults:
# remote = *
# repeat = 0
# xine dxr3 ok(??)
begin
remote = homeremocon
button = jaesangbang
prog = irexec
repeat = 0
#config = xine -V dxr3&
config = xine -V xv
end
#cdrom1 mount
begin
remote = homeremocon
button = 0
prog = irexec
repeat = 0
config = mount /dev/cdrom1 /mnt/cdrom1
end
#tv
begin
remote = homeremocon
button = 7
prog = irexec
repeat = 0
config = mplayer /mnt/cdrom1/*.avi&
end
# Retrieve playlist from NAV plugin(??)
begin
remote = homeremocon
button = jaesangsokdo
prog = xine
repeat = 0
# config = PlaylistFrom:NAV
config = PlaylistFrom:DVD
end
#play(??)(||>)
begin
remote = homeremocon
button = doidolim
prog = xine
repeat = 1
config = Play
end
# Playback toggle.ok(>||)
begin
remote = homeremocon
button = ||(pause)
prog = xine
repeat = 0
config = Pause
end
# Quit the program.ok(??)
begin
remote = homeremocon
button = stop
prog = xine
repeat = 0
config = Quit
end
# Quit the program.ok(??)
begin
remote = homeremocon
button = pcpoweroff
prog = irexec
repeat = 0
config = motv&
end
# Select next sub picture (subtitle) channel.
begin
remote = homeremocon
button = album
prog = xine
repeat = 0
config = SpuNext
end
# Select next audio channel.
begin
remote = homeremocon
button = eumjanghwa
prog = xine
repeat = 0
config = AudioChannelNext
end
# Audio muting toggle.
begin
remote = homeremocon
button = sorijulim
prog = xine
repeat = 0
config = Mute
end
# Previous event.(|<)
begin
remote = Realmagic
button = xxx
prog = xine
repeat = 0
config = EventPrior
end
# Next event.(>|)
begin
remote = Realmagic
button = xxx
prog = xine
repeat = 0
config = EventNext
end
# Increment audio volume.
begin
remote = homeremocon
button = EQ
prog = xine
repeat = 0
config = Volume+
end
# Decrement audio volume.
begin
remote = homeremocon
button = jaesangsokdoneulige
prog = xine
repeat = 0
config = Volume-
end
# Increment playback speed.
begin
remote = homeremocon
button = ff
prog = xine
repeat = 0
config = SpeedFaster
end
# Decrement playback speed.
begin
remote = homeremocon
button = rr
prog = xine
repeat = 0
config = SpeedSlower
end
# Reset playback speed(^_).
begin
remote = homeremocon
button = videocd
prog = xine
repeat = 0
config = SpeedReset
end
# Toggle aspect ratio
begin
remote = homeremocon
button = size
prog = xine
repeat = 0
config = ToggleAspectRatio
end
# Menu 1 event(menu sightup) ??
begin
remote = homeremocon
button = component
prog = xine
repeat = 0
config = Menu
end
# Up event.
begin
remote = homeremocon
button = up(select)
prog = xine
repeat = 0
config = EventUp
end
# Down event.
begin
remote = homeremocon
button = down(select)
prog = xine
repeat = 0
config = EventDown
end
# Left event.
begin
remote = homeremocon
button = |<
prog = xine
repeat = 0
config = EventLeft
end
# Right event.
begin
remote = homeremocon
button = >|
prog = xine
repeat = 0
config = EventRight
end
# Select event.
begin
remote = homeremocon
button = record
prog = xine
repeat = 0
config = EventSelect
end
# Previous event.(|<<)
begin
remote = homeremocon
button = 6
prog = xine
repeat = 0
config = EventPrior
end
# Next event.(>>|)
begin
remote = homeremocon
button = 5
prog = xine
repeat = 0
config = EventNext
end
# Menu 2 event(??).
begin
remote = homeremocon
button = xxx
prog = xine
repeat = 0
config = Titlemenu
end
# Change audio syncing.
begin
remote = homeremocon
button = 1
prog = xine
repeat = 0
config = AudioVideoDecay+
end
# Change audio syncing.
begin
remote = homeremocon
button = 2
prog = xine
repeat = 0
config = AudioVideoDecay-
end
# Reset audio video syncing offset.
begin
remote = homeremocon
button = 3
prog = xine
repeat = 0
config = AudioVideoDecayReset
end
# Take a snapshot (Internal image fetch and save).
begin
remote = homeremocon
button = 4
prog = xine
repeat = 0
config = Snapshot
end
begin
remote = homeremocon
button = timer
prog = xine
repeat = 0
config = ToggleFullscreen
end
# Zoom into video.
begin
remote = homeremocon
#button = 5
prog = xine
repeat = 0
config = ZoomIn
end
# Zoom out of video.
begin
remote = homeremocon
#button = 6
prog = xine
repeat = 0
config = ZoomOut
end
# Reset zooming.
begin
remote = homeremocon
#button = 7
prog = xine
repeat = 0
config = ZoomReset
end
# Set position to -60 seconds in current stream.
begin
remote = homeremocon
button = 9
prog = xine
repeat = 0
config =SeekRelative-60
end
# Set position forward by numeric argument in current stream.
begin
remote = homeremocon
button = 8
prog = xine
repeat = 0
config = SeekRelative+60
end