Introduction
Hey all, if you are like me then you are kinda tired of having to go into your terminal to setup a Bluetooth connection, and even go there to send and receive files. What IF, there was a nicer, easier way to do it? I just may have the solution.
First of all, this is my first ever script, and this comes from reading the HOWTO on installing a deb via right clicking. So, please be patient with me while I perfect these. These do however, work so far for me.
First of all, if you don't already have a working Bluetooth Connection to your phone (or any other device, this should work for all Bluetooth devices) then read this excellent HOWTO: http://ubuntuforums.org/showthread.p...ight=bluetooth
It talks about Nokia phones, but this will work for any phone. It worked great for my Motorola V551.
After you have a working connection, we need to make some scripts. This is VERY easy to do with Gnome, and this will probably be the last time you will have to open up a terminal for anything Bluetooth again.
Script Setup
Start off like this.
gedit ~/.gnome2/nautilus-scripts/Bluetooth\ Setup
If you read the howto, you will notice that after every reboot, we have to re-pair the devices and activate the proper Bluetooth modules. This script will do it all for us, just have to insert in out sudo password.
Enter this into your gedit window:
#!/bin/bash
modprobe l2cap
gksudo modprobe rfcomm
gksudo mknod /dev/rfcomm0 c 216 0
sdptool add --channel=10 OPUSH
gksudo rfcomm bind /dev/rfcomm0 YOUR_PHONE_ADDRESS 10
done
REMEMBER to change YOUR_PHONE_ADDRESS and put in your phones proper address. An example of a working script is this:
#!/bin/bash
modprobe l2cap
gksudo modprobe rfcomm
gksudo mknod /dev/rfcomm0 c 216 0
sdptool add --channel=10 OPUSH
gksudo rfcomm bind /dev/rfcomm0 00:12:8A:C9:5A:8B 10
done
Close and Save.
Next, we need to make a script to receive files from our phone. NOTE: All files are saved in your /tmp directory, so remember to copy and paste them where you want them. Also, you can currently with the Bluetooth utils, only send ONE FILE AT A TIME. So, that means this script will have to be used for every file sent. Sorry, I know it's a pain.
gedit ~/.gnome2/nautilus-scripts/Bluetooth\ Receive\ File
Copy and Paste
#!/bin/bash
obexserver
done
Save and Close
Next up, we are going to send files to phones.
gedit ~/.gnome2/nautilus-scripts/Bluetooth\ Send\ File
Copy and Paste
#!/bin/bash
for uri in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
gnome-obex-send $uri
done
Save and Close
Now, we have to make this script executable from our menu. Copy and paste the lines below one at a time.
chmod +x ~/.gnome2/nautilus-scripts/Bluetooth\ Setup
chmod +x ~/.gnome2/nautilus-scripts/Bluetooth\ Receive\ File
chmod +x ~/.gnome2/nautilus-scripts/Bluetooth\ Send\ File
Now, on your Right click menu you will have another option called "Scripts". Here is what you do to get transferin' (this would be an example of what you would do after a reboot)
Right click---Scripts---Bluetooth Setup
(enter root password twice)
Right click---Scripts---Bluetooth Receive File
(obexserver is now started, send a file from your phone to your Linux box's /tmp folder)
Right click on a file---Scripts---Bluetooth Send File
(sends selected file(s) to bluetooth paired device)
Closing
Again, these are my first scripts, so I don't expect them to work right away. Please post any comments you have and I will try my best to help everyone with their problem. Also note, this is assuming you have only ONE bluetooth device, so if you want to pair up with another device, you would change the lines in the first scirpt, Bluetooth Setup.
I hope someone finds this useful.
Good luck
Bookmarks