[mythtv-users] Serial control of a TV

Ronald Frazier ron at ronfrazier.net
Tue Mar 17 12:22:19 UTC 2009


> Is anyone controlling a Sharp TV via serial?


Sorry I'm a few days late replying, but I am doing serial control of
my Aquos. I wrote a custom perl script to handle it using the
Device::SerialPort module. You can download the perl module here:

http://www.ronfrazier.net/mythtv/downloads/Aquos.pm

On my system, I've got several scripts that try to control the TV, and
since I didn't want them trying to share the serial port, I wrote a
script (aquosserver.pl) that runs in the background, accepts TCP
connections, and then issues commands from those connections and sends
back the results. This way there is only one program touching the
serial port. If you are interested, I can make that program available,
but I need to clean up a few things first. Let me know.

If you want to write your own perl script to use that module, you can
do something like the following (I hope this works right...I just
gutted a few parts of my aquosserver.pl script ):


#!/usr/bin/perl

use strict;
use RFLibs::Aquos;

my $serialport_device = '/dev/ttyS2';
my $aquos = new RFLibs::Aquos($serialport_device);

#enable the TV to be powered on via serial port
$aquos->enable_serial_powerup(1);

#query power status
my $is_power_on = $aquos->power();

#power on
$aquos->power(1);

#turn the volume down by 1
$aquos->adjust_volume(-1);

#set the volume to 12
$aquos->volume(12);

#query the current volume
my $volume = $aquos->volume();

#toggle mute
$aquos->toggle_mute();

#set to input 6
return $aquos->input(6);


-- 
Ron
Ronald Frazier Photography - http://www.ronfphoto.com/
Blogging About Photography - http://ronfrazier.blogspot.com/


More information about the mythtv-users mailing list