summaryrefslogtreecommitdiffstats
path: root/device
diff options
context:
space:
mode:
authorxdai <xdai@chromium.org>2016-02-11 16:43:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-12 00:44:24 +0000
commit052c107aac7617440bcffba5dd5941372ca24e12 (patch)
tree22784538d4fba9af5c6126127bee1309e445f425 /device
parent6dd9369878ac6f0c5d20bf8efca44da113cf725c (diff)
downloadchromium_src-052c107aac7617440bcffba5dd5941372ca24e12.zip
chromium_src-052c107aac7617440bcffba5dd5941372ca24e12.tar.gz
chromium_src-052c107aac7617440bcffba5dd5941372ca24e12.tar.bz2
Improve Bluetooth name in ChromeOS.
BUG=577486 Review URL: https://codereview.chromium.org/1680293002 Cr-Commit-Position: refs/heads/master@{#375063}
Diffstat (limited to 'device')
-rw-r--r--device/bluetooth/bluetooth_adapter_bluez.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/device/bluetooth/bluetooth_adapter_bluez.cc b/device/bluetooth/bluetooth_adapter_bluez.cc
index 141e2db..f8df754 100644
--- a/device/bluetooth/bluetooth_adapter_bluez.cc
+++ b/device/bluetooth/bluetooth_adapter_bluez.cc
@@ -13,6 +13,7 @@
#include "base/metrics/histogram.h"
#include "base/sequenced_task_runner.h"
#include "base/single_thread_task_runner.h"
+#include "base/strings/stringprintf.h"
#include "base/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "device/bluetooth/bluetooth_adapter_profile_bluez.h"
@@ -831,6 +832,12 @@ void BluetoothAdapterBlueZ::SetDefaultAdapterName() {
alias = "ChromeLinux";
#endif
+ // Take the lower 2 bytes of hashed Bluetooth address and combine it with the
+ // device type to create a more identifiable device name.
+ const std::string address = GetAddress();
+ alias = base::StringPrintf(
+ "%s_%04X", alias.c_str(),
+ base::SuperFastHash(address.data(), address.size()) & 0xFFFF);
SetName(alias, base::Bind(&base::DoNothing), base::Bind(&base::DoNothing));
}