Controlling MythTV using a BlackBerry
This article describes how to install and configure software to use a BlackBerry as a remote to control MythTV.
Freemote Control for iPhone/BlackBerry
Freemote Control is an application for iPhone & BlackBerry smartphones that can control MythTV as well as the mouse and keyboard. A small proxy must be installed. The proxy relays commands from the smartphone over bluetooth (BlackBerry + Linux only) or wifi to MythTV.
You can download a copy of both the proxy and client at http://accentual.com/freemote
Other LIRC compatible applications (mplayer, xine, etc) may also be controlled.
The BlackBerry client application was intended to run on a touch screen device (Storm & Storm2) but it will run with limited functionality on other device models with a trackball. Future releases may enhance the user interface so it will be more useful on non-touch screen devices.
BlackBerry OS Requirements
For touchscreen devices, BlackBerry OS 4.7 (or higher) is required.
For trackball devices, BlackBerry OS 4.5 (or higher) is required.
This program was tested with MythTV 0.21 but earlier (or later) versions may work.
NOTE: The network control protocol for MythTV 0.22 is broken. Both the 'query liveTV' and 'play program' functions do not work and are required for the Channels and Recordings functions. Patches have been submitted to the myth development team. The patch files are available at http://www.accentual.com/freemote/patches.html if you want to apply them yourself to your own build.
The Freemote Control BlackBerry application can talk to the proxy over either Bluetooth or Wifi. Bluetooth is only supported on Linux at the moment. The -t options specifies which it will listen for. (ie. -t socket or -t bluetooth)
There are a number of control options the proxy can use to relay commands to your applications.
All control methods are optional but you need at least one for anything to function. The more you configure, the more functionality you will get out of Freemote Control.
The supported control methods are:
- Lircd simulated IR events
- Desktop mouse/key events
- Myth Frontend socket protocol
Note: For the MythTV frontend socket control protocol to function, you must enable it from the 'General' settings menu.
Others methods may be added in future releases.
Prerequisites (from Phone to Proxy)
For wifi connectivity, you will need a wifi enabled device and any ports open through your PC's firewall.
For bluetooth connectivity (Linux + BlackBerry only), you will need a working bluetooth protocol stack on your linux box. These packages will be required:
Version 4.32 was used for development but earlier releases may work.
To compile freemoted yourself, you will need at least these packages:
On the blackberry, make sure you pair your bluetooth device only AFTER running the sdptool (described below). Otherwise, the bluetooth device will not show up in the settings window of the MythRemote application.
Prerequisites (from Proxy to your applications)
You will need a build environment with g++ and make.
For Lirc clients (MythTV, mplayer, xine, etc), you will need to run a lircd daemon with the --allow-simulate and --listen= options for the proxy to create the necessary simulated IR events. The lirc control method is activated using the '-m lirc' command line option. The host and port for your lirc daemon should be specified through -i and -j options unless they are the default (localhost/8888).
For XWindows mouse/keyboard control, you will need an XWindows server with the XTest extension available. However, if you only intend to control applications that already can be controlled with Lirc, you do not need this option. The XWindow support can be activated using the '-m xwindows' option. The display for which to connect to can be set via -x host:0.0 unless it is the default (:0.0). If you want keyboard and mouse control, you will need the xwindows control method configured.
There are also extra MythTV control options (i.e. query what's on channels and/or what's been recorded) that will only be available if you turn on the socket control options available in the general settings menu of the Myth FrontEnd application. Turn on myth front end control using the '-m mythfe' option. You may also specify the host and port for myth front end unless they are the defaults (localhost, 6546). Use -h host and -p port.
What methods gets used
For buttons, the freemoted.conf file specifies the order for which methods are picked. If the method indicated is not available, it will move on to the next in the list. Make sure your lircrc file matches the strings found in this file (or edit it to match your existing strings). See freemoted.conf for an explanation of the format.
For key strokes, xwindows/windows event injection is preferred first. However, if that is not configured, key events will be transmitted to Myth directly if configured.
Mouse events requires xwindows/windows configured on the command line.
The shell option is always available. If the program you are executing requires an X display, make sure you export your DISPLAY environment variable before launching freemoted so the child process can connect to your display.
There is no configure script yet so you will need to edit the Makefile by hand to suit your platform.
- copy Makefile.linux or Makefile.cygwin to Makefile
- Edit the Makefile and set PREFIX_DIR (default /usr/local)
- type make and hit return
- run make install (will need to be root for /usr/local prefix on Linux)
- If you are using bluetooth on Linux, the following command must be executed at system startup:
sdptool add --channel=1 SP
- Run freemoted with your desired options:
For example, if you will be connecting from your device to your PC over wifi and want to control applications over LIRC, you would type:
./freemoted -t socket -m lirc -i localhost -j lircport
Use -help option for usage.
The myth control socket method alone is not recommended. When myth launches external programs such as mplayer, xine or xmame, the socket does not accept any commands until that program has exited. This makes the remote useless while they are running. The lirc and xwindows methods are preferred.