Welcome to Auroran Runner Friday, April 19 2024 @ 10:28 PM UTC

Accessing files on bluetooth phone with Linux

  • Friday, December 28 2007 @ 09:28 AM UTC
  • Contributed by:
  • Views: 16,792
General News

There are many ways for transferring files between your Linux laptop or workstation and mobile phone over bluetooth. I have Nokia E70 and I wanted to be able to mount both my 64MB internal memory card and 2GB external memory card over bluetooth link. That way I'm able to access files on mobile phone by using command line tools or graphical file manager.

I use Gnome, which is default graphical desktop for many Linux distributions. When I hit my ThinkPad's Fn-F5 key combination it turns bluetooth on and I get Bluetooth icon on desktop panel's notification area.

By right clicking this icon, I'm able switch my laptop discoverable by bluetooth devices. This step is needed to pair my E70 with my ThinkPad. To do actual pairing I made following steps

On my phone:

1) Menu --> Connectivity --> Bluetooth --> Paired devices --> New paired device --> [select your ThinkPad and enter pin code]

On my ThinkPad:

2) I entered the pin code I previously entered on my phone

To let my ThinkPad to be able to make connections automatically as shown below, I answered "Yes" on my phone to the following question:

Now I have paired my ThinkPad with my E70. Next I needed to know what is my E70's bluetooth address. This I found out by using command "sdptool browse":

3) [tav@inhambane ~]$ sdptool browse | grep Browsing
Browsing 00:17:E4:46:9C:19 ...

Now we're almost there. I created two scripts, which I placed on my home directories bin directory, which is on my PATH. First scripts was called e70mount.sh

Before doing the script I created directory where to mount the memory cards:

4) mkdir ~/E70

5) vi ~/bin/e70mount.sh
#!/bin/sh

obexfs -b 00:17:E4:46:9C:19 -B 11 ~/E70

As you can see, I use bluetooth address which was discovered previously by using sdptool.

Lets change the permissions for the scripts, so it can be run:

6) chmod 7000 ~/bin/e70mount.sh

To be able to unmount as normal user I edited sudoers file as root:

7) # visudo
[...]
## Umount
Cmnd_Alias UMOUNT = /bin/umount
[..]
tav UMOUNT=(UMOUNT) NOPASSWD: ALL

Then I created another script for unmounting the memory cards:

8) [tav@inhambane ]$ vi ~/bin/e70umount.sh
#!/bin/sh

sudo /bin/umount ~/E70

We still need to make the script executable as before:

9) chmod 700 ~/bin/e70umount.sh

And that's it. Now when I want to access my files on my phone, I simply say e70mount.sh on command line:

10) [tav@inhambane ~]$ e70mount.sh
[tav@inhambane ~]$ ls ~/E70
C: E:
[tav@inhambane ~]$ ls ~/E70/E:/
Auto.m3u cities Documents Downloads Images
Installs Mobility Client Others podcasts Presentations
Sheets shoutcast Sounds Videos

As you can see I'm able to use command line tools or Gnome file manager Nautilus to manage my files on my mobile phone. So when I want to transfer files to or from my phone, I just use normal Linux commands or drag and drop them by using graphical file manager.

When I'm done I just say e70umount.sh on command line.