Bluetooth Browsing with any File Manager

Share your own howto's etc. Not for support questions!

Bluetooth Browsing with any File Manager

Postby julian67 » 2010-08-01 12:19

If you don't use Gnome but you do use a graphical environment and Bluetooth then you probably use Blueman to scan for and pair bluetooth devices from your PC. But if your file manager is Thunar, PCManFM, Rox, Dolphin, Midnight Commander etc then you are missing out on Bluetooth browsing. Gnome's Nautilus seems to be alone among file managers in supporting the obex:// protocol (if you know of another file manager which does this please post).

Finally, about a decade after the rest of the gadget owning world, I find I now want to use Bluetooth as I've recently acquired a nice used phone with Bluetooth, camera, www, java apps etc. to replace my basic monochrome green screen calls+sms only model...and it was free, thanks sis! Shame about the lurid colour...... anyway I'm using Xfce with Thunar and I quickly realised that while sending via Bluetooth is already integrated into the context menu there is no browsing. I could easily browse Bluetooth shares from my Nokia N810 and my crappy cheapo Android tablet but I couldn't do it from my PC via Blueman or via the file manager. A little searching showed me that obexfs is in the repos
ObexFS uses FUSE to mount filesystems of ObexFTP capable
devices either manually or in autofs style mode.
I tried it and wasn't too keen. I want it easy and foolproof, and to never need to to care what channel is used, what the full bluetooth device name might be, which usb device is which and so on. Then I found a neat script in the Blueman forums. You change one option in Blueman and now when choosing to browse a Bluetooth device instead of calling Nautilus it calls the script which creates a directory and uses fuse to mount the remote bluetooth device's file system on that directory. Choose browse again and it unmounts and removes the directory. As well as Bluetooth and Blueman installed and working you need fuse, fuse-utils and obexfs. You must be a member of the group fuse.

Here's the script:

Code: Select all
#!/bin/bash

log=/var/log/blueman-browse-helper.log
mp=~/.obex-"$1"
channel=`sdptool search --bdaddr "$1" FTP | awk '/Channel:/ {print $2}'`

if [ -e "$mp" ]; then
        echo "`date`: cleaning up mount point '$mp'"                             >> $log
        fusermount -u -z "$mp"                                                  &>> $log
        rmdir "$mp"                                                             &>> $log
else
        echo "`date`: opening FTP channel '$channel' for mount point '$mp'"      >> $log
        mkdir "$mp"                                                             &>> $log
        obexfs -b "$1" -B $channel "$mp"                                        &>> $log
        dolphin "$mp"                                                           &>> $log
fi

echo "`date`: `basename $0` finished for mount point '$mp'"                      >> $log


Make sure you are in the fuse group. Put the script in your path and make it executable. Now right click on the Blueman applet>Local Services>Transfer>Advanced and replace the command in the dialogue box with
Code: Select all
blueman-browse-helper %d


Now when you choose "Browse device" in Blueman it will mount the bluetooth device's file system in a new directory in ~/ and you can browse it with any file manager you prefer. I notice the script specifies the mountpoint as "mp=~/.obex-"$1"" which is hidden, not sure why. I changed mine to "mp=~/Bluetooth-"$1"", no harm done.
Wisdom from my inbox: "do not mock at your pottenocy"
User avatar
julian67
 
Posts: 4648
Joined: 2007-04-06 14:39
Location: Just hanging around

Re: Bluetooth Browsing with any File Manager

Postby Farinet » 2011-12-10 21:13

I wanted to say thank you for this excellent correction of the script found in the blueman group. Anyway, i' ve a follow-up question:

Seems to me that Thunar opening the bluetooth device in obex is incredibily slower than Nautilus. Is there a reason why?

PS. I'm using a PB G4 with squeeze a xfce.
Farinet
 
Posts: 42
Joined: 2011-12-10 20:53

Re: Bluetooth Browsing with any File Manager

Postby craigevil » 2011-12-10 21:34

HOWTO: ic902 OBEX File Transfer - HowardForums Wiki : http://wiki.howardforums.com/index.php/ ... e_Transfer

A bit older but still has steps for konqueror:
Send Files Via Bluetooth With Linux : http://www.jack-frost.co.uk/send_file_b ... linux.html
Debian Sid KDE Kernel 3.17 Thinkpad R40 Intel M 1.3 CPU 2GB RAM Radeon Mobility 7500
Debian - "If you can't apt-get something, it isn't useful or doesn't exist"
Debian upgrade script smxi | sysinfo script inxi
User avatar
craigevil
 
Posts: 5158
Joined: 2006-09-17 03:17
Location: Oz

Re: Bluetooth Browsing with any File Manager

Postby Farinet » 2011-12-10 22:37

Thanks. But i don't see a relation to my problem (xfce with thunar and obex) . . . (?)
Farinet
 
Posts: 42
Joined: 2011-12-10 20:53

Re: Bluetooth Browsing with any File Manager

Postby Farinet » 2011-12-16 12:29

After a crash i re-installed all, passing to wheezy btw, tweaked Thunar like in the old setup, but now: it does not open really the phone fs: When i do Search for files Thunar opens with a directory 'Bluetooth-' and it's empty (practically like before with the original script (then, there was ".obex-' ).

May be the output of the log file helps to understand:

Code: Select all
Fr 16. Dez 13:44:18 CET 2011: cleaning up mount point '~/Bluetooth-'
fusermount: entry for ~/Bluetooth- not found in /etc/mtab
Fr 16. Dez 13:44:18 CET 2011: blueman-browse-helper finished for mount point '~/Bluetooth-'
Fr 16. Dez 13:44:56 CET 2011: opening FTP channel '' for mount point '~/Bluetooth-'
Fr 16. Dez 13:45:00 CET 2011: blueman-browse-helper finished for mount point '~/Bluetooth-'

Note: i changed my complete home dir by '~' .
What i'm missing here? Anyone out there who could help? TIA.

PS. Before it was Thunar opened a directory called according to the bluetooth id if the phone ( 00: . . . . ) and i could browse it, looking for the files i wanted to transfer.
Farinet
 
Posts: 42
Joined: 2011-12-10 20:53

Re: Bluetooth Browsing with any File Manager

Postby Farinet » 2011-12-16 18:38

Meanwhile i played around the problem and tried out this:

Code: Select all
   ~# hcitool scan
Scanning ...
   00:25:48:3A:A9:58   Nokia 3120 classic

Then:
Code: Select all
~# sdptool search FTP
Inquiring ...
Searching for FTP on 00:25:48:3A:A9:58 ...
Service Name: OBEX File Transfer
Service RecHandle: 0x10002
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 10
  "OBEX" (0x0008)
Language Base Attr List:
  code_ISO639: 0x656e
  encoding:    0x6a
  base_offset: 0x100
Profile Descriptor List:
  "OBEX File Transfer" (0x1106)
    Version: 0x0100

Then:
Code: Select all
~# sudo modprobe fuse

Then:
Code: Select all
~# mkdir ~/Phone

Then:
Code: Select all
~# obexfs -b00:25:48:3A:A9:58 -BYY ~/Phone

Then, to finish - after i didn't have any positive result:
Code: Select all
~# fusermount -u ~/Phone


The result was the same: All seems to work well no error, but the directory ~/Phone was empty too :-(

Any ideas?
Farinet
 
Posts: 42
Joined: 2011-12-10 20:53

Re: Bluetooth Browsing with any File Manager

Postby Farinet » 2011-12-19 19:45

I re-did all concerning the blueman setup to use thunar as default helper (instead of nautilus) and, voilà, now it works! :) :)

May be, i touched something essential in the system by not doin well
Code: Select all
dpkg-reconfigure locales
? I chose de de (generic german settings), then in a second attempt i preferred UTF8-deu and several of my problems seems to be solved . . .
Farinet
 
Posts: 42
Joined: 2011-12-10 20:53

Re: Bluetooth Browsing with any File Manager

Postby gradinaruvasile » 2012-01-19 10:35

I use Debian Testing with Xfce 4.8. Browsing obex: stuff was never an issue. That is, if you use Blueman.
Its easy: Just install Blueman, do a search, select your device and from blueman's window select "browse device". This (after accepting from the device) will open the obex share in the file manager specified in Blueman's "local services/advanced" settings (i have "thunar obex://[%d]").
The devices from Blueman will also appear mounted in Gigolo as an obex source and can be used from there later (that is, if the device stays connected).

PS. I also recommend using Gigolo - this is one of Xfce's powerful and overlooked tools - it manages ALL mounted devices (gvfs, fstab, udisk, obex etc) and can mount via gvfs, do network discovery and whatnot. It is very very handy tool (eliminating nautilus' superiority in the network access), it can be put in autolaunch and you will have it in the system tray. One thing: do not forget to specify your file manager to open the gigolo mounts (edit-preferences-general)
User avatar
gradinaruvasile
 
Posts: 690
Joined: 2010-01-31 22:03
Location: Cluj, Romania


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable