OSDN Git Service

android-x86/system-bt.git
10 years agoam f677f810: Merge "DO NOT MERGE Bluetooth: Cleanup bt_config.xml during BLE Scan...
Matthew Xie [Tue, 11 Mar 2014 17:43:52 +0000 (17:43 +0000)]
am f677f810: Merge "DO NOT MERGE Bluetooth: Cleanup bt_config.xml during BLE Scan" into klp-dev

* commit 'f677f81068640857f791276c472e34b08d08f3e6':
  DO NOT MERGE Bluetooth: Cleanup bt_config.xml during BLE Scan

10 years agoam 69218b16: Merge changes I6673d478,I953b9ca6 into klp-dev
Zhihai Xu [Tue, 11 Mar 2014 17:43:34 +0000 (17:43 +0000)]
am 69218b16: Merge changes I6673d478,I953b9ca6 into klp-dev

* commit '69218b169bd0ff9fdf1c5de148b3807e70de85de':
  DO NOT MERGE BLE stack doesn't handle multiple l2cap_conn_update requests
  DO NOT MERGE sometime the BLE connection parameter isnot updated for the first time

10 years agoam 27420a03: (-s ours) Merge "DO NOT MERGE BLE HID device connection failure due...
Zhihai Xu [Tue, 11 Mar 2014 17:43:34 +0000 (17:43 +0000)]
am 27420a03: (-s ours) Merge "DO NOT MERGE BLE HID device connection failure due to security error." into klp-dev

* commit '27420a0327c04ce9407d2fe9138dde7f6dfe94e0':
  DO NOT MERGE BLE HID device connection failure due to security error.

10 years agoMerge "DO NOT MERGE Bluetooth: Cleanup bt_config.xml during BLE Scan" into klp-dev
Matthew Xie [Mon, 10 Mar 2014 18:04:56 +0000 (18:04 +0000)]
Merge "DO NOT MERGE Bluetooth: Cleanup bt_config.xml during BLE Scan" into klp-dev

10 years agoMerge changes I6673d478,I953b9ca6 into klp-dev
Zhihai Xu [Mon, 10 Mar 2014 01:08:14 +0000 (01:08 +0000)]
Merge changes I6673d478,I953b9ca6 into klp-dev

* changes:
  DO NOT MERGE BLE stack doesn't handle multiple l2cap_conn_update requests
  DO NOT MERGE sometime the BLE connection parameter isnot updated for the first time

10 years agoam 14b75b78: Merge "DO NOT MERGE Remove the device from le backgrond connection white...
Zhihai Xu [Sun, 9 Mar 2014 19:15:23 +0000 (19:15 +0000)]
am 14b75b78: Merge "DO NOT MERGE Remove the device from le backgrond connection whitelist when it\'s unpaired" into klp-dev

* commit '14b75b785b730f95ddccfc7a31b048ed0277c96b':
  DO NOT MERGE Remove the device from le backgrond connection whitelist when it's unpaired

10 years agoam 87f26bcd: Merge "DO NOT MERGE BLE Secuity manager state machine generate wrong...
Zhihai Xu [Sun, 9 Mar 2014 19:15:23 +0000 (19:15 +0000)]
am 87f26bcd: Merge "DO NOT MERGE BLE Secuity manager state machine generate wrong pairing success event." into klp-dev

* commit '87f26bcdd92ea462266caf539edb4174834cac17':
  DO NOT MERGE BLE Secuity manager state machine generate wrong pairing success event.

10 years agoam ea8acc97: Merge "DO NOT MERGE fix a potential native crash during bluetooth sutdow...
Zhihai Xu [Sun, 9 Mar 2014 19:15:22 +0000 (19:15 +0000)]
am ea8acc97: Merge "DO NOT MERGE fix a potential native crash during bluetooth sutdown" into klp-dev

* commit 'ea8acc971f7c01427fd239e54344b43ac1a31e1c':
  DO NOT MERGE fix a potential native crash during bluetooth sutdown

10 years agoam 1e0849e9: Merge "DO NOT MERGE the HID device state is out of sync after upair...
Zhihai Xu [Sun, 9 Mar 2014 19:15:22 +0000 (19:15 +0000)]
am 1e0849e9: Merge "DO NOT MERGE the HID device state is out of sync after upair." into klp-dev

* commit '1e0849e99bdd716b7e172269cdad1d78b60a7ded':
  DO NOT MERGE the HID device state is out of sync after upair.

10 years agoam 30466dfd: Merge "DO NOT MERGE Can only support two HID report instance for BLE...
Zhihai Xu [Sun, 9 Mar 2014 19:15:21 +0000 (19:15 +0000)]
am 30466dfd: Merge "DO NOT MERGE Can only support two HID report instance for BLE HID." into klp-dev

* commit '30466dfd399b787ab0fca166b842c280d28feebf':
  DO NOT MERGE Can only support two HID report instance for BLE HID.

10 years agoam 7a528bc8: Merge "DO NOT MERGE read report array out of boundary for BLE HID device...
Zhihai Xu [Sun, 9 Mar 2014 19:15:21 +0000 (19:15 +0000)]
am 7a528bc8: Merge "DO NOT MERGE read report array out of boundary for BLE HID device." into klp-dev

* commit '7a528bc860c349b9d6ae6f8d6c86d54f9448cb0e':
  DO NOT MERGE read report array out of boundary for BLE HID device.

10 years agoam 7a6fad89: Merge "DO NOT MERGE need to increase maximum number HID report for HOGP...
Zhihai Xu [Sun, 9 Mar 2014 19:11:56 +0000 (19:11 +0000)]
am 7a6fad89: Merge "DO NOT MERGE need to increase maximum number HID report for HOGP" into klp-dev

* commit '7a6fad896244a387901572f70b1ce3471712ae34':
  DO NOT MERGE need to increase maximum number HID report for HOGP

10 years agoam 91f01220: DO NOT MERGE trouble syncing with fitbit and can\'t turn off bluetooth.
Zhihai Xu [Sun, 9 Mar 2014 19:11:56 +0000 (19:11 +0000)]
am 91f01220: DO NOT MERGE trouble syncing with fitbit and can\'t turn off bluetooth.

* commit '91f012208070d71e6e9e0f38aa36e78e99f2ff4e':
  DO NOT MERGE trouble syncing with fitbit and can't turn off bluetooth.

10 years agoMerge "DO NOT MERGE BLE HID device connection failure due to security error." into...
Zhihai Xu [Sun, 9 Mar 2014 19:08:59 +0000 (19:08 +0000)]
Merge "DO NOT MERGE BLE HID device connection failure due to security error." into klp-dev

10 years agoMerge "DO NOT MERGE Remove the device from le backgrond connection whitelist when...
Zhihai Xu [Sun, 9 Mar 2014 19:08:35 +0000 (19:08 +0000)]
Merge "DO NOT MERGE Remove the device from le backgrond connection whitelist when it's unpaired" into klp-dev

10 years agoMerge "DO NOT MERGE BLE Secuity manager state machine generate wrong pairing success...
Zhihai Xu [Sun, 9 Mar 2014 19:08:05 +0000 (19:08 +0000)]
Merge "DO NOT MERGE BLE Secuity manager state machine generate wrong pairing success event." into klp-dev

10 years agoMerge "DO NOT MERGE fix a potential native crash during bluetooth sutdown" into klp-dev
Zhihai Xu [Sun, 9 Mar 2014 19:07:33 +0000 (19:07 +0000)]
Merge "DO NOT MERGE fix a potential native crash during bluetooth sutdown" into klp-dev

10 years agoMerge "DO NOT MERGE the HID device state is out of sync after upair." into klp-dev
Zhihai Xu [Sun, 9 Mar 2014 19:07:17 +0000 (19:07 +0000)]
Merge "DO NOT MERGE the HID device state is out of sync after upair." into klp-dev

10 years agoMerge "DO NOT MERGE Can only support two HID report instance for BLE HID." into klp-dev
Zhihai Xu [Sun, 9 Mar 2014 19:06:38 +0000 (19:06 +0000)]
Merge "DO NOT MERGE Can only support two HID report instance for BLE HID." into klp-dev

10 years agoMerge "DO NOT MERGE read report array out of boundary for BLE HID device." into klp-dev
Zhihai Xu [Sun, 9 Mar 2014 19:05:49 +0000 (19:05 +0000)]
Merge "DO NOT MERGE read report array out of boundary for BLE HID device." into klp-dev

10 years agoMerge "DO NOT MERGE need to increase maximum number HID report for HOGP" into klp-dev
Zhihai Xu [Sun, 9 Mar 2014 19:05:37 +0000 (19:05 +0000)]
Merge "DO NOT MERGE need to increase maximum number HID report for HOGP" into klp-dev

10 years agoDO NOT MERGE trouble syncing with fitbit and can't turn off bluetooth.
Zhihai Xu [Wed, 15 Jan 2014 01:46:26 +0000 (17:46 -0800)]
DO NOT MERGE trouble syncing with fitbit and can't turn off bluetooth.

this is to work around broadcom firmware problem to handle
unsolicited command complete event for HCI_LE_Create_Connection_Cancel
and LE connection complete event with status error code (0x2)
unknown connection identifier from bluetooth controller
the workaround is to release the HCI connection to avoid out of sync
with bluetooth controller, which cause BT can't be turned off.

bug:11614046
Change-Id: Ia5c5ad0c6c9b1a4f03253cac8a7caaf21341c88c

10 years agoDO NOT MERGE BLE stack doesn't handle multiple l2cap_conn_update requests
Zhihai Xu [Wed, 18 Dec 2013 04:33:09 +0000 (20:33 -0800)]
DO NOT MERGE BLE stack doesn't handle multiple l2cap_conn_update requests

we can define 4 bits as flags:
1. L2C_BLE_CONN_UPDATE_DISABLE:
if set it means disable update connection parameter. otherwise enable
2.L2C_BLE_NEW_CONN_PARAM:
if set, it means we have new connection parameter which is needed to be configured
if possible(after update done or enable).
3.L2C_BLE_UPDATE_PENDING:
if set, it means waiting for connection parameter update finished.
this flag will be cleared in btu_ble_ll_conn_param_upd_evt.
will be set when we call btsnd_hcic_ble_upd_ll_conn_params
4.L2C_BLE_NOT_DEFAULT_PARAM:
if set, it means we don't use the default connection parameter.
so when we disable update,
we need to configure default connection parameter.
with these 4 flags, we can replace all these states:
UPD_ENABLED, UPD_DISABLED, UPD_PENDING and UPD_UPDATED.
so we can cover all the corner cases which aren't handled
by original code.

bug:11450715
Change-Id: I6673d4783a8063bf9e8a213c6669800f86e67945

10 years agoDO NOT MERGE sometime the BLE connection parameter isnot updated for the first time
Zhihai Xu [Sun, 17 Nov 2013 01:07:38 +0000 (17:07 -0800)]
DO NOT MERGE sometime the BLE connection parameter isnot updated for the first time

When we receive the BLE connection parameter update
from remote device after smp_send_pair_req before
start BLE service discovery(bta_gattc_set_discover_st).
We will miss update this BLE connection parameter.
The reason is we call
L2CA_EnableUpdateBleConnParams(p_cb->pairing_bda, FALSE);
in smp_send_pair_req ,We change the state to UPD_DISABLED.

When we receive the new BLE connection parameter from
remote device, we will update the state to UPD_PENDING,
which will update the new connection parameter
when enable the connection parameter update.

when we start BLE service discovery
we call L2CA_EnableUpdateBleConnParams(p_srcb->server_bda, FALSE);
in bta_gattc_set_discover_st, We will update the state back to
 UPD_DISABLED, which will cause we miss updating
the new connection parameter when enable the connection parameter update.

The fix is don't change the state to UPD_DISABLED
when the state is UPD_PENDING for disabling.

bug:11727252
Change-Id: I953b9ca669e3460e18b340e7779cc54e03d6305b

10 years agoDO NOT MERGE BLE HID device connection failure due to security error.
Zhihai Xu [Wed, 13 Nov 2013 04:18:37 +0000 (20:18 -0800)]
DO NOT MERGE BLE HID device connection failure due to security error.

When HID BLE device start encryption, if some other GATT application
already start encryption(but not finished yet) by calling
gatt_security_check_start. The HID BLE device will be failed to start
encryption, which will cause it to disconnect the BLE HID connection.
The solution is to check whether we already started the encryption
, If the encryption is already started, wait until the encryption
finished, then continue to start security check for BLE HID device.
add encrytion complete event to notify all GATT client encryption done.
filter the event just for BTA HH LE GATT client.

bug:11636246
Change-Id: If58e57c623cc8cfa05208587b010bec68c71306c

10 years agoDO NOT MERGE Remove the device from le backgrond connection whitelist when it's unpaired
Zhihai Xu [Sat, 16 Nov 2013 01:55:46 +0000 (17:55 -0800)]
DO NOT MERGE Remove the device from le backgrond connection whitelist when it's unpaired

this is due to we didn't remove the device from the white list before unpair
Which cause a fake pair request from remote device triggered
right after the acl is disconnected.
The fix is to remove the BLE device from whitelist before unpair.
Also fix a problem return wrong device handle from bta_hh_le_add_device.

if bta_hh_le_add_device is called right after reboot, before we connect HID device.
This is normally true for a previous paired device, which we saved in the nvram.
The wrong device handle will cause the removing HID device from while list failed
after unpair the HID device.

bug:11676338
Change-Id: Id5b45b2829da9a990dfd1dbae0c15764b16c2bfb

10 years agoDO NOT MERGE BLE Secuity manager state machine generate wrong pairing success event.
Zhihai Xu [Sat, 16 Nov 2013 02:57:28 +0000 (18:57 -0800)]
DO NOT MERGE BLE Secuity manager state machine generate wrong pairing success event.

 we call smp_proc_release_delay to setup a timer.
We will send a pair failure message to uplayer after the time expired.
Right before the time expire, the l2cap connection is disconnected
from remote device, we receive L2C_DISC, which will call smp_delay_terminate,
 smp_delay_terminate will send a pair success message to uplayer.
The fix is not to change the status if the remote device disconnect the link

bug:11716967
Change-Id: I8ca63599a170ec86913785aafea552301cec37df

10 years agoDO NOT MERGE fix a potential native crash during bluetooth sutdown
Zhihai Xu [Tue, 26 Nov 2013 01:30:59 +0000 (17:30 -0800)]
DO NOT MERGE fix a potential native crash during bluetooth sutdown

When bluetooth is initialized which call gki_buffer_init,
the buffer pool is allocated by GKI_os_malloc which is
to call libc malloc function.
When bluetooth is cleanup which call GKI_shutdown,
the buffer pool will be  freed by GKI_os_free
which is to call libc free function.
So if we access the buffer, after the whole buffer pool is freed,
we will get this native crash.
if we call cleanup during bluetooth disabling:
the state is still BTIF_CORE_STATE_DISABLING,
then GKI_shutdown will call before bte_main_disable
( bt_hc_if->cleanup();), which is  before userial thread exit.
Then we may trigger this native crash.

bug:11793775
Change-Id: Ic8ced12848d25f918a28f4d5ba29b803d6ac5bd7

10 years agoDO NOT MERGE the HID device state is out of sync after upair.
Zhihai Xu [Sat, 16 Nov 2013 05:18:25 +0000 (21:18 -0800)]
DO NOT MERGE the HID device state is out of sync after upair.

the HID device state is out of sync between java layer and bluedroid stack after upair.
This will cause the HID device can't be connected after repair.
YOu can find the following error message
E/HidService( 1452): Hid Device not disconnected: 00:15:9E:20:29:41

bug:11718702
Change-Id: I271bb77a2cc205c5a0ef396db86b87902d29966b

10 years agoDO NOT MERGE Can only support two HID report instance for BLE HID.
Zhihai Xu [Wed, 18 Dec 2013 22:51:52 +0000 (14:51 -0800)]
DO NOT MERGE Can only support two HID report instance for BLE HID.

The follwoing code cause this problem:
BTA_HH_LE_RPT_INST_ID_MAP(s,c)=(UINT8)(((s)<<4)||(c))
The code use || instead of |, this cause we can only generate
two instance HID report 0 and 1(false and true).

bug:12213520
Change-Id: If6b7cfd9633255401aef12aafd918ee147f256b6

10 years agoDO NOT MERGE read report array out of boundary for BLE HID device.
Zhihai Xu [Wed, 18 Dec 2013 18:06:13 +0000 (10:06 -0800)]
DO NOT MERGE read report array out of boundary for BLE HID device.

report array out of boundary when read HID report reference
descriptor for BLE HID device.

bug:12208657
Change-Id: Ic60fd7555045f367b4fcd606510f52f60e36995e

10 years agoDO NOT MERGE need to increase maximum number HID report for HOGP
Zhihai Xu [Thu, 19 Dec 2013 02:10:26 +0000 (18:10 -0800)]
DO NOT MERGE need to increase maximum number HID report for HOGP

The Mat mouse have more than 10 report (11),
which exceed our limitation

bug:12214036
Change-Id: Id578bf7959f73dc3bd57664eccf49ab5580ec76b

10 years agoam b74fe9e2: (-s ours) DO NOT MERGE LE: Add service UUIDs and data to advertising...
Andre Eisenbach [Sat, 8 Mar 2014 02:07:29 +0000 (02:07 +0000)]
am b74fe9e2: (-s ours) DO NOT MERGE LE: Add service UUIDs and data to advertising data

* commit 'b74fe9e2c9fc0939f5c18282c985622f20b78d2a':
  DO NOT MERGE LE: Add service UUIDs and data to advertising data

10 years agoDO NOT MERGE Bluetooth: Cleanup bt_config.xml during BLE Scan
Sunny Kapdi [Wed, 20 Nov 2013 22:41:41 +0000 (14:41 -0800)]
DO NOT MERGE Bluetooth: Cleanup bt_config.xml during BLE Scan

BLE Scan needs to clean up the bt_config.xml periodically so that
new entries could be added to bt_config.xml. Also, there is no
need to add BLE Random bd_addr to the bt_config.xml

Change-Id: I00ba2e50dd39a021099052cb569786f6cb2cc8b9

b/12912008
(cherry picked from commit 377cb1407ee6ee1ff91b15bfa7052abed1023d18)

Change-Id: I3fa0286c96782822a8fdac14b05bbb6f98636e50

10 years agoDO NOT MERGE LE: Add service UUIDs and data to advertising data
Andre Eisenbach [Fri, 8 Nov 2013 18:23:52 +0000 (10:23 -0800)]
DO NOT MERGE LE: Add service UUIDs and data to advertising data

Add support for UUIDs and custom service data in the advertising and
scan response records.

Cherry picking ble advertising changes from master to KLP MR2.
b/13137996

Change-Id: I6470427ad194871488cc90f3ab384b9ecf326b15

10 years agoAdd HID handshake_callback
Mike J. Chen [Tue, 25 Feb 2014 18:16:30 +0000 (10:16 -0800)]
Add HID handshake_callback

It is called when the equivalent pkt is received from the HID
client as a normal response to set_report() and set_protocol_mode(),
and for errors for get_report() and get_protocol_mode().

Change-Id: I26ec37348e597f294f83907bbd256c88db5ac2ef
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix GKI exception of calling free on an already freed buffer
Mike J. Chen [Tue, 25 Feb 2014 02:07:14 +0000 (18:07 -0800)]
Fix GKI exception of calling free on an already freed buffer

Various parts of btif_hh.c were creating GKI buffers and
keeping references to them and freeing them in odd and
unnecessary ways.  The buffer is freed by lower levels
of the stack once the buffer has been sent to the chip
at the l2c layer and shouldn't be freed by btif_hh itself
since it's possible to double free, and there could
also be race conditions with other threads already processing
the buffer while the reference is freed if the API calls
are invoked again before the previous invocation was completely
processed.

Also added a helper routine to simplify buffer creation and
initialization.

Change-Id: Ia6039983502e2670b2325d90310244edf843b692
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoChange some printfs in sdp_api.c to SDP_TRACE_DEBUG
Mike J. Chen [Tue, 25 Feb 2014 02:11:17 +0000 (18:11 -0800)]
Change some printfs in sdp_api.c to SDP_TRACE_DEBUG

The printfs were going to console, which is generally not useful
in Android.

Change-Id: I3b08247c916dc084dfb004ac71fe234d9a541927
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoMerge "bluetooth: hid: store ssr_max_latency and ssr_min_tout in bonding db" into...
Matthew Xie [Wed, 26 Feb 2014 00:47:33 +0000 (00:47 +0000)]
Merge "bluetooth: hid: store ssr_max_latency and ssr_min_tout in bonding db" into klp-modular-dev

10 years agoMerge "support peripheral mode feature to connect iphone to android device." into...
Zhihai Xu [Tue, 25 Feb 2014 20:41:35 +0000 (20:41 +0000)]
Merge "support peripheral mode feature to connect iphone to android device." into klp-modular-dev

10 years agosupport peripheral mode feature to connect iphone to android device.
Zhihai Xu [Mon, 10 Feb 2014 18:57:13 +0000 (10:57 -0800)]
support peripheral mode feature to connect iphone to android device.

enable BLE_PERIPHERAL_MODE_SUPPORT flag and fix the bug
the discoverability flag is not set in advertisement packet,
which cause the central device(iphone) can not find android device
during scan.
use displayOnly IO cap for dory, so dory can display the pin,
and the iphone(central device) will input the pin.
bug:12797572

Change-Id: Ie15ea9e340e3692df846399b9a85aa6d2a97eba7

10 years agoMerge "Don't send a dummy 0 HID event when connection is closed" into klp-modular-dev
Mike J. Chen [Fri, 14 Feb 2014 19:18:11 +0000 (19:18 +0000)]
Merge "Don't send a dummy 0 HID event when connection is closed" into klp-modular-dev

10 years agoDon't send a dummy 0 HID event when connection is closed
Mike J. Chen [Fri, 14 Feb 2014 02:17:56 +0000 (18:17 -0800)]
Don't send a dummy 0 HID event when connection is closed

This was put there by Broadcom to try to handle held keys
on disconnect, but the best place to do that is in InputManager.
There's no guarantee that a report_id 1 is keyboard, and
in particular it causes game controllers to get a false
joystick move event to 0,0.

Bug 12785130

Change-Id: I85fbafa44d927082def3848132344550e8b94bb0
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoMerge "Fix bug introduced in last change. GATT define was after BLE_INCLUDED define...
Mike J. Chen [Wed, 12 Feb 2014 01:16:10 +0000 (01:16 +0000)]
Merge "Fix bug introduced in last change.  GATT define was after BLE_INCLUDED define." into klp-modular-dev

10 years agoFix bug introduced in last change. GATT define was after BLE_INCLUDED define.
Mike J. Chen [Wed, 12 Feb 2014 00:23:31 +0000 (16:23 -0800)]
Fix bug introduced in last change.  GATT define was after BLE_INCLUDED define.

The bug caused GATT_INCLUDED to be FALSE if not already defined.

Looks like the bluedroid codebase really can't support no GATT or SMP
if BLE_INCLUDED is true.  Lots of compiler failures (not just warnings but
real failures) if GATT or SMP are not set to TRUE when BLE_INCLUDED is true.

Not cleaning that up at this time but just fixing basic build breakage.

Change-Id: I561cd4dcb2b39e90158ce74e55dca294f55cb540
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoMerge "Fix warnings when BLE_INCLUDED is FALSE" into klp-modular-dev
Mike J. Chen [Tue, 11 Feb 2014 23:24:33 +0000 (23:24 +0000)]
Merge "Fix warnings when BLE_INCLUDED is FALSE" into klp-modular-dev

10 years agoMerge "Set some SMP and GATT to FALSE if BLE is FALSE" into klp-modular-dev
Mike J. Chen [Tue, 11 Feb 2014 23:24:22 +0000 (23:24 +0000)]
Merge "Set some SMP and GATT to FALSE if BLE is FALSE" into klp-modular-dev

10 years agoFix warnings when BLE_INCLUDED is FALSE
Mike J. Chen [Tue, 11 Feb 2014 21:51:29 +0000 (13:51 -0800)]
Fix warnings when BLE_INCLUDED is FALSE

Change-Id: I27c8ac6d5410159ed6bbef6aca5bf3b9692b0467
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoSet some SMP and GATT to FALSE if BLE is FALSE
Mike J. Chen [Tue, 11 Feb 2014 21:50:32 +0000 (13:50 -0800)]
Set some SMP and GATT to FALSE if BLE is FALSE

Also add asserts that SMP and GATT are never TRUE
if BLE is FALSE since that would make no sense.

Change-Id: I6530fe0255da0b237daa82b1b0dff286f2c5225d
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoMerge "Revert "Make all warnings fatal compilation errors"" into klp-modular-dev
Mike J. Chen [Tue, 11 Feb 2014 21:05:56 +0000 (21:05 +0000)]
Merge "Revert "Make all warnings fatal compilation errors"" into klp-modular-dev

10 years agoRevert "Make all warnings fatal compilation errors"
Mike J. Chen [Tue, 11 Feb 2014 21:01:26 +0000 (13:01 -0800)]
Revert "Make all warnings fatal compilation errors"

This reverts commit ba1ee422cee82449e675a52a785dac1a9200a3df.

When BLE_INCLUDED is FALSE, we still have a bunch of warnings so
revert until that path is cleaned up.

10 years agoMerge changes Ifc373f95,I95eb887a,I1e6be2ab,Ia6ea939a,I147d0138, ... into klp-modular-dev
Mike J. Chen [Tue, 11 Feb 2014 20:10:59 +0000 (20:10 +0000)]
Merge changes Ifc373f95,I95eb887a,I1e6be2ab,Ia6ea939a,I147d0138, ... into klp-modular-dev

* changes:
  Make all warnings fatal compilation errors
  Major warnings cleanup
  Add macro UNUSED() to bt_utils.h
  Fix unused parameter warning in static function
  Add "static" to a static function
  Fix a number of unused parameter warnings in static functions
  Fix bug with wrong parameter passed to logu
  Default send_ind_evt should be FALSE
  Fix warning "implicit declaration of function 'GAP_BleReadPeerPrefConnParams'"
  Fix unused parameter warnings in static functions by changing prototype
  Fix some unused parameter warnings in static functions
  Fix warnings about implicit declaration of bdcmp and bdcpy
  Fix warning "comparison is always true due to limited range of data type"
  Fix warning "suggest braces around empty body in an 'if' statement"
  Fix warning "comparison is always true due to limited range of data type"
  Add a function prototype for btm_ble_test_command_complete
  Change argument to return ptr rather than assign to unused local
  Fix warning "comparison is always true due to limited range of data type"
  Fix warnings about implicit declarations
  Fix warning "implicit declaration of function 'bdcmp'"
  Fix warning "case label value exceeds maximum value for type"
  Fix missing initializer warning
  Fix missing initializer warning
  Fix warning about missing initializer

10 years agoMake all warnings fatal compilation errors
Mike J. Chen [Sat, 1 Feb 2014 02:16:33 +0000 (18:16 -0800)]
Make all warnings fatal compilation errors

Change-Id: Ifc373f954c8019b1c52d0b1b3636362afb99fff4
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoMajor warnings cleanup
Mike J. Chen [Sat, 1 Feb 2014 02:16:59 +0000 (18:16 -0800)]
Major warnings cleanup

Mostly fixing unused parameter warnings.
A few other warnings also fixed like possible use of
unitialized variables (no real issue found, just compiler couldn't
follow the path), signed vs unsigned warning.

Also fixed some typos, indent issues, removal of dead code, etc.

Change-Id: I95eb887aefc4d559d7921f71a0af5f3bfb01ac01
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoAdd macro UNUSED() to bt_utils.h
Mike J. Chen [Sat, 1 Feb 2014 02:13:09 +0000 (18:13 -0800)]
Add macro UNUSED() to bt_utils.h

Also include bt_utils.h in some other header files commonly
included by some subsystems.

Change-Id: I1e6be2abae503c4303c92d97eeeb29981beacd10
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix unused parameter warning in static function
Mike J. Chen [Sat, 1 Feb 2014 02:09:53 +0000 (18:09 -0800)]
Fix unused parameter warning in static function

Just changed the function to not take the unused parameter

Change-Id: Ia6ea939a45583ad9b8ae83125a0294086fde8909
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoAdd "static" to a static function
Mike J. Chen [Sat, 1 Feb 2014 02:08:58 +0000 (18:08 -0800)]
Add "static" to a static function

Change-Id: I147d0138f2871d1fa873184b1e6e8075328a8501
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix a number of unused parameter warnings in static functions
Mike J. Chen [Sat, 1 Feb 2014 02:07:48 +0000 (18:07 -0800)]
Fix a number of unused parameter warnings in static functions

Since functions were static, just changed them to not take
the unused parameters.

Change-Id: I2f39684d84b1785d60167e617bc5fa79aeac4dda
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix bug with wrong parameter passed to logu
Mike J. Chen [Sat, 1 Feb 2014 02:02:14 +0000 (18:02 -0800)]
Fix bug with wrong parameter passed to logu

Caught by compiler warning "passing argument 2 of 'logu' from incompatible pointer type".

Change-Id: If6047654c9862209d3426f832a366ac884b2c9e9
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoDefault send_ind_evt should be FALSE
Mike J. Chen [Sat, 1 Feb 2014 01:58:14 +0000 (17:58 -0800)]
Default send_ind_evt should be FALSE

Bug found when looking at compiler warning about p_mcb might
be used before being initialized.

Change-Id: I6f74a3c9bb46e757d2420cc871bfe78e51256c3b
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning "implicit declaration of function 'GAP_BleReadPeerPrefConnParams'"
Mike J. Chen [Sat, 1 Feb 2014 01:49:43 +0000 (17:49 -0800)]
Fix warning "implicit declaration of function 'GAP_BleReadPeerPrefConnParams'"

Change-Id: I0e4e45d6f0ade8deb070e610baac2d1945ebc1a5
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoresend discovery primary service ATT request with timeout
Zhihai Xu [Thu, 6 Feb 2014 04:04:48 +0000 (20:04 -0800)]
resend discovery primary service ATT request with timeout

This is to work around the problem with iphone.
The iphone didn't respond with our first ATT request
(read By group type Request for for primary service).
the clockwork/phone host keep waiting for ATT response until disconnection
from iphone due to timeout.
The workaround is to
resend discovery primary service before disconnection from remote device
when response timeout happen.
This workaround will be better for us to interop with remote BLE device.

bug:12895830
Change-Id: I236af8eca9790f2dae7098061c74cec55348ca6d

10 years agoFix unused parameter warnings in static functions by changing prototype
Mike J. Chen [Sat, 1 Feb 2014 01:13:29 +0000 (17:13 -0800)]
Fix unused parameter warnings in static functions by changing prototype

Change-Id: I9cc4646610fd3d25732caac01e8d833724238749
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix some unused parameter warnings in static functions
Mike J. Chen [Sat, 1 Feb 2014 00:37:03 +0000 (16:37 -0800)]
Fix some unused parameter warnings in static functions

Fixed by changing the prototypes of the functions and the
calling location.

Change-Id: Ic27ce9e61f5b66699b59bb14258709cb7ca733a8
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warnings about implicit declaration of bdcmp and bdcpy
Mike J. Chen [Fri, 31 Jan 2014 23:27:49 +0000 (15:27 -0800)]
Fix warnings about implicit declaration of bdcmp and bdcpy

Change-Id: Ib6ad46f566900d514d63a9538a6a8b1c53f04806
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning "comparison is always true due to limited range of data type"
Mike J. Chen [Fri, 31 Jan 2014 23:27:02 +0000 (15:27 -0800)]
Fix warning "comparison is always true due to limited range of data type"

Change-Id: I4b195607d0cd8ee135b26065eed0eef5407061b6
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning "suggest braces around empty body in an 'if' statement"
Mike J. Chen [Fri, 31 Jan 2014 23:25:12 +0000 (15:25 -0800)]
Fix warning "suggest braces around empty body in an 'if' statement"

The body of an if statement could become empty if the macro body
is NULL and cause the if to apply to the next line instead.

Change-Id: I0bea6a46f29bc2c4dfc6e1fa13dd35b094310294
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning "comparison is always true due to limited range of data type"
Mike J. Chen [Fri, 31 Jan 2014 23:14:08 +0000 (15:14 -0800)]
Fix warning "comparison is always true due to limited range of data type"

Change-Id: I1d59e67f507e676513aa006f265cca9179b7c2fe
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoAdd a function prototype for btm_ble_test_command_complete
Mike J. Chen [Fri, 31 Jan 2014 23:13:24 +0000 (15:13 -0800)]
Add a function prototype for btm_ble_test_command_complete

To fix warning about implicit declaration when compiling btu_hcif.c

Change-Id: Ia07ae3036c65928b6981becb12e18115f0af7769
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoChange argument to return ptr rather than assign to unused local
Mike J. Chen [Fri, 31 Jan 2014 23:06:49 +0000 (15:06 -0800)]
Change argument to return ptr rather than assign to unused local

There was a warning about local variable assigned but not used.
I believe this was actually an implementation and API problem.
The function is called "btm_sec_find_bonded_dev" and returns
a BOOLEAN about whether the search succeeded or not.  I believe
it should also return a pointer to the dev rec if the search
succeeded, but due to an API definition error, it was just
assigning a local rather than returning the pointer ot the rec.

Also add to btm_int.h a function prototype that was missing
and causing a warning about implicit declaration.

Change-Id: Ifcef3afe3acbe12f4c69472fcedd01b268f644dd
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning "comparison is always true due to limited range of data type"
Mike J. Chen [Fri, 31 Jan 2014 23:06:22 +0000 (15:06 -0800)]
Fix warning "comparison is always true due to limited range of data type"

Change-Id: I191b4c12ea6d4ed7a898b158d2ae26fffdeb471f
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warnings about implicit declarations
Mike J. Chen [Fri, 31 Jan 2014 23:04:41 +0000 (15:04 -0800)]
Fix warnings about implicit declarations

Two functions were used without including header file
and generating following warnings:

implicit declaration of function 'bta_sys_add_uuid'
implicit declaration of function 'bta_sys_remove_uuid'

Change-Id: I1c36fda7af9e838259b93bd2a29e3547d9df0eb5
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning "implicit declaration of function 'bdcmp'"
Mike J. Chen [Fri, 31 Jan 2014 23:03:44 +0000 (15:03 -0800)]
Fix warning "implicit declaration of function 'bdcmp'"

Change-Id: Ifc13cfa4b88d8483c58dd955ea69f482b06ec79a
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning "case label value exceeds maximum value for type"
Mike J. Chen [Fri, 31 Jan 2014 23:02:31 +0000 (15:02 -0800)]
Fix warning "case label value exceeds maximum value for type"

Change-Id: I1f8ef599b0d64aafe37d3422a8b43cc66ef0e6fe
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix missing initializer warning
Mike J. Chen [Fri, 31 Jan 2014 21:28:58 +0000 (13:28 -0800)]
Fix missing initializer warning

Change-Id: I13e96a25b66a0a789d1adab9e41f2315d294943d
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix missing initializer warning
Mike J. Chen [Fri, 31 Jan 2014 21:26:56 +0000 (13:26 -0800)]
Fix missing initializer warning

Change-Id: Id578a65e05a4ec0416940efdb4de2c758ca90206
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix warning about missing initializer
Mike J. Chen [Fri, 31 Jan 2014 21:24:49 +0000 (13:24 -0800)]
Fix warning about missing initializer

Change-Id: Ifbee10f3de140d51b42a915cb532b58ea67c66cc
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoMerge "Fix HID get_report callback support" into klp-modular-dev
Mike J. Chen [Tue, 28 Jan 2014 20:40:47 +0000 (20:40 +0000)]
Merge "Fix HID get_report callback support" into klp-modular-dev

10 years agoam a94ee494: Merge "Fix calls to pthread_setschedparam."
Matthew Xie [Tue, 28 Jan 2014 20:37:33 +0000 (20:37 +0000)]
am a94ee494: Merge "Fix calls to pthread_setschedparam."

* commit 'a94ee49440718e45147b6b6c26b44dd81d11e1c9':
  Fix calls to pthread_setschedparam.

10 years agoMerge "Fix calls to pthread_setschedparam."
Matthew Xie [Tue, 28 Jan 2014 20:27:06 +0000 (20:27 +0000)]
Merge "Fix calls to pthread_setschedparam."

10 years agoFix HID get_report callback support
Mike J. Chen [Fri, 24 Jan 2014 01:56:18 +0000 (17:56 -0800)]
Fix HID get_report callback support

There were multiple bugs in the code for get_report event
callback handling:

1) the p_dev lookup was using the wrong argument so was coming
   up with NULL ptr and passing it through to the callback

2) the BT_HDR * was being passed to the callback instead of a
   ptr to the payload

3) the size was being passed as a constant BT_HDR_SIZE.

It looked like this code was expecting the callback to parse
the BT_HDR, but that's an internal bluedroid structure.
The callback is defined as receiving the report data and the
report data size, which this change now provides.

Note that the payload might be NULL if the device returns
a HANDSHAKE error msg instead, and so it is valid to pass
the callback a NULL payload ptr and a 0 size.

Change-Id: I462b5cb5d4c460af085dc6e15f59c778a020a80e
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agobluetooth: hid: store ssr_max_latency and ssr_min_tout in bonding db
Adam Hampson [Mon, 27 Jan 2014 22:05:17 +0000 (14:05 -0800)]
bluetooth: hid: store ssr_max_latency and ssr_min_tout in bonding db

Store the ssr_max_latency and ssr_min_tout parameters in the
bonding database.  Previously these parameters were not stored for HID
devices.  This caused an inconsistency in sniff behavior between
when the HID device was paired and following a reboot of the host.

When the HID device is paired the SSR parameters are retrieved
from the HID device and are stored in the HID Host's device list.
If the host is rebooted then the HID Host's device list is
constructed from the bonding database.

If the SSR max latency is non-zero then the SSR parameters are
sent to the firmware and SSR is used.  In the event that the SSR
max latency is 0, as it is if the parameters are not found, then
SSR is disabled.

Bug: 12764547

Change-Id: I63637575fdfcf4cb4ca0ce8dc2e4ccda9cccaf66
Signed-off-by: Adam Hampson <ahampson@google.com>
10 years agoam 32d2c034: Merge "external/bluetooth/bluedroid: convert LOCAL_MODULE_PATH to LOCAL_...
Colin Cross [Tue, 28 Jan 2014 01:03:03 +0000 (01:03 +0000)]
am 32d2c034: Merge "external/bluetooth/bluedroid: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH"

* commit '32d2c03471edb78df635a05bb5bbdc27e9f0e4e1':
  external/bluetooth/bluedroid: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH

10 years agoMerge "external/bluetooth/bluedroid: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATI...
Colin Cross [Tue, 28 Jan 2014 00:47:42 +0000 (00:47 +0000)]
Merge "external/bluetooth/bluedroid: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH"

10 years agoexternal/bluetooth/bluedroid: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH
Colin Cross [Sat, 25 Jan 2014 05:00:32 +0000 (21:00 -0800)]
external/bluetooth/bluedroid: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH

LOCAL_MODULE_PATH doesn't work for multiarch builds, replace it
with LOCAL_MODULE_RELATIVE_PATH.

Change-Id: I4e4ceec61d026bbe74ba604554c06104bde42e5e

10 years agoFix calls to pthread_setschedparam.
Sharvil Nanavati [Wed, 22 Jan 2014 08:04:45 +0000 (00:04 -0800)]
Fix calls to pthread_setschedparam.

When the scheduling priority is set to SCHED_NORMAL, you may not
specify a non-zero priority. The current implementation does
exactly that resulting in the call failing and returning EINVAL.
This change ensures that a priority of 0 is set when the desired
scheduler policy is set to SCHED_NORMAL.

http://b/12304174

Change-Id: I945cae175b7bdd29dd8fc130ff6396b88ec33fcb

10 years agoMerge "BLE stack doesn't handle multiple l2cap_conn_update requests"
Zhihai Xu [Tue, 7 Jan 2014 19:16:27 +0000 (19:16 +0000)]
Merge "BLE stack doesn't handle multiple l2cap_conn_update requests"

10 years agoMerge "Crash pairing keyboard/mouse on N5"
Zhihai Xu [Mon, 6 Jan 2014 23:57:04 +0000 (23:57 +0000)]
Merge "Crash pairing keyboard/mouse on N5"

10 years agoCrash pairing keyboard/mouse on N5
Zhihai Xu [Tue, 17 Dec 2013 03:20:52 +0000 (19:20 -0800)]
Crash pairing keyboard/mouse on N5

The crash is caused by read the source string out of  bound.
Should limit the length to copy less than source string length.
should use the
MIN(SDP_DISC_ATTR_LEN(p_curr_attr->attr_len_type), SDP_MAX_ATTR_LEN);
as the length to copy.

bug:12166360
Change-Id: I871d7dcaa8bf73aa27e9088417b35b677924bebd

10 years agoMerge "read report array out of boundary for BLE HID device."
Zhihai Xu [Mon, 6 Jan 2014 19:16:08 +0000 (19:16 +0000)]
Merge "read report array out of boundary for BLE HID device."

10 years agoLE: Add service UUIDs and data to advertising data
Andre Eisenbach [Fri, 8 Nov 2013 18:23:52 +0000 (10:23 -0800)]
LE: Add service UUIDs and data to advertising data

Add support for UUIDs and custom service data in the advertising and
scan response records.

Change-Id: I6470427ad194871488cc90f3ab384b9ecf326b15

10 years agoMerge "need to increase maximum number HID report for HOGP"
Zhihai Xu [Thu, 19 Dec 2013 19:36:55 +0000 (19:36 +0000)]
Merge "need to increase maximum number HID report for HOGP"

10 years agoCan only support two HID report instance for BLE HID.
Zhihai Xu [Wed, 18 Dec 2013 22:51:52 +0000 (14:51 -0800)]
Can only support two HID report instance for BLE HID.

The follwoing code cause this problem:
BTA_HH_LE_RPT_INST_ID_MAP(s,c)=(UINT8)(((s)<<4)||(c))
The code use || instead of |, this cause we can only generate
two instance HID report 0 and 1(false and true).

bug:12213520
Change-Id: If6b7cfd9633255401aef12aafd918ee147f256b6

10 years agoneed to increase maximum number HID report for HOGP
Zhihai Xu [Thu, 19 Dec 2013 02:10:26 +0000 (18:10 -0800)]
need to increase maximum number HID report for HOGP

The Mat mouse have more than 10 report (11),
which exceed our limitation

bug:12214036
Change-Id: Id578bf7959f73dc3bd57664eccf49ab5580ec76b

10 years agoread report array out of boundary for BLE HID device.
Zhihai Xu [Wed, 18 Dec 2013 18:06:13 +0000 (10:06 -0800)]
read report array out of boundary for BLE HID device.

report array out of boundary when read HID report reference
descriptor for BLE HID device.

bug:12208657
Change-Id: Ic60fd7555045f367b4fcd606510f52f60e36995e

10 years agoBLE stack doesn't handle multiple l2cap_conn_update requests
Zhihai Xu [Wed, 18 Dec 2013 04:33:09 +0000 (20:33 -0800)]
BLE stack doesn't handle multiple l2cap_conn_update requests

we can define 4 bits as flags:
1. L2C_BLE_CONN_UPDATE_DISABLE:
if set it means disable update connection parameter. otherwise enable
2.L2C_BLE_NEW_CONN_PARAM:
if set, it means we have new connection parameter which is needed to be configured
if possible(after update done or enable).
3.L2C_BLE_UPDATE_PENDING:
if set, it means waiting for connection parameter update finished.
this flag will be cleared in btu_ble_ll_conn_param_upd_evt.
will be set when we call btsnd_hcic_ble_upd_ll_conn_params
4.L2C_BLE_NOT_DEFAULT_PARAM:
if set, it means we don't use the default connection parameter.
so when we disable update,
we need to configure default connection parameter.
with these 4 flags, we can replace all these states:
UPD_ENABLED, UPD_DISABLED, UPD_PENDING and UPD_UPDATED.
so we can cover all the corner cases which aren't handled
by original code.

bug:11450715
Change-Id: I6673d4783a8063bf9e8a213c6669800f86e67945

10 years agoMerge "RFCOMM: fix connection timeout during security setup"
Zhihai Xu [Mon, 16 Dec 2013 23:21:11 +0000 (23:21 +0000)]
Merge "RFCOMM: fix connection timeout during security setup"

10 years agoRFCOMM: fix connection timeout during security setup
kschulz [Tue, 5 Nov 2013 13:37:02 +0000 (14:37 +0100)]
RFCOMM: fix connection timeout during security setup

The RFC_T2_TIMEOUT used in rfc_mx_conf_cnf is replaced with RFCOMM_CONN_TIMEOUT,
increasing the timeout value from 20 sec to 120 sec.

Bug: 11523955
Change-Id: I992f3d20e9e4c6465850dcf1f52af0b7d39dd893

10 years agofix for btsnoop log blogging HCI socket
Kim Schulz [Mon, 23 Sep 2013 10:48:47 +0000 (12:48 +0200)]
fix for btsnoop log blogging HCI socket

Fix for bug 10887611 - btsnoop logging can block HCI socket for longer times.
- Removed the use of the same mutex as the receive queue.
- optimized the code (combined identical code pieces)
- added new function for writing to the log
- switched from using multiple write() calls to using a single writev() (to get atomicity).
patch-set 2:
- fixed review comments (overruns + warnings)
patch-set 3:
- fixed problem with non-matching flags for H4

Bug: 10887611
Change-Id: I16cc23a850093448309ec34c73d536b8571441e9

10 years agoremove space.
Zhihai Xu [Mon, 16 Dec 2013 22:22:36 +0000 (14:22 -0800)]
remove space.

bug: 10777562
Change-Id: I7560d4769dae2bc7b7796d0e7e133fa3cbd275c8