Tarkik Mittal
Tarkik Mittal

Reputation: 301

Linux script for Bluetooth operation

I want to automate bluetooth operation on my Ubuntu system. Is there any script or application which I can use to perform basic Bluetooth operations like enable, discover, file transfer and disable.

Upvotes: 2

Views: 4433

Answers (1)

You can enable your bluetooth stick by running

$ hciconfig hciX up

where hciX is a bluetooth device name (e.g hci0)

To obtain a list of devices, just type

$ hciconfig -a

(http://linux.die.net/man/8/hciconfig)

With the BlueZ package installed, you can discover devices nearby using

$ hcitool inq

(http://linux.die.net/man/1/hcitool)

If you wish to use OBEX transfer (the protocol used while sending a file from a bt device to another), you should install the OpenOBEX package with which you may type

$ obexftp -b 00:11:22:33:44:55 --put /some/file/to.put

to send /some/file/to.put to the device with bt address 00:11:22:33:44:55 (http://linux.die.net/man/1/obexftp)

Finally, if you would like to disable your bluetooth adapter, just call

$ hcitool hciX down

UPDATE

The following packages should be installed on your system in order to have the commands listed above available. Some of them may involve kernel extensions (like additional modules).

Regards

Upvotes: 2

Related Questions