Sunday, December 23, 2007

Getting it together: Bluetooth file system

Heh. This was initially posted as a reference to the BLEUtooth system...

Shows my bias. Sorry about that, make it BLUEtooth.

I seem to be spending an inordinate amount of time trying to get things sorted away and in place. Very much a whack-a-mole kind of existence.


This fall I got a new cellphone after several years, a Nokia E90. Truly sweet. It can take a microSD chip and act as a thumbdrive. In doing so you have to disable the rest of the phone so that it works only as a thumbdrive on the end of a tether.

Bummer.


Of course I want more: Technicolor Mental Telepathy.

OK, can't go there yet, but how about a Christmas wishlist? How about a wireless mounting that will let me do all normal things without all the wire and tether and other folderol?

===========================
It turns out that you need three things:

the FUSE kernel module

the openftp project

the openfs project

With those you can accomplish exactly the desired outcome.

I plugged the following into Google:

mount bluetooth file system as drive

and immediately found FUSE:

http://fuse.sourceforge.net/wiki/index.php/

FUSE is a system that adds a module to the Linux kernel to enable file mounting and transfer with various arcane systems, including the Nokia Bluetooth system.

Further googling led me to OpenOBEX:

http://sourceforge.net/projects/openobex/

which provides the infrastructure, in particular the openfs system:

http://sourceforge.net/project/showfiles.php?group_id=8960&package_id=178407

This in turn depends on obexftp. SuSE 10.2 offers obexftp on its distribution disk, but not the compilation headers, so you need to download the original source from the site above.

You will also need the development package for python, since obexftp in turn depends on that.

Some excellent references include:

http://www.siltala.net/2007/07/25/mounting-a-nokia-phone-a-little-bit-easier/
http://davesource.com/Solutions/20070520.T-Mobile-Nokia-E65-Ubuntu-Linux.html#obexfs

-----
I know this sounds complicated, but it is progressively so and very doable.

At the end you have a system that will easily mount the phone as a drive, from which you can open , copy, move, rename, delete, and execute files directly without having to fumble around with wires and more especially not have to disable one part or another of the phone to access the information.

Here are some example routines that make it a single keyword snap:

===========================================================
mnt_obex
will mount the phone as /mnt/nokia_e90/:

#! /bin/bash
#
# License: LGPL v3+ (see the file LICENSE)
# (c)2001-2008 C. Andrews Lavarre
# email : alavarre@ids.net
#
########################################################################
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# The GNU General Public License is posted at #
# http://www.gnu.org/licenses/gpl.txt #
# You may also write to the Free Software Foundation, Inc., #
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
########################################################################

# This routine was modified 071223 by C. A. Lavarre (Andy).
# It mounts the Nokia E90 as a drive at /mnt/nokia_e90
# Usage:
# mnt_obex
# Mount the phone as a directory
obexfs -b00:01:02:03:04:05 -B11 /mnt/nokia_e90/

Obviously, you will substitute your own drives vice /mnt/nokia_e90, MAC address for 00:01:02:03:04:05 and your channel for 11 in the -B parameter. Look at the references for more detail.

===========================================================
umnt_obex
will unmount the phone

#! /bin/bash
#
# License: LGPL v3+ (see the file LICENSE)
# (c)2001-2008 C. Andrews Lavarre
# email : alavarre@ids.net
#

########################################################################
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# The GNU General Public License is posted at #
# http://www.gnu.org/licenses/gpl.txt #
# You may also write to the Free Software Foundation, Inc., #
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
########################################################################

# This routine was modified 071223 by C. A. Lavarre (Andy).
# It unmounts the Nokia E90 as a drive at /mnt/nokia_e90
# Usage:
# umnt_obex
# Unmount the phone as a directory
fusermount -u /mnt/nokia_e90/

===========================================================


open_todos
will bring up the ToDo list spreadsheet directly from the phone

#! /bin/bash
#
# License: LGPL v3+ (see the file LICENSE)
# (c)2001-2008 C. Andrews Lavarre
# email : alavarre@ids.net
#

########################################################################
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# The GNU General Public License is posted at #
# http://www.gnu.org/licenses/gpl.txt #
# You may also write to the Free Software Foundation, Inc., #
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
########################################################################

# This routine was modified 071223 by C. A. Lavarre (Andy).
# It mounts the Nokia E90 as a drive at /mnt/nokia_e90
# then opens the todo.xls file from Nokia 2G with oocalc for refinement
# Arguments:
# Usage:
# open_todos
# Mount the phone as a directory
mnt_obex
# Copy the file to the Desktop so that it will be backed up
cp /mnt/nokia_e90/E:/action/todos.xls /Desktop/
# Call CALC to modify
oocalc /mnt/nokia_e90/E:/action/todos.xls &

===========================================================

close_todos
will save the spreadsheet to both the Desktop and the phone and then unmount the phone.

#! /bin/bash
#
# License: LGPL v3+ (see the file LICENSE)
# (c)2001-2008 C. Andrews Lavarre
# email : alavarre@ids.net
#

########################################################################
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# The GNU General Public License is posted at #
# http://www.gnu.org/licenses/gpl.txt #
# You may also write to the Free Software Foundation, Inc., #
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #
########################################################################

# This routine was modified 071223 by C. A. Lavarre (Andy).
# It closes the todo.xls file from Nokia 2G and saves it to the /Desktop
# then unmounts the Nokia E90 as a drive at /mnt/nokia_e90
# Usage:
# close_todos

# Copy the file to the Desktop so that it will be backed up
cp /mnt/nokia_e90/E:/action/todos.xls /Desktop/

# Unmount the phone as a directory
fusermount -u /mnt/nokia_e90

===========================================================

No comments: