Fun with Bluetooth and Linux
I've been playing a bit to get my T616 to do slick bluetooth tricks with my notebook. Besides the normal GPRS/Bluetooth dialup, I can use the phone to remote control the computer and as a proximity sensor.
My first trick was the proximity sensor -- the computer knew when I walked away and when I returned, so it could activate and deactivate the screensaver accordingly. Here's my little toy script to do that:
#!/bin/sh STATE=x while true; do if hcitool scan | grep "xx:xx:xx:xx:xx:xx" &> /dev/null; then if [ "$STATE" != "present" ]; then STATE=present echo $STATE xscreensaver-command -deactivate fi else if [ "$STATE" != "absent" ]; then STATE=absent echo $STATE xscreensaver-command -activate fi fi sleep 20 done
I grep the output of hcitool's scan for my BD and have it act on state changes, present or absent.
I finally figured out that I can push files to the phone with obexftp:
obexftp -b xx:xx:xx:xx:xx:xx -p picture.jpg
obexftp -l can be convinced to list the folders on the phone, but the
-g get option just won't work. Luckily, I can start up the
obexserver to accept file transfers initiated by the phone (see its man page for the additional
sbptool command which is required). That's enough to allow me to transfer files without necessarily emailing them to myself. It was disappointing to see that I could not transfer the Java games off the phone. I'd like to archive the games off the phone and make room for other data.
The final trick is the bluetooth remote control. I had looked at a couple tools, but bluemote is the most featureful. It uses
AT commands to push menus and a user interface to the phone screen. The part that took me the longest to figure out is where these menus actually show up! It creates itself as an accessory under Connect->Accessories on the phone. Once you find it there, it'll run whatever actions you've configured (like
rhythmbox --next), control the PCM volume or even control the mouse pointer. It's quite impressive.
Next I need to figure out how to implement a moblog for my phone pictures. I don't expect that to take long.