diff options
author | eduardo.lima@intel.com <eduardo.lima@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-19 14:33:57 +0000 |
---|---|---|
committer | eduardo.lima@intel.com <eduardo.lima@intel.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-19 14:33:57 +0000 |
commit | 7a9d42e479d395d31981ea94f9ce8bb70b24a92a (patch) | |
tree | adf94df35ba4b7fa3fa8f05803c789fda478c11c /device/bluetooth | |
parent | 4469e721788046f7d02989d5117a69358516fa44 (diff) | |
download | chromium_src-7a9d42e479d395d31981ea94f9ce8bb70b24a92a.zip chromium_src-7a9d42e479d395d31981ea94f9ce8bb70b24a92a.tar.gz chromium_src-7a9d42e479d395d31981ea94f9ce8bb70b24a92a.tar.bz2 |
bluetooth_device: Support for Playstation DualShock3 joystick
This device does not require pairing. It is necessary to connect it to
a USB port so it will become available. When disconnected from the USB,
the device will try to connect via Bluetooth, at this time it is marked
as trusted.
Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
R=keybuk@chromium.org
BUG=366356
Review URL: https://codereview.chromium.org/287073003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'device/bluetooth')
-rw-r--r-- | device/bluetooth/bluetooth_adapter_chromeos.cc | 9 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device.cc | 13 | ||||
-rw-r--r-- | device/bluetooth/bluetooth_device.h | 4 |
3 files changed, 25 insertions, 1 deletions
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc index af1d186..1519209 100644 --- a/device/bluetooth/bluetooth_adapter_chromeos.cc +++ b/device/bluetooth/bluetooth_adapter_chromeos.cc @@ -393,11 +393,18 @@ void BluetoothAdapterChromeOS::DevicePropertyChanged( // When a device becomes paired, mark it as trusted so that the user does // not need to approve every incoming connection if (property_name == properties->paired.name() && - properties->paired.value()) + properties->paired.value() && !properties->trusted.value()) device_chromeos->SetTrusted(); // UMA connection counting if (property_name == properties->connected.name()) { + // PlayStation joystick tries to reconnect after disconnection from USB. + // If it is still not trusted, set it, so it becomes available on the + // list of known devices. + if (properties->connected.value() && device_chromeos->IsTrustable() && + !properties->trusted.value()) + device_chromeos->SetTrusted(); + int count = 0; for (DevicesMap::iterator iter = devices_.begin(); diff --git a/device/bluetooth/bluetooth_device.cc b/device/bluetooth/bluetooth_device.cc index ede5382..87c1190 100644 --- a/device/bluetooth/bluetooth_device.cc +++ b/device/bluetooth/bluetooth_device.cc @@ -167,11 +167,24 @@ bool BluetoothDevice::IsPairable() const { // Microsoft "Microsoft Bluetooth Notebook Mouse 5000", model X807028-001 if (type == DEVICE_MOUSE && vendor == "7C:ED:8D") return false; + // Sony PlayStation Dualshock3 + if (IsTrustable()) + return false; + // TODO: Move this database into a config file. return true; } +bool BluetoothDevice::IsTrustable() const { + // Sony PlayStation Dualshock3 + if ((GetVendorID() == 0x054c && GetProductID() == 0x0268 && + GetDeviceName() == "PLAYSTATION(R)3 Controller")) + return true; + + return false; +} + std::vector<BluetoothGattService*> BluetoothDevice::GetGattServices() const { std::vector<BluetoothGattService*> services; diff --git a/device/bluetooth/bluetooth_device.h b/device/bluetooth/bluetooth_device.h index 14365ba..3c17231 100644 --- a/device/bluetooth/bluetooth_device.h +++ b/device/bluetooth/bluetooth_device.h @@ -277,6 +277,10 @@ class BluetoothDevice { // were called after the corresponding call to Connect(). virtual bool IsConnecting() const = 0; + // Indicates whether the device can be trusted, based on device properties, + // such as vendor and product id. + bool IsTrustable() const; + // Returns the set of UUIDs that this device supports. For classic Bluetooth // devices this data is collected from both the EIR data and SDP tables, // for Low Energy devices this data is collected from AD and GATT primary |