OSDN Git Service
Sharvil Nanavati [Tue, 14 Apr 2015 19:01:55 +0000 (12:01 -0700)]
Add a section in style guide: __func__ should be used over __FUNCTION__.
Change-Id: I93eb3e512b6030818b06a63f13999bd45dcfec4e
Casper Bonde [Mon, 13 Apr 2015 19:58:56 +0000 (21:58 +0200)]
L2CAP socket - fix merge errors
This fixes a few changes that was reverted by mistake,
causing uninitialized data to be used as instance data
in GAP and no buffers allocated to the L2CAP sockets.
Change-Id: I060c5faf602c1dedcc34b4acd1417949820a4da4
Mudumba Ananth [Fri, 30 Jan 2015 10:33:02 +0000 (02:33 -0800)]
BR/EDR secure connections support
As a part of BT 4.1 stack upgrade, added host support for BR/EDR
secure connections to be able to interact with controllers that
support secure connections and upgrade the SSP mechanism to use
secure connection rules.
This change checks for controller support in the extended_features
(LMP page 2) and then declares the host support (extended_features
LMP page 1) using WRITE SECURE CONNECTIONS HOST SUPPORT.
If both the sides support secure connections, the simple pairing
process utilizes the link key generated using P-256 elliptic curve
(in the controller) and both the sides will be
in a secure connection.
Bug:
19289699
Change-Id: Idb3c41f439973bea137f5a4a69468c1f55aecbd7
Satya Calloji [Fri, 30 Jan 2015 04:40:17 +0000 (20:40 -0800)]
Support numeric comparison in SMP
Enable support for numeric comparison in SMP when LE Secure connection
is supported. The change will distinguish between passkey confirmation
in case of Security grant and Passkey confirm.
Original author: Priti Aghera <paghera@broadcom.com>
Bug:
19816438
Change-Id: Id1fd072d1e567a80b020b4ba217486c3308ad39d
Anubhav Gupta [Fri, 5 Sep 2014 22:45:36 +0000 (15:45 -0700)]
Fix for AVRCP CTRL stops sending pass through command
Issue is due to BTA_AV_REMOTE_RSP_EVT is not handled in btif_av
handler. Swtich case added to handle remote response event in
btif_av_opened_handler and btif_av_started_handler.
Change-Id: I58a7bd8bfe5b07a7339d93d2b66928131836d431
Anubhav Gupta [Mon, 8 Sep 2014 10:30:22 +0000 (16:00 +0530)]
Free Avrcp Controller callbacks on Cleanup
Free AVRCP Controller callbacks on cleanup so that callbacks
are initialized properly on next initialization.
Change-Id: Ieaf4c1989a7c40c591adfb7cb47912532ceee46e
Nitin Srivastava [Mon, 22 Dec 2014 14:24:09 +0000 (19:54 +0530)]
Protect reset of out stream with mutex
Protect reset of out stream with mutex so that the access
of the same is properly synchronized in multi-threaded environment.
Change-Id: I6dd81d8c7fa219ee8d1e4d82aa1e7ec52dcecec8
Satya Calloji [Fri, 6 Mar 2015 18:38:22 +0000 (10:38 -0800)]
LE Privacy 1.2 and LE secure connections
Bug:
19816438
Original author: Chaojing Sun <cjsun@broadcom.com>
Change-Id: I5951f4d4e038f8348a62aa6d19b2111bae0b3ecc
Kim Schulz [Wed, 25 Mar 2015 09:39:40 +0000 (10:39 +0100)]
L2CAP and SDP Search API for BT profiles (2/2)
Added support for exposing L2CAP to Java such that OBEX over L2CAP
is made possible.
Added support to create SDP records as a seperate step.(as opposed to
creating a SDP record when a BluetoothSocket is created).
This allows both a RFCOMM channel and a L2CAP PSM to be included in a
SDP record. (Additionally the content of the SDP record is set by the
profile in Java, in stead of beeing hardcoded in the socket layer.)
This completes the L2CAP channel exposure to Java.
Change-Id: Iaf68a07d910145cdd33e940d73cd680f79164100
Mallikarjuna GB [Wed, 5 Nov 2014 09:48:50 +0000 (15:18 +0530)]
Update Service Availability.
- service availability is updated on CIND response
during SLC set-up.
- update current service availability on +CIEV response from
remote device.
Change-Id: I57643a6ac3aad5339d686cf941902a8bf88d99fb
Satya Calloji [Tue, 17 Mar 2015 20:12:01 +0000 (13:12 -0700)]
Avoid duplicate disconnection callbacks for fixed channel connections
Fixed channel connections are getting a disconnect callback when the
HCI command is issued and when the HCI disconnect completes. This
causes problems if the upper layer trying to reconnect at link
disconnecting state.
Triggering the disconnect callback only once solves this problem.
Original author: Chaojing Sun <cjsun@broadcom.com>
Bug:
19816438
Change-Id: Ib661c968e586975a7fc7244e2d0745f71d52e3e9
Sharvil Nanavati [Wed, 8 Apr 2015 06:22:08 +0000 (23:22 -0700)]
Add a section on assertions to the style guide.
Change-Id: I5627b5b2d6b25f0472c53b8150b14bab79b200c3
Andre Eisenbach [Wed, 8 Apr 2015 18:11:54 +0000 (18:11 +0000)]
Merge "Avoid null-pointer dereference in l2c_release_lcb()" into m-wireless-dev
Andre Eisenbach [Wed, 8 Apr 2015 17:01:56 +0000 (10:01 -0700)]
Avoid null-pointer dereference in l2c_release_lcb()
Change-Id: Id46d678e45797c4d3d3c8e024f42cfd06b1d2da2
Sharvil Nanavati [Wed, 8 Apr 2015 06:10:59 +0000 (23:10 -0700)]
Add a 'Bluedroid conventions' section to the style guide.
Also introduce a memory management section underneath 'Bluedroid
conventions' that describes common ownership semantics.
Change-Id: I9f1f148437fe21788618bcdc884b2eea5cbff141
Sharvil Nanavati [Wed, 8 Apr 2015 05:45:21 +0000 (22:45 -0700)]
Add a section to the style guide on variable declarations.
Change-Id: I0eaa435378b56953c1c228c795d0b4bf9bd8ce6c
Sharvil Nanavati [Wed, 8 Apr 2015 05:41:01 +0000 (22:41 -0700)]
Minor cleanup of formatting in style guide.
Remove trailing whitespace on a line and add inline code quotations.
Change-Id: I2f85ddf95f0dcfb0d9fdb1e6663315be15efeb62
Satya Calloji [Tue, 10 Feb 2015 01:40:52 +0000 (17:40 -0800)]
OnFound/OnLost feature changes based on Google spec v0.90
Bug:
19609671
Change-Id: If9e61b405a141cb77fb65741d08227284cb22ccd
VenkatRaghavan VijayaRaghavan [Thu, 5 Feb 2015 12:40:47 +0000 (04:40 -0800)]
Static code analysis cleanups and minor bug fixes
- Fix for initializing all the un-initialized variables
- Handling system call failure like socket,fcntl etc...
- In btpan_tap_close validate tap_if_down and close the socket.
- Invalid memset size, which could have potential memory issue
- Change -1 to INVALID_FD where appropriate
Bug:
19417758
Change-Id: Id31832f8678b2d72c80740c29b946a94e7ae0197
Satya Calloji [Thu, 5 Feb 2015 21:12:15 +0000 (13:12 -0800)]
Set dual-mode bits correctly in multi-adv instance flags
Bug:
19369962
Change-Id: I081f9db56d52e85cff50f668752322b8ab8adf42
Ian Coolidge [Fri, 3 Apr 2015 06:02:48 +0000 (06:02 +0000)]
Merge "Fix pthread_t confusion." into m-wireless-dev
Ian Coolidge [Wed, 4 Mar 2015 01:00:17 +0000 (17:00 -0800)]
Don't truncate the top 16 bits of the LE advertisement data mask.
This is stored elsewhere as unsigned 32-bit integer.
It should be stored the same way here.
Bug:
19592970
(cherry picked from commit
91f6987ecca884b0995b77fea014046b8a56385a)
Change-Id: I21dbe07e4a1095e3e8b38a56b9673a1cebb32b08
Ian Coolidge [Tue, 3 Feb 2015 04:41:11 +0000 (20:41 -0800)]
Fix pthread_t confusion.
Don't assign pthread_t to pid_t or UINT32.
Just use pthread_t throughout.
(cherry picked from commit
df3459935a4c12744a9a78812157890b60ccb77d)
Change-Id: I1ab086a547a731358003471be867cfb189f61c56
Nitin Arora [Wed, 19 Nov 2014 22:24:08 +0000 (14:24 -0800)]
Prevent slave link block removal at cancel connect
This change prevents the cancellation of direct LE connection
from removing the lcb, if there is already an LE connection up
with DUT as peripheral
Change-Id: If11759e40d19f428959b28025dde2d65b6ed7cd6
Scott James Remnant [Thu, 2 Apr 2015 22:22:29 +0000 (15:22 -0700)]
osi: add compat code for glibc
glibc doesn't declare strlcpy(), strlcat() or gettid(). Add a header
of compatibility routines that only get included when compiling on this.
Change-Id: I889ac7f1d22cf7056757890fcff0403107488d62
Kim Schulz [Mon, 30 Sep 2013 07:52:55 +0000 (09:52 +0200)]
fixed missing {} around if scope
a range of lines was supposed to be part of an if-true scope, but was not (due to missing {})
Bug:
10905622
Change-Id: I7adad37216cc78403f2d187d3404565f527d67c1
Scott James Remnant [Thu, 2 Apr 2015 22:22:27 +0000 (15:22 -0700)]
Add missing header for APPL_TRACE_EVENT
Change-Id: Iebe9d899dc73867549c40a569094ff9b5c340808
Scott James Remnant [Thu, 2 Apr 2015 22:22:25 +0000 (15:22 -0700)]
Use int64_t instead of non-standard __int64
Change-Id: I482b861364531d27ef89aab6f5617a060176de83
Scott James Remnant [Thu, 2 Apr 2015 22:22:22 +0000 (15:22 -0700)]
Make atomic functions static, as well as inline
'inline' is only a hint for the compiler, and if ignored this results
in extern functions being created. Add 'static' so that the resulting
functions are also only local to the compilation unit.
Change-Id: I947201b8170c8c73f15e7ccdd68cfc7f07cde1e9
Scott James Remnant [Thu, 2 Apr 2015 22:23:22 +0000 (15:23 -0700)]
Fix non-standard pthread mutex interactions.
pthread_mutex_t is intended to be opaque.
pthread_attr_t is intended to be opaque.
Change-Id: Ie0f5558a96f8e5fc8b2f59763acbfe5340fa81a4
Scott James Remnant [Thu, 2 Apr 2015 22:23:16 +0000 (15:23 -0700)]
btif_pan: Grab interface declarations from net/if.h only.
This is the libc interface file.
Using linux/if.h produces definition collisions on glibc.
Change-Id: I8744258ba0c4698d8f9f5b1215bb3cb1d86618fe
Scott James Remnant [Thu, 2 Apr 2015 22:22:14 +0000 (15:22 -0700)]
Fix missing #includes needed for glibc
Some standard library functions are used while relying on bionic headers
including the headers the functions were actually declared on. Add those
missing #includes so that bluetooth.default.so will compile on glibc.
Change-Id: Ied9f89ce5a05911fca63f6bfe1b8cc8196ab3b1c
Andre Eisenbach [Tue, 31 Mar 2015 22:29:40 +0000 (22:29 +0000)]
Merge "Simultanious LE Central/Peripheral operation not possible" into m-wireless-dev
kschulz [Wed, 11 Feb 2015 13:41:51 +0000 (14:41 +0100)]
BT: fix possible out of bounds read
In btm_ble_bgconn.c, function btm_update_bg_conn_list() if the last element in
"p_cb->bg_dev_list" is removed, the line:
"p_next = p_bg_dev + 1;"
will get "p_next" to point at an entry outside the bounds of the array.
There check for "p_next->in_use" may render a TRUE result depending on what
data exist in the memory pointed to by "p_next", which is unknown.
If the check passes, the sentence:
" memcpy(p_cur, p_next, sizeof(tBTM_LE_BG_CONN_DEV));"
will copy random data into the entry pointed at by "p_cur".
This can potentially corrupt the white list filling it with entries that
contain garbage and not allowing to add new valid devices to the list.
Bug:
18748601
Change-Id: I98b4be4e9f4568ea77f89146eae1e38f19fa1ee3
Kim Schulz [Tue, 24 Sep 2013 07:52:52 +0000 (09:52 +0200)]
SDP parameter checks too loose
SDP Server's client req handler currently only check that the parameter length field does not indicate the parameters to excite the packet length. Sending SDP PDUs with
- fixed sdp_server_client_req to also check for length filed
If an invalid SDP Service Search Request Packet has the continuation info length field set to SDP_CONTINUATION_LEN, but does not contain any continuation information, the SDP server should answer with SDP_INVALID_CONT_STATE.
- fixed process_service_search so the length field is correctly checked
- fixed possible access to 2 bytes of memory outside the packet boundry
Bug:
10904535
Change-Id: I41fd021327fbf4f810ee4319bc95fa0dba0b48df
Nitin Arora [Mon, 30 Mar 2015 19:22:30 +0000 (12:22 -0700)]
Include log library to make bdtool
This change adds the liblog library in the
make file for bdtool to provide for separate
compilation of the tool without causing link
errors while importing libosi
Change-Id: I87752ef7e1026080bd56fb377c73b457775f12a3
Nitin Arora [Wed, 25 Mar 2015 00:15:50 +0000 (17:15 -0700)]
Using generic format specifier for logging pointers
This change uses generic format specifier for logging the
pointers which can be 64 bit or 32 bit depending upon the
system used for compilation.
Also address of operator is used before casting a int variable
to void pointer.
Change-Id: Ie9dec408f3a5f674079f77c047d8192f65a004ca
Wei Wang [Fri, 27 Mar 2015 18:28:54 +0000 (11:28 -0700)]
Remove BLE_PERIPHERAL_ADV_NAME flag.
BLE_PERIPHERAL_ADV_NAME forces inclusion of device name
in advertise data. Since setIncludeDeviceName is already
available in advertise API to control the presence of
device name the flag should be removed.
Change-Id: I8637529b2d809bb9829783f60bd7e9889784c8b7
Andre Eisenbach [Sat, 28 Mar 2015 00:12:19 +0000 (17:12 -0700)]
Make A2DP audio HAL a shared library again
The audio HAL is loaded separately from the Bluetooth stack and thus
needs to stay separate.
Change-Id: I8d8601a6e753099f4f058dc0192b93c53be2ffb1
Andre Eisenbach [Fri, 27 Mar 2015 01:01:34 +0000 (01:01 +0000)]
Merge "Fix macro for maximum allowed HOGP devices" into m-wireless-dev
Nitin Arora [Mon, 10 Mar 2014 20:25:27 +0000 (13:25 -0700)]
Fix macro for maximum allowed HOGP devices
This checks HOGP dev handle count less than or equal to maximum
allowed HOGP devices.
Change-Id: I63e6c3bc64a8c305b739b5eade0e846315e1ad1d
Zach Johnson [Thu, 26 Mar 2015 22:07:43 +0000 (15:07 -0700)]
Add option for schedule_next_instance to force rescheduling
If we're rescheduling a periodic timer in the context of an alarm
expiration we want to force rescheduling to happen.
The alarm at the front of the list after scheduling the next
instance may be a different alarm. The old code would assume it was
already scheduled correctly, meaning nothing would ever get scheduled
after that.
Change-Id: I8accf5d004e69dfd6477ab7ec529eea42b3a88f8
Chris Manton [Thu, 26 Mar 2015 21:49:25 +0000 (14:49 -0700)]
Demote bta_av_link_role_ok error level to info
Change-Id: I4399432c9071614fc610d9de084028e48aeaf8fd
Chris Manton [Thu, 26 Mar 2015 21:08:38 +0000 (14:08 -0700)]
Remove unused file hci/include/bt_hci_lib.h
Change-Id: I60d87da42fa28dd57d50384396e30504103d1ae5
Zach Johnson [Thu, 26 Mar 2015 06:32:11 +0000 (23:32 -0700)]
Ensure alarms are called back when they expire in the past
Turns out the posix timers we're dealing with aren't well behaved.
If the timer is TIMER_ABSTIME the following is supposed to be true:
"If the specified time has already passed, the function shall succeed
and the expiration notification shall be made."
But alas, this is not the case. If the expiration time happens to be
in the past (e.g. very short timer which gets hit with a context switch
before the timer can be set) the timer decides to disarm itself. This
means no more callbacks happen, and no more alarms are processed ever.
sadness.
But thankfully, we can use timer_gettime to check the state of the timer
after timer_settime. If timer_gettime tells us the timer is disarmed
right after we armed it, we want to perform the alarm callback
ourselves.
Put all timer callbacks on the same thread (as would be the case in the
underlying timer implementation already) and used a sempahore to signal
when an alarm expires in the normal posix timer callback and also in the
timer didn't set case.
Change-Id: I39854b241369b2da52afbaaba0c01d3167a47e32
Zach Johnson [Tue, 24 Mar 2015 01:07:46 +0000 (18:07 -0700)]
Rewrite alarms to use a single posix timer instance
This means we lose the ability to send the intended alarm
as context with the posix timer, but this can be handled
gracefully enough by making sure we actually have an
expired alarm at the front of the list when the timer
callback occurs.
Change-Id: I909195b5c3155075096328c529655eeb5b7d80d0
Chris Manton [Thu, 26 Mar 2015 20:28:51 +0000 (13:28 -0700)]
Change logtag to conform to rest of module
Change-Id: I9b99111f50dc4f1c581ef96e78b36d14b51a6866
Andre Eisenbach [Thu, 26 Mar 2015 21:14:40 +0000 (14:14 -0700)]
Move unused include file out of hci_audio.h
This fixes include path issues for libbt.
Change-Id: I416f563c0056216e86898d8e9cc111b600c73ce0
Mudumba Ananth [Wed, 25 Mar 2015 12:20:02 +0000 (05:20 -0700)]
Resolved hardware error observed during SCO Connection setup
Hardware error was caused due to a faulty HCI command formed in the
process of vendor specific pre-SCO setup in the stack(set_audio_state)
Fixed the above problem and also added back the vendor (interface)
mapping for the set_audio_state functionality to facilitate the
sending of the pre-SCO vendor specific commands.
Made common vendor library audio setting by moving to hci subsystem.
General cleanup around this functionality.
Bug:
19923226
Change-Id: I4a743f6725459f360bd2a90e0a46f08fcca2292d
Satya Calloji [Tue, 3 Feb 2015 22:41:49 +0000 (14:41 -0800)]
Random address does not get written properly
The random address not getting written with correct
instance ID, as per Google spec.
Bug:
19370739
Change-Id: I7e5fc8d274bad5f127bd791469a46e2f257eaddd
Steve Gu [Thu, 6 Nov 2014 19:16:41 +0000 (11:16 -0800)]
Builds server with service, characteristic, and descriptor UUIDs. Then starts and stops the server.
Change-Id: I22e269010c5e4d96d9562155e03903c3ea957c97
Steve Gu [Wed, 29 Oct 2014 01:38:30 +0000 (18:38 -0700)]
Adds tests for BLE advertising and BLE server register. Also fixes random seed.
Change-Id: Ic15360baefb133b761ff077d27946c0ea7fa3edb
Steve Gu [Mon, 27 Oct 2014 19:59:02 +0000 (12:59 -0700)]
Adds BLE tests to bdtest.
Change-Id: Idcdc01339f0e8a14b6fedf27545566e7efdf53c2
Andre Eisenbach [Thu, 26 Mar 2015 00:04:14 +0000 (00:04 +0000)]
Merge "Add section on booleans and bitfields to the style guide" into m-wireless-dev
Zach Johnson [Tue, 24 Mar 2015 17:05:15 +0000 (10:05 -0700)]
Add section on booleans and bitfields to the style guide
Change-Id: I75df8b638d71bfe2ba1dc98d3eb148d8a61f5b9c
Nitin Arora [Fri, 20 Mar 2015 00:00:35 +0000 (17:00 -0700)]
Rectify allocation of GATT control block
This change ensures that a valid value is returned while
requesting available control block or allocating memory
for a new control block for saving GATT discovery handles.
The bug if not fixed causes memory corruption and thus
modifying some callback handles.
Change-Id: I148ee82d2ea9fe77bebd34fd345b4fb6a6eee3cd
Chris Manton [Wed, 25 Mar 2015 18:01:11 +0000 (18:01 +0000)]
Revert "Resolved hardware error observed during SCO Connection setup"
This reverts commit
4d8ac4ff015ff87c4e985ac0d9a5f3c2a6b0d9fa.
Change-Id: Ie1433c82014b6ddce78c5363100ab109ae0fecde
Mudumba Ananth [Wed, 25 Mar 2015 12:20:02 +0000 (05:20 -0700)]
Resolved hardware error observed during SCO Connection setup
Hardware error was caused due to a faulty HCI command formed in the
process of vendor specific pre-SCO setup in the stack(set_audio_state)
Fixed the above problem and also added back the vendor (interface)
mapping for the set_audio_state functionality to facilitate the
sending of the pre-SCO vendor specific commands.
Bug:
19923226
Change-Id: I03c6a1c048c21549b7326a783b70588686283eb3
Kim Schulz [Wed, 25 Mar 2015 08:08:01 +0000 (09:08 +0100)]
Simultanious LE Central/Peripheral operation not possible
Bug:
18925497
Change-Id: I5a20e38ffebce4b251e4728944fce73db50e18f8
Nitin Arora [Wed, 22 Jan 2014 18:33:26 +0000 (10:33 -0800)]
Allow dual-mode devices to be processed by BR/EDR scan
This change lets a Dual mode device which is already processed
as LE device for the current inquiry, to be also processed as
a BR/EDR device in case an extended inquiry result is recvd.
This helps setting the cod correctly.
Change-Id: I0a0c598ebdafe2b6153015c3cda5dde8f7a15873
Zach Johnson [Mon, 23 Mar 2015 20:59:10 +0000 (13:59 -0700)]
Rewrite alarm to avoid drift in the periodic version
Also improve names of some functions.
Change-Id: Ia5aeebc8226ce5c36abdd372ea4de5195314e273
Andre Eisenbach [Tue, 24 Mar 2015 01:11:01 +0000 (01:11 +0000)]
Merge "Remove unused remote_name_* variables" into m-wireless-dev
Andre Eisenbach [Tue, 24 Mar 2015 01:07:54 +0000 (18:07 -0700)]
Remove unused remote_name_* variables
Change-Id: Ib0db95646564439a9458542db9b1891ea818c5d7
Andre Eisenbach [Tue, 24 Mar 2015 00:44:36 +0000 (00:44 +0000)]
Merge "Style guide: Use C99 style flexible arrays" into m-wireless-dev
Andre Eisenbach [Thu, 19 Mar 2015 22:38:34 +0000 (15:38 -0700)]
Style guide: Use C99 style flexible arrays
Change-Id: I012d9f4195833e2c6c9a5c953e71b7a7b5847673
Nitin Arora [Fri, 26 Sep 2014 21:05:24 +0000 (14:05 -0700)]
Delete 0 index LE scan filter at inquiry cancel
This patch ensures that the 0 index filter is deleted when the
inquiry is cancelled due to initiation of a direct connection
from inquiry or due to return from the Settings menu screen
Change-Id: I281c6ace15b17fb7e413c42d36e016b8f82d2ace
Nitin Arora [Sat, 22 Mar 2014 01:28:04 +0000 (18:28 -0700)]
Ignore LE security request if BR/EDR pairing is ongoing
This change checks the btm state to see if a BR/EDR pairing
is ongoing when a security request is received from a remote
device.
Change-Id: Ia3f9c9db6c1aed944857174528c14ed66f184152
Andre Eisenbach [Mon, 23 Mar 2015 20:26:23 +0000 (20:26 +0000)]
Merge "Extend Bluetooth startup timeout from 3s to 8s" into m-wireless-dev
Andre Eisenbach [Mon, 23 Mar 2015 20:21:42 +0000 (20:21 +0000)]
Merge "Reset LE connecting flag on disconnect only if BDA matches" into m-wireless-dev
Andre Eisenbach [Mon, 23 Mar 2015 20:12:53 +0000 (20:12 +0000)]
Merge "Remove ACL connection reference counting" into m-wireless-dev
Nitin Arora [Fri, 6 Jun 2014 22:21:25 +0000 (15:21 -0700)]
Reset LE connecting flag on disconnect only if BDA matches
This change will make sure that the flag representing that BLE device
is connecting is made false only if a disconnection of the same
LE device is received, whose connection is in progress. This is ensured
by matching the bda of the disconnecting device and the LE device which
is in connecting state. This is to prevent a BR/EDR disconnection from
cancelling the connection timeout of an LE device
Change-Id: Ia5b47681479dc0be217cdfc3e15af9ca5323575c
Nitin Arora [Tue, 18 Feb 2014 23:28:59 +0000 (15:28 -0800)]
Send GATT discovery complete only if discovery is active
This change forces a discovery complete event at gatt close
event only if service discovery is in progress and not when
inquiry is on going. Otherwise, a false discovery complete
is sent to the host, which cause a never ending inquiry.
Change-Id: I7ca207382b04ed233c149ca50040dab993067870
Andre Eisenbach [Mon, 23 Mar 2015 16:46:08 +0000 (09:46 -0700)]
Extend Bluetooth startup timeout from 3s to 8s
Change-Id: I0e8af541bf9c5837d92b5ccc047b3dd9d3765767
Andre Eisenbach [Thu, 19 Mar 2015 22:15:05 +0000 (15:15 -0700)]
Remove ACL connection reference counting
In addition to maintaining ACL link control blocks, which carry a
"in_use" flag, ACL links are reference counted in the num_acl links
variable.
The reference counting is thrown off when a SM connection initiated for
pairing is followed up by a GATT connection after pairing completes. The
2nd connection is counted against num_acl, even so other parts of the
code recognize the connection as a duplicate ACL connection to the same
BDA.
This patch removes the unecessary reference counting and relies on the
control block status instead, which is correctly maintained.
Bug:
19019189
Change-Id: I0a5f4d279fc634689d0e8c0ef4ad639d0ce5d687
Chris Manton [Thu, 12 Mar 2015 16:22:48 +0000 (09:22 -0700)]
Demote, cleanup and extend observed logging
Sharvil Nanavati [Thu, 12 Mar 2015 18:53:44 +0000 (11:53 -0700)]
Code formatting and language feature additions to the style guide.
Sharvil Nanavati [Thu, 12 Mar 2015 22:55:21 +0000 (15:55 -0700)]
Use fully qualified path for btcore includes.
Sharvil Nanavati [Thu, 12 Mar 2015 22:42:50 +0000 (15:42 -0700)]
Use fully qualified path for OSI includes.
Sharvil Nanavati [Wed, 11 Mar 2015 04:14:40 +0000 (21:14 -0700)]
Start putting together a style guide for bluedroid.
It's far from complete but provides a starting point for codifying
best practices and guidelines for developing in this codebase.
Sharvil Nanavati [Thu, 12 Mar 2015 06:50:42 +0000 (23:50 -0700)]
Atomically update config files.
There's a race condition on shutdown between Java and native code.
A stack shutdown is issued from Java and in the meantime the
calling thread calls System.exit(0). If that line is reached before
the native code has had a chance to shut down cleanly, the system
could be stuck in a bad state.
This change uses rename(2) to replace an existing config file
atomically instead of truncating, writing, and then flushing. In
case of a crash or the race condition above, the config file will
still be valid.
There's an implementation gotcha. The config saving code uses ".new"
as a suffix on the original filename to write to a temporary file.
If a file by that name already exists, it will be overwritten.
Zach Johnson [Wed, 11 Mar 2015 08:55:27 +0000 (01:55 -0700)]
Add ability to set periodic alarms
Adds alarm_set_periodic so the alarm code can have more
contextual information when rescheduling alarms.
Problem: A2DP would stream for a few seconds and then
stop working.
Cause: The Java garbage collector. Bluedroid reaches out
to javaland to acquire and release the wake lock. Alarm was
always reaching out to get the wake lock when it scheduled a
short timeout. If GC kicked in during that call out to make
sure we have the wake lock, it could take more than 100ms to
get back us. That would screw over the alarm implementation
particularly for small 20ms timers.
So now if the wake lock was already acquired, we don't try to
reacquire it.
Cool. But we still have thrashing. Why? Because the alarm code
doesn't know the alarm is actually being used in a periodic way.
Here's what used to happen:
alarm expires
alarm is removed
reschedule
alarm callback is called
alarm callback sets the alarm again
alarm is added
reschedule
The problem is the first reschedule will get rid of the wake lock
if the next alarm is too far out or doesn't exist, meaning the next
reschedule needs to get the wake lock again.
With the extra periodicity information we can eliminate the
unnecessary intermediate reschedule, meaning no thrashing on the
wake lock. yay!
Chris Manton [Fri, 6 Mar 2015 22:41:32 +0000 (14:41 -0800)]
Allocate a2d list properly
Some other minor cosmetic improvements
Zach Johnson [Thu, 5 Mar 2015 23:24:40 +0000 (15:24 -0800)]
Remove dead code checks for BLE support
On some build configurations (looking at you, hammerhead) the controller
hasn't come up before BTU init stuff happens.
These BLE support checks were triggering the assert that ensures the
controller module has loaded when you try to access it.
However, these BLE support checks were dead code because the outcome was
the same regardless in either case (returning from the function). Removed.
It's a good thing these asserts were in place, because if these checks
were actually important to the correctness of the code we'd be reading
bad state (BLE supported would always be false during this stage) and
we would have no idea. Yay asserts!
Zach Johnson [Wed, 4 Mar 2015 22:47:00 +0000 (14:47 -0800)]
Rejig hci upwards dispatch
Split events and acl data in hci dispatch, and dispatch events by event code
Future code will now be able to dynamically tie into hci events, instead
of relying on a hard coded routing.
Zach Johnson [Wed, 4 Mar 2015 22:06:13 +0000 (14:06 -0800)]
Reinstate btsnoop last log saving
Waited for the merge to complete before reworking
the feature into the stack.
VenkatRaghavan VijayaRaghavan [Fri, 6 Feb 2015 06:20:39 +0000 (22:20 -0800)]
Prevent Memory overbound and initialize variables
1. Fix for initializing all the un-initialized variables
2. Potential strncpy overbound
Bug:
19417758
VenkatRaghavan VijayaRaghavan [Tue, 10 Feb 2015 15:35:10 +0000 (07:35 -0800)]
Resolved trace level issue for AVDTP
Root Cause: Trace messages are getting logged
When setting TRC_AVDT=5 the trace level doesn't take effect. Due to
multiple initialization points the bt_stack.conf value was overwritten
Bug:
19417758
Zach Johnson [Mon, 2 Mar 2015 22:42:02 +0000 (14:42 -0800)]
Move list function comments to the header file
Zach Johnson [Mon, 2 Mar 2015 22:28:54 +0000 (14:28 -0800)]
Move hashmap function comments to the header file
Sharvil Nanavati [Sun, 28 Dec 2014 10:25:02 +0000 (02:25 -0800)]
Remove more GKI code.
This change removes all remaining GKI task remnants as well as
a few timer and buffer bits.
Sharvil Nanavati [Mon, 2 Mar 2015 23:34:21 +0000 (15:34 -0800)]
Remove dependency on GKI tasks from BTIF media task.
The previous code started a thread and posted a long-running function
to the thread's event loop. In essence, it created a thread and ran
a custom thread main that did its own event handling using GKI_wait.
The new code doesn't use GKI_wait or GKI_send_event at all. Instead,
it uses thread_post and the thread's reactor to enqueue and dispatch
events.
Sharvil Nanavati [Mon, 2 Mar 2015 23:02:39 +0000 (15:02 -0800)]
Don't call GKI_send_event on BTU task since it's not a GKI task anymore.
Sharvil Nanavati [Mon, 2 Mar 2015 22:56:24 +0000 (14:56 -0800)]
Remove GKI timers
June R. Tate-Gans [Thu, 9 Oct 2014 21:16:25 +0000 (14:16 -0700)]
Adding some documentation for the power management flow.
Zach Johnson [Wed, 28 Jan 2015 19:16:15 +0000 (11:16 -0800)]
Add sniff changed log statement on the mode changed event
This will ensure we log accordingly when the other end
decides to put the connection into sniff mode.
Sharvil Nanavati [Wed, 21 Jan 2015 07:12:31 +0000 (23:12 -0800)]
Collapse BNEP #defines that don't need to be configurable.
In some instances, defining these macros to FALSE would result in
broken runtime behavior (e.g. UUID fields containing uninitialized
values). This change collapses the following defines:
BNEP_SUPPORTS_PROT_FILTERS
BNEP_SUPPORTS_MULTI_FILTERS
BNEP_SUPPORTS_DEBUG_DUMP
BNEP_SUPPORTS_ALL_UUID_LENGTHS
Sharvil Nanavati [Mon, 19 Jan 2015 18:03:08 +0000 (10:03 -0800)]
Add a new l2cap_client class.
The code to negotiate an L2CAP connection is currently scattered
and duplicated throughout the codebase. Each profile that uses
L2CAP has its own explicit or implicit state machine to go establish
a connection and go through the handshake. This class is intended
to consolidate that duplicated code and provide a usable API for
L2CAP client connections.
Sharvil Nanavati [Sun, 18 Jan 2015 06:12:38 +0000 (22:12 -0800)]
Add connection-specific function L2CA_SetConnectionCallbacks.
This function allows a client to specify callback routines per-
connection instead of per-PSM.
Chris Manton [Thu, 8 Jan 2015 18:47:59 +0000 (10:47 -0800)]
property api unification, naming and testing
Sharvil Nanavati [Mon, 15 Dec 2014 09:37:59 +0000 (01:37 -0800)]
Add a reference counted buffer implementation.
This implementation introduces the notion of a 'slice'. A slice is
simply a sub-buffer of the original buffer. Slices refer to their
parent buffer so no memory is copied and slice creation becomes an
O(1) operation. Although I'm introducing a new concept, in practice,
a slice is indistinguishable from a buffer (they share a type and
all operations).
I expect slices to be used heavily during packet construction. For
example, an RFCOMM implementation would request a buffer from the
L2CAP layer (which may in turn request a buffer from the HCI layer).
The L2CAP layer would reserve some space in the buffer for its header
and return a slice to the RFCOMM layer.