Index of /files/code/btconn

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory   -  
[   ]btconn-0.1.py 2010-11-21 22:04 2.0K 
[   ]btconn.py 2010-11-21 22:04 2.0K 

I got sick and tired of the lack of command-line utilities written for
the most recent BlueZ API on Linux.  Most notably, the stupid
bluetooth-properties(1) GUI tool doesn't actually allow the option of
connecting to an audio device.  Most of the time I would power on my
Bluetooth headphones, to have them just sit there and not connect.

So, I threw together this little Python script to allow me to issue a
connect() to audio devices, if they're on and in range.

It's pretty simple, just run it with no arguments to show the list of
Bluetooth devices:

% ./btconn.py
Codes: P - paired, C - connected, T - trusted

Name: (none)
Address: 00:02:76:0E:79:9E
Flags: P
Path: /org/bluez/26825/hci0/dev_00_02_76_0E_79_9E

Name: 9xxBackBeat
Address: 00:1C:EF:67:E7:48
Flags: PT
Path: /org/bluez/26825/hci0/dev_00_1C_EF_67_E7_48

Name: Microsoft Bluetooth Notebook Mouse 5000
Address: 00:22:48:DD:F3:BC
Flags: TC
Path: /org/bluez/26825/hci0/dev_00_22_48_DD_F3_BC

Or, run it with a partial name of a paired device, and it'll try its
best to connect:

% ./btconn.py 9xx
Connection to "9xxBackBeat" was successful.

It only connects to audio devices, right now.  Maybe I'll add support
for other types of devices in the future, but right now I don't see the
need (most input devices are more aggressive when trying to connect upon
power-on).