Tuesday 6 December 2016

Receiving files from a phone using Bluetooth on a Linux machine

Following the other posts in this genre, I am going to describe a way to receive files sent from a mobile phone to a Linux machine using Bluetooth and as advertised, everything is going to be directly from the terminal.
First of all you need to look for a Bluetooth service running on the Linux machine. To do so, list the services out using the following command:

$ sudo sdptool browse local | grep "Service Name"

This will list out all the Bluetooth services offered presently by the machine. In order to receive files we need the service: "Object Push Profile". If it is listed then all is set otherwise you need to install it by either following this tutorial or simply following these commands:

$ sudo apt-get install obexpushd

Check if the obex-data process is still running:

$ ps auwx | grep obex-data

This will return a process id if the process is running otherwise nothing will be returned. Assuming the process id is XXXX, apply:

$ kill -9 XXXX

Start the service now using the following command:

$ sudo obexpushd -B -n

It should give the following output:

This software comes with ABSOLUTELY NO WARRANTY.
        This is free software, and you are welcome to redistribute it
        under certain conditions.
        Listening on bluetooth/[00:00:00:00:00:00]:9
        
Keep this thing running and open another terminal. Following the procedure given in this post, connect with the phone you wish to communicate with.
Now it is time to send files from your phone. Your machine will be ready to receive the files by now. When the transfer is done, you can quit the interactive session and kill the obexpushd process by doing ctrl + c.

No comments:

Post a Comment