Commit 28588ac6 authored by keybuk@chromium.org's avatar keybuk@chromium.org

bluetooth: enable gaming devices

BUG=chromium-os:30273
TEST=verified devices show up when discovering

Change-Id: I46284ee28675e726d8479bf3e0cbb812bd764b49


Review URL: http://codereview.chromium.org/10279003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134826 0039d316-1c4b-4281-b951-d872f2087c98
parent ee902534
......@@ -16008,6 +16008,12 @@ Battery full
<message name="IDS_BLUETOOTH_DEVICE_MODEM" desc="Text to identify bluetooth devices of the modem class.">
Modem (<ph name="ADDRESS">$1<ex>12:34:56:78:9A:BC</ex></ph>)
</message>
<message name="IDS_BLUETOOTH_DEVICE_JOYSTICK" desc="Text to identify bluetooth devices of the joystick class.">
Joystick (<ph name="ADDRESS">$1<ex>12:34:56:78:9A:BC</ex></ph>)
</message>
<message name="IDS_BLUETOOTH_DEVICE_GAMEPAD" desc="Text to identify bluetooth devices of the gamepad class.">
Gamepad (<ph name="ADDRESS">$1<ex>12:34:56:78:9A:BC</ex></ph>)
</message>
<message name="IDS_BLUETOOTH_DEVICE_KEYBOARD" desc="Text to identify bluetooth devices of the keyboard class.">
Keyboard (<ph name="ADDRESS">$1<ex>12:34:56:78:9A:BC</ex></ph>)
</message>
......
......@@ -110,7 +110,17 @@ BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const {
switch ((bluetooth_class_ & 0xc0) >> 6) {
case 0x00:
// "Not a keyboard or pointing device."
return DEVICE_PERIPHERAL;
switch ((bluetooth_class_ & 0x01e) >> 2) {
case 0x01:
// Joystick.
return DEVICE_JOYSTICK;
case 0x02:
// Gamepad.
return DEVICE_GAMEPAD;
default:
return DEVICE_PERIPHERAL;
}
break;
case 0x01:
// Keyboard.
return DEVICE_KEYBOARD;
......@@ -137,7 +147,9 @@ BluetoothDevice::DeviceType BluetoothDevice::GetDeviceType() const {
bool BluetoothDevice::IsSupported() const {
DeviceType device_type = GetDeviceType();
return (device_type == DEVICE_KEYBOARD ||
return (device_type == DEVICE_JOYSTICK ||
device_type == DEVICE_GAMEPAD ||
device_type == DEVICE_KEYBOARD ||
device_type == DEVICE_MOUSE ||
device_type == DEVICE_TABLET ||
device_type == DEVICE_KEYBOARD_MOUSE_COMBO);
......@@ -156,6 +168,12 @@ string16 BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() const {
case DEVICE_MODEM:
return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_MODEM,
address);
case DEVICE_JOYSTICK:
return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_JOYSTICK,
address);
case DEVICE_GAMEPAD:
return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_GAMEPAD,
address);
case DEVICE_KEYBOARD:
return l10n_util::GetStringFUTF16(IDS_BLUETOOTH_DEVICE_KEYBOARD,
address);
......
......@@ -47,6 +47,8 @@ class BluetoothDevice : private BluetoothDeviceClient::Observer,
DEVICE_PHONE,
DEVICE_MODEM,
DEVICE_PERIPHERAL,
DEVICE_JOYSTICK,
DEVICE_GAMEPAD,
DEVICE_KEYBOARD,
DEVICE_MOUSE,
DEVICE_TABLET,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment