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
This commit is contained in:
1
AUTHORS
1
AUTHORS
@ -95,6 +95,7 @@ Don Woodward <woodward@adobe.com>
|
||||
Dongseong Hwang <dongseong.hwang@intel.com>
|
||||
Dongwoo Joshua Im <dw.im@samsung.com>
|
||||
Douglas F. Turner <doug.turner@gmail.com>
|
||||
Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
|
||||
Edward Crossman <tedoc2000@gmail.com>
|
||||
Eero Häkkinen <e.hakkinen@partner.samsung.com>
|
||||
Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user