Remote Control with WM Smartphone
This howto describes how to use your Windows Mobile 5 Smartphone as remote control for your MythBox.
- 1 Introduction
- 2 Installation
- 3 Using MythControl
- 4 Tips and Tricks
I started this project after my old Palm m500 finally broke after I have been using it as remote control for my MythBox a couple of years with OmniRemote. I bought a new Windows Mobile 5 Smartphone and started some experiments to use its Bluetooth capabilities to control MythTV. The result is a project which I called MythControl and that consists of a little server application running on the MythBox and a Windows Mobile 5 Smartphone remote control application.
After I got it running, it turned out to work better than I thought and way better than the Omniremote solution.
- Since it uses Bluetooth, you don't have to point the remote directly at the IR receiver, instead you can even use it in a different room!
- The reaction is way faster than an infrared solution, it feels more like using a keyboard.
- The keys of the smartphone are more convenient to press than any touchscreen.
And with the remote control being completely customizable, I found this to be a perfect remote for my MythBox.
First, we have to pair your bluetooth smartphone with your Linux box, then we can install the server application and the smartphone remote control.
Preparing Bluetooth Installation
For two Bluetooth devices to be able to communicate, they have to get paired first. This is just a very short description on howto pair your smartphone with your Linux box, please refer to the Bluetooth documentation for your Linux distribution for more details. A howto for Gentoo Linux can be found . Please make sure to include Rfcomm in your setup.
You need to have the Bluez tools and development libraries are installed. I use Bluez version 3.7, I can't tell if it works for any other version.
Check your Bluetooth device on your Linux box.
A call to 'hciconfig' should return something like:
# hciconfig hci0: Type: USB BD Address: 08:00:17:1B:42:96 ACL MTU: 339:4 SCO MTU: 60:9 UP RUNNING RX bytes:5603 acl:177 sco:0 events:209 errors:0 TX bytes:40682 acl:270 sco:0 commands:30 errors:0
If no Bluetooth device is being displayed, please check your Bluetooth Dongle, your Bluetooth kernel configuration and your distribution specific Bluetooth startup.
Put your Bluetooth device in 'Discoverable' mode.
# hciconfig hci0 piscan
Start the passkey-agent to set the passkey.
# passkey-agent --default 1234 &
Please replace 1234 with the pairing pin you are going to use. You will have to enter the same pin in your mobile phone in the next step. Since this is the only security precaution, please make sure not to choose something simple!
Offer a RFCOMM serial port emulation on your Linux box.
# sdptool add --channel=3 SP
Please configure your system to execute this command during bootup after the Bluetooth subsystem has been started.
Now it's time to pair your smartphone with the linux box. On your WM5 smartphone, go to Settings->Connections->Bluetooth. Make sure Bluetooth is activated and go futher to Menu->Devices. The phone lists the devices know to it. If your box has never been added before, go tho Menu->New. The smartphone now scans for devices in the area. Your MythBox should show up in the list after the scanning has finished. Select your MythBox and press 'Next'. The phone will now prompt you for the passkey. Enter the passkey you specified for the passkey-agent above and press 'Next' again. A confirmation message will be displayed.
Goto Settings->Connections->Bluetooth again and select Menu->COM Ports this time. Select Menu->New Outgoing Port. Your MythBox should now show up in the list. Select it and specify a port on the next screen (default is COM6). Press Done.
You can now proceed with the MythControl installation.
MythControlServer Installation on your MythBox
Download MythControlServer_version.zip from . Unzip it on your linux box and enter the MythControlServer directory.
# make # make install
By default the mythControlServer application is installed in /usr/local/bin. Edit the makefile to specify a different location.
DO NOT START MYTHCONTROLSERVER AS ROOT!!! Any device that successfully paired with your linux box can send any command to execute to the server, not only mythtv commands! It is therefore important to start mythControlServer as regular user.
I start mythControlServer by adding these two commands to my .xsession file right before mythfrontend is executed.
#!/bin/bash killall mythControlServer /usr/local/bin/mythControlServer -l /home/mythtv/mythControlServer.log & /usr/bin/mythfrontend
Make sure the network remote control interface is enabled in mythfrontend. Goto Setup->General->General page and check that 'Network Remote Control Interface' is enabled and the 'Network Remote Control Port' is set to 6546.
MythControl Installation on your Smartphone
You first need to install the .NET Compact Framework 2 on your smartphone. It can be downloaded at 
Unfortunately there is no msi installer for MythControl yet. Download the software from , copy 'MythControl.cab' to your smartphone and execute it. Alternatively you can point your smartphone internet browser to http://downloads.sourceforge.net/mythcontrol/MythControl.cab to execute it directly on your device.
The cab installer installs two configuration files in MyDocuments/MythControl. Copy 'MythControlSettings.xml' to your desktop computer for edit. This is how it looks like:
<?xml version="1.0" encoding="utf-8" ?> <MythControlSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Title>MythControl</Title> <ComPort>COM6</ComPort> <DirectCommand>key</DirectCommand> <DisplayLicense>no</DisplayLicense> </MythControlSettings>
The Title element obviously specifies the title of the application. You can set this to whatever you want it to be. The ComPort need to be set to the outgoing COM port that was created previously in the Bluetooth setup for the smartphone. COM6 is default. DirectCommand is explained later in this howto. DisplayLicense determines wheather the license disclaimer should be displayed on application start.
Adopt the file, especially the COM port settings, according to your configuration and copy it back on your smartphone.
To start the application, goto Start->MythControl.
This section is more about how MythControl works and how to design your own remote since the usage of MythControl is pretty straight-forward.
You can define multiple RemoteSchemas for MythControl. A RemoteSchema is basically a mapping from smartphone keys to functions. For every key you can specify a label to be displayed on the screen and a command to send to your MythBox. Keys for use with MythControl are the navigation keys ('Up', 'Down', 'Left', 'Right', 'Select' and 'Back') and all the number keys including * and #.
Since you probably need more than 12 commands to control your MythBox, you can add two menus accessible through the left and right softkeys. The left menu will always contain some basic functions like Quit and two submenus to send digits or letters, but you can add unlimited more remote commands or submenus. The right menu can be completely customized by you. Since the default name of the left menu is 'Menu' and the default name of the right menu is 'More', these two menus will be called MenuList and MoreList.
Switch to different Schema
Besides label and command, you can specify for every key or menu item also another RemoteSchema to change to when the key or menu item is invoked. This allows you to create subschemas or schemas for other functionality. I use this functionality extensively. For example you can create a RemoteSchema for LiveTV, one for Recordings, one for Music and so on. For each of these RemoteSchemas you can add a menu item to switch to the other RemoteSchema. If you further specify a mythtv jump command for these menu items, MythTV will jump to the function called at the same time as the remote layout changes.
You can currently specify two different types of commands in MythControl. Every command that starts with 'mythtv ' will be send to the Mythfrontend remote network interface (without the leading 'mythtv'). Every command that starts with 'cmd ' will be executed in a shell. This allows you to execute almost everything via MythControl.
Example RemoteSchema.xml file
The RemoteSchemas are defined in an xml file 'RemoteSchema.xml' that is installed on your smartphone by the installer in MyDocuments->MythControl. Copy the file to your local machine for edit. Here is an example:
Tips and Tricks
Rfcomm kernel patches
Other applications than MythTV like Xine
- cmd keyword
Controlling TV or Receivers
- use lirc
Axel 02:53, 12 February 2007 (UTC)