Command Line Bluetooth Transfer
This blog talks about the way to mount bluetooth enabled mobile phone for file transfer via obexfs
and also a very nice way to transfer files without a GUI using sdptool & ussp-push
Don't forget the power of sudo whenever you get any permission denied error ;)
Since I had upgraded my ubuntu version from 11.04 to 11.10.
I never succeeded in sending files via bluetooth to my mobile phone.
And finally the day has come,
I Googled for the error that I use to get while trying to send files via bluetooth
"Permission Denied (13)" and landed Here
From there I got redirected to Launch pad where I found many people reporting the same issue.
I got a chance to know some decent amount of distinct phone models too ;)
And I got him & HEEEE was the Guy whom I was looking for.
Also The issue with 11.10 can be resolved by upgrading your blueman service too via ppa
I just tried his way
$ sudo apt-get install obexfs $ hcitool scan Scanning ... 3C:8B:FE:F6:1B:3A Tamilmani $ obexfs -b 3C:8B:FE:F6:1B:3A /media/tamil #Once I completed my transfer I unmounted it via $ fusermount -u /media/tamilIt worked like a charm :) my phone got mounted & I'm able to transfer data
From man pages fusermount : mount/unmount fuse filesystem [-u==unmount in the above example] obexfs : mount obexFTP(Object Exchange FTP) capable devices obexfs -b[bluetooth]Learn about FUSE Here
From now my exploration started..
What is this hcitool do?
From man pages : Configure Bluetooth Connections & send some special Commands to bluetooth devices
Some Interesting Commands that we can send via hcitool:
scan: Scans all available and visible bluetooth devices dev : Display local device [the host where you run hcitool from] name [addr] : Displays the name of the specified device[addr] info [addr] : Print device name, version and supported features and many more [addr refers to BADDR of device -> unique radio frequency identifier, ex: 3C:8B:FE:F6:1B:3A]
What more ?
I learn't how to transfer data without a gui :P
$ sdptool browse 3C:8B:FE:F6:1B:3A Service Name: Object Exchange Service RecHandle: 0x10005 Service Class ID List: "OBEX Object Push" (0x1105) Protocol Descriptor List: "L2CAP" (0x0100) "RFCOMM" (0x0003) Channel: 5 "OBEX" (0x0008) Profile Descriptor List: "OBEX Object Push" (0x1105) Version: 0x0100 $ sudo apt-get install ussp-push $ ussp-push 3C:8B:FE:F6:1B:3A@5 /home/tamil/image.jpg image.jpgA Brief explanation of the above
sdp -> Service Discovery Protocol sdptool -> Tool to send sdp queries to bluetooth devices Available commands: search : search for a service browse : browse all available services add : add a service to sdpd and many moreSo, using sdptool I figured out a list of services available in my destination bluetooth device
Out of all the services, I found the channel [5 -> highlighted in the output] of OBEX Object Push service
ussp-push -> program that can be used to send files using OBEX (OBject EXchange) protocol over Bluetooth
I did transfer my file from my machine to my phone
$ ussp-push [addr]@channel src dst #dst is just a filename not a path