How often have you wished that you could go to the next or previous slide while giving a presentation without going near your notebook; or you could increase or decrease volume of the songs that your PC is playing without getting out of the comforts of your couch. To do so, you do not require any additional wireless input device as you can do this by using your
bluetooth-enabled cellphone.
In this article, we will see how to remote control a PC running Linux from a Bluetooth-enabled handset using a software called Bluemote. We used a Sony Ericsson for the purpose.
Setting Bluetooth on Linux
Most of the contemporary distributions come with BlueZ bluetooth stack (www.bluez.org) as it is a part of the official Linux kernel since version 2.4.6. If your kernel is not already patched with BlueZ, you can download and patch it from
http://www.bluez.org/patches.html. Apart from BlueZ enabled kernel, you would require BlueZ's user space programs (available either with the distribution or downloadable from bluez.org) and a Bluetooth dongle to connect your PC with
another Bluetooth device.
|
Once you have BlueZ stack running, switch on Bluetooth on your cellphone and then find out hwaddr of your cellphone using the following command.
$ hcitool scan
Scanning ...
00:00:00:EE:EE:EE K700i
At this point, make sure you have 'paired' your PC with your cellphone. For this, go to Connectivity>Bluetooth>New Device on your phone menu and add a 'New Device'. You will require a PIN for pairing. For this edit, /etc/bluetooth/pin and set it to the desired PIN. Supply this PIN when asked for, on your
cellphone.
Then login as root and issue the following command.
# rfcomm bind 0 00:00:00:EE:EE:EE
The '0' after 'bind' specifies the device to which binding will be done (here /dev/rfcomm0). Bluemote uses '0' by default, and you can bind on different device if this is already used. You can check if the bind was successful by issuing:
# rfcomm
rfcomm0: 00:00:00:EE:EE:EE channel 1 clean
Bluemote
Bluemote helps you use your bluetooth-enabled T610 (or compatible Sony Ericsson cellphone) as a remote for your Linux PC. It includes mouse and keyboard emulation, events support, volume control etc. It also provides a mini-shell through which you can execute virtually any command on your PC. The menu of the remote is also customizable. Download it from
http://www.geocities.com/saravkrish/progs/bluemote/
Setting up and running Bluemote
Download Bluemote's source file from http://www.geocities.
com/saravkrish/progs/bluemote/bluemote.2.0.tar.gz and unzip the contents of the file in a directory. It comes with a binary compiled in Fedora Core1. If the binary does not run on your distribution, then issue 'make' command to compile Bluemote on your system. After this, create a directory named '.bluemote' in your home directory (remember, the directory name should start with a '.', although, the manual states that bluemote looks in ~/bluemote/ for config file, it actually looks into ~/.bluemote/). Copy 'bluemote-example.cfg' to this newly created directory as 'bluemote.cfg'. This configuration file is only an example, you can write your own configuration file on a similar pattern.
If you want to use functions such as mute, moveout and incoming call, which come with the example config file, you will have to download script files from
http://www.geocities.com/saravkrish/progs/bluemote/scripts.tar.gz. Extract this file in your home directory, so that you will have the scripts in ~/scripts/ directory. To run these scripts properly, you might need to install some programs such as zenity and xmms-shell.
|
Assuming you have connected on the device 0, issue the following command on your PC.
$ ./bluemote
Setting up signal handlers.
Connecting to phone...
Connected to phone.
Initialising the connection.
Waiting for commands from phone
Go to Connectivity>Accessories>PC Remote on your cellphone and you will see a menu showing the different options depending on your configuration file. For example, choosing 'mouse' will let you control your PC's cursor with joystick's movement. There is a keyboard emulation option, shell execution option and many others.
|
Bluemote for new SE phones (k700/s700 series)
The source code of Bluemote has been modified to make it work with k700i model (it's not been tested, this with s700 series cellphones but, ideally, should also work with them). The source for the same is available on this month's CD. Do a './configure' followed by 'make', after unzipping the source code, for compiling the program.
Original program crashes with SE k700i phones while initializing. If you are a programmer, you might want to compare initport() function in serial.c of original and modified codes. You will notice that while the original function waits for 'OK', modified code waits for 'TZ\nOK' and 'TE=0\nOK'.
Also, k700i's joystick has an eight-way movement, while it was only four-way for T610 (and compatible phones). This also made the program crash for the k700i.
The modified program, also, contains a small extension so that it supports remote controlling OpenOffice presentation with joystick movement.
Sandeep Gupta