リモコン情報受信プログラムのコンパイルと実行

KURO-RS SheevaPlug

KURO-RS に付属している PC-OP-RS1 リモコン情報受信プログラムをコンパイルする。

ソースの取得

HS-DHGL から取得する
root@debian:~# cd /usr/local/src/kuro-rs/
root@debian:/usr/local/src/kuro-rs# ftp 192.168.2.39
Connected to 192.168.2.39.
220 sil FTP server (GNU inetutils 1.5) ready.
Name (192.168.2.39:root): yasunari
331 Password required for yasunari.
Password:
230- Linux sil 2.6.16.16-arm1 #6 Fri Aug 31 13:07:15 JST 2007 armv5tejl
230-
230- The programs included with the Debian GNU/Linux system are free software;
230- the exact distribution terms for each program are described in the
230- individual files in /usr/share/doc/*/copyright.
230-
230- Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
230- permitted by applicable law.
230 User yasunari logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /usr/local/src/kuro-rs/
250 CWD command successful.
ftp> ls
200 PORT command sucessful.
150 Opening ASCII mode data connection for '/bin/ls'.
total 60
-rw-r--r-- 1 staff      240 Sep 22  2007 BUTTON_POWER
-rwxr-xr-x 1 staff    10369 Sep 22  2007 rec
-rwxr-xr-x 1 yamasita   469 Dec 10  2006 rs.h
-rwxr-xr-x 1 yamasita  4024 Dec 10  2006 rs_rec.c
-rwxr-xr-x 1 staff     9777 Jul 18 17:10 rs_send
-rwxr-xr-x 1 staff     4429 Feb 23  2008 rs_send.c
-rwxr-xr-x 1 yamasita  3750 Dec 10  2006 rs_send.c.orig
-rwxr-xr-x 1 staff    10589 Sep 23  2007 send
226 Transfer complete.
ftp> bin
200 Type set to I.
ftp> hash
Hash mark printing on (1024 bytes/hash mark).
ftp> get rs_rec.c
local: rs_rec.c remote: rs_rec.c
200 PORT command sucessful.
150 Opening BINARY mode data connection for 'rs_rec.c' (4024 bytes).
###
226 Transfer complete.
4024 bytes received in 0.01 secs (296.7 kB/s)
ftp> get rs_send.c
local: rs_send.c remote: rs_send.c
200 PORT command sucessful.
150 Opening BINARY mode data connection for 'rs_send.c' (4429 bytes).
####
226 Transfer complete.
4429 bytes received in 0.02 secs (178.3 kB/s)
ftp> get rs.h
local: rs.h remote: rs.h
200 PORT command sucessful.
150 Opening BINARY mode data connection for 'rs.h' (469 bytes).
226 Transfer complete.
469 bytes received in 0.01 secs (87.3 kB/s)
ftp> bye
221 Goodbye.
root@debian:/usr/local/src/kuro-rs#

コンパイル

root@debian:/usr/local/src/kuro-rs# cc -o rs_rec rs_rec.c
rs_rec.c: In function 'main':
rs_rec.c:90: warning: incompatible implicit declaration of built-in function 'memset'
rs_rec.c:101: warning: incompatible implicit declaration of built-in function 'memcpy'
root@debian:/usr/local/src/kuro-rs# cc -o rs_send rs_send.c
root@debian:/usr/local/src/kuro-rs#

学習

SONY の RM220 というリモコンを学習させる。

まずは、電源

root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_POWER
BUTTON_POWER - /dev/ttyUSB0
rec code waiting.........
電源ボタンを押す
Create Rec File : [BUTTON_POWER]
root@debian:/usr/local/src/kuro-rs#
反応した。

他のボタンも学習させる

root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_1
BUTTON_1 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_1]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_2
BUTTON_2 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_2]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_3
BUTTON_3 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_3]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_4
BUTTON_4 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_4]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_5
BUTTON_5 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_5]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_6
BUTTON_6 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_6]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_7
BUTTON_7 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_7]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_8
BUTTON_8 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_8]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_9
BUTTON_9 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_9]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_10
BUTTON_10 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_10]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_11
BUTTON_11 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_11]
root@debian:/usr/local/src/kuro-rs# ./rs_rec BUTTON_12
BUTTON_12 - /dev/ttyUSB0
rec code waiting.........
Create Rec File : [BUTTON_12]
root@debian:/usr/local/src/kuro-rs#

TV の制御

TV に向けて送信してみる
root@debian:/usr/local/src/kuro-rs# ./rs_send BUTTON_POWER
BUTTON_POWER - 1 - /dev/ttyUSB0
Send File : [BUTTON_POWER]
root@debian:/usr/local/src/kuro-rs# 
TV の電源が入った。
もう一回
root@debian:/usr/local/src/kuro-rs# ./rs_send BUTTON_POWER
BUTTON_POWER - 1 - /dev/ttyUSB0
Send File : [BUTTON_POWER]
root@debian:/usr/local/src/kuro-rs#
切れた。

that's it!



KURO-RS
バッファローダイレクト
楽天市場
Amazon

←(前のページ)
ftp のインストール
当月のハックの記録
SheevaPlug/玄柴(KURO-SHEEVA)をハックしよう トップ
(次のページ)→
/etc/rc.local の修正

Copyright (C) 2003-2009 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市