BlueTooth remote

Contents
  1. About
  2. Installation
  3. Usage guide
  4. Known issues
  5. Developers
  6. Contact
About
BTMultiplexer is designed to turn bluetooth enabled Sony-Ericsson mobile phones into effective remote controls for GNU/Linux PCs: it provides remote control services to any computer in your network using a single PC-to-Phone bluetooth connection. It's licensed under the GPL.

The following phones support this system:

T68, T68i, T226, T230, T238, T290, T300, T310, T610, T630, Z600

The following phones support a similar system and may work:

P800, P900, Z1010, K700 series, S700 series, K500 series, Z500 series, V800 series, Z800 series, K300 series, J300 series, K600 series, V600 series, K750, W800, Z520, W600, W900

Receiving information of user experiences with any of the latter "may work" phones would be greatly appreciated, see Contact information.

Currently supported remote services(included with btmultiplexer):

  1. btamarok - provides Amarok remote
  2. btmplayer - provides MPlayer remote
  3. btpower - provides remote display power management
  4. btxine - provides XINE remote
  5. btxmms - provides XMMS remote

Please note that although I find btmultiplexer quite usable, it is still in development. There are some known issues that need to be addressed, your contribution could greatly speed up the process. Please see the Developers section for more information.

<return to top>
Installation
We need bluetooth support from the operating system - most users will probably have bluetooth automatically recognized, but for manual installation, there's a good Gentoo wiki on how to install bluetooth support on the system.

Then get the latest version of btmultiplexer

After unpacking...

# tar zxf btmultiplexer-20070126.tar.gz
# cd btmultiplexer-20070126/

...install the files under the desired directory. All files - including configs - will be placed in the given directory, it is recommend to use its own subdirectory for btmultiplexer.

# make install 'DIR=/path/to/btmultiplexer'

In our case the bluetooth connection needs to be opened from the PC to the Phone and not the other way around. To do so we need to know the MAC address of the phone. Make sure your phone has bluetooth enabled and set to visible mode, then scan for bluetooth devices:

# hcitool scan
Scanning ...
    11:22:33:aa:bb:cc       T630

Then edit /etc/bluetooth/rfcomm.conf to define the phone with our recently discovered MAC address:

rfcomm0 {
    # Automatically bind the device at startup
    bind yes;

    # Bluetooth address of the device
    device 11:22:33:aa:bb:cc;

    # RFCOMM channel for the connection
    channel 1;

    # Description of the connection
    comment "Sony-Ericsson T630";
}

Once this has been done, the bluetooth service needs to be restarted for settings to take effect:

# /etc/init.d/bluetooth restart

Please note that USB bluetooth adapters may get interference when placed real close to the PC, so it is recommended to use a USB extension cable to get a little distance to the computer(1 meter can make a big difference).

<return to top>
Usage guide
The server should be started on the computer with the bluetooth device...

# /path/to/btmultiplexer/btmultiplexer

...after which services can be connected from any computer in your network...

# /path/to/btmultiplexer/services/btmplayer video.avi

...and never again watch a movie or listen to music without constantly playing with the controls.

You can change the server to connect in /path/to/btmultiplexer/btmclient.conf if the services are run on another computer than the 'btmultiplexer' server.

The remote itself will be accessible on the phone from Menu>Connectivity>Accessories once the server is connected to the phone.

Pressing the "Online" button from anywhere within the remote control accessory will disconnect bluetooth and wait 15 seconds before attempting to reconnect, giving the user enough time to turn bluetooth off from the phone to preserve battery life.

Remote control keys
btamarok btmplayer btxine btxmms <phone keymap>
1 play
2 stop
:J toggle pause
4/6 prev/next track
</> seek -/+ 20s
[/] seek -/+ 300s
^/v volume up/down
Key bindings designed for upside down use.

#/9 brightness +/-
0/8 contrast +/-
*/7 volume +/-
6/4 AV sync +/- 0.03s
</> seek +/- 20s
[/] seek +/- 300s
:J toggle play/pause
5 toggle fullscreen
c quit
Key bindings designed for upside down use.

#/9 brightness +/-
0/8 contrast +/-
*/7 volume +/-
6/4 AV sync +/- 0.03s
</> seek +/- 20s
[/] seek +/- 300s
:J toggle play/pause
5 toggle fullscreen
c quit
Playback screen controls:

1 play
2 stop
c toggle pause
4/6 prev/next track
</> seek -/+ 5s
[/] seek -/+ 30s
^/v volume up/down
:J key help
# search playlist
Phone button layout
Each service returns to the service list with e(or "back" button)
<return to top>
Known issues
btmplayer
  • On some systems the detection for mplayer closing doesn't seem to work properly; an event is not received of mplayer closing the control pipe. As a result, if mplayer is closed without request from the remote (for example when the video ended), btmplayer may continue to run after mplayer has been closed and will quit due to a broken pipe if the user attempts to access the service again.
btpower
  • Display power management is done using xset, thus the service is X dependant.
btxmms
  • btxmms is written in C, as it was originally intended as an XMMS plug-in. I have been too lazy to implement command line and configuration file parsing for btxmms, as it may be completely rewritten in perl later. See line 120 of src/services/xmms/accessory.c to change server host or port.
  • Sometimes the phone doesn't update the screen as requested, although it claims all is fine by passing OK. This happens most often when returning to the service list from btxmms. For some peculiar reason this seems to work better if the back button is held down a little bit longer instead of a quick press
  • Searching/browsing the playlist requires btxmms to recognize the artist, album and song from each playlist entry, so we require a "artist - album - track" format for the playlist(aka. "%p - %a - %t" in the Title settings in xmms)
<return to top>
Developers
Contribution from the community would be greatly appreciated in a number of areas: new ideas, code submissions, new remote services, logo submissions, name suggestions (so, what "btmultiplexer" does is that it "multiplexes a bluetooth connection", very imaginative, I know), pointing out flaws in this documentation, or creating distribution specific packages.

A little background information

The interaction with the phone is done completely through a Sony-Ericsson specific AT command set. Basically we just tell the phone what to display and receive information of key presses and user selections.

This approach has its pros and cons

  • [pro] all software is run on the PC side so we have quite a lot more resources at our disposal than if they were running on the phone
  • [pro] no software needs to be installed on the phone to use this system
  • [con] as mentioned in the known issues btxmms section, there is a reliability issue with the phone sometimes failing draw requests, thus causing the PC and phone to enter asyncronous state
  • [con] requires support for the SonyEricsson specific AT command set and is thus not very portable among different phone types
  • [con] we're bound to using only predefined screens that are supported by the AT command set

Writing services for btmultiplexer

The server, btmultiplexer, shares a single bluetooth connection with the phone among its connected clients(services). The clients communicate with the server using the same AT command set as with direct serial communication with the phone:

  • To register a name for our service, send AT*EAM="service name".
  • When the service gains focus, it receives *EAAI from btmultiplexer.
  • To release focus(and return to service list) send AT*EAID=0.
...simple, eh? However, a few differences need to be pointed out:
  • The multiplexer will not allow non-focused clients to send to the phone, so when the client releases focus, any additional commands must be sent *before* AT*EAID=0 or they will be disregarded.
  • It is not necessary to send AT*EAID=0 when the client quits - and doing so causes an extra screen draw to occur before the "service quit" notification. To keep the remote system as responsive as possible, it is recommended against sending this command when the client quits.
  • All AT+CMER and AT*ECAM requests from clients are ignored since btmultiplexer internally handles some key presses and keeps notice of incoming phone calls & SMS's to avoid misbehavior if the remote was active at the time of the event.
  • As a result of disabling AT+CMER, btmultiplexer is always listening to key press events. Services that depend solely on menu-based controls can safely disregard key press information.
All other commands are passed directly between the client and phone, provided the client is focused.

The future of btmultiplexer

Recently btmultiplexer hasn't seen very rapid development since it has reached a state of "usable" or "all I need for now", thus slow development in my part may(or may not) be expected in the future. Then again, if people gain interest in this project, feel free to contribute.

See the ToDo file within the package for a list of planned changes, or let me know of your own ideas.

<return to top>
Contact
I can be contacted by e-mail: lupu at users.sourceforge.net

Please check that you have the newest version before reporting problems.

<return to top>
Copyright © Henrik Ala-Uotila

Valid HTML 4.01 Transitional Valid CSS! SourceForge.net Logo