diff options
author | Szymon Janc <szymon.janc@gmail.com> | 2013-12-01 14:41:55 +0100 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-12-03 09:46:56 +0200 |
commit | 67c269d17185ae531058951dadfad05ef4442faf (patch) | |
tree | 23f03424d662548a7d91102b51666487a25c03db /plugins/sixaxis.c | |
parent | 6cfb23dd3adfc0a1dace2f7e33641f2259608337 (diff) | |
download | bluez-67c269d17185ae531058951dadfad05ef4442faf.tar.gz |
sixaxis: Skip controller setup if already connected over Bluetooth
If controller is already connected over Bluetooth but was then
plugged-in via USB (eg. to charge battery) there is no need to do
any setup.
Diffstat (limited to 'plugins/sixaxis.c')
-rw-r--r-- | plugins/sixaxis.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c index c3ca26797..b8fe287fc 100644 --- a/plugins/sixaxis.c +++ b/plugins/sixaxis.c @@ -194,6 +194,12 @@ static void setup_device(int fd, int index, struct btd_adapter *adapter) if (get_master_bdaddr(fd, &master_bdaddr) < 0) return; + /* This can happen if controller was plugged while already connected + * eg. to charge up battery */ + device = btd_adapter_find_device(adapter, &device_bdaddr); + if (device && btd_device_is_connected(device)) + return; + adapter_bdaddr = btd_adapter_get_address(adapter); if (bacmp(adapter_bdaddr, &master_bdaddr)) { |