- 14 Jun, 2016 1 commit
-
-
Jakub Pawlowski authored
GATT Service is contained between start and end handle. If characteristic definition is at end handle, and it's value definition is after end handle, it will not be properly discovered. That's because we use value_handle instead of attribute_handle to identify characteristics. As a workaround, increase service boundary if value is defined after it's definition. Bug: 29253825 Change-Id: Ib145aea4f5cf38a1fbb977c301136e16f8f900f7
-
- 18 May, 2016 1 commit
-
-
Pavlin Radoslavov authored
Added a log message inside l2c_link_hci_disc_comp() to help capture a NULL pointer p_lcb->p_fixed_ccbs[xx] that triggers SIGSEGV crash. Also, updated the typedef of bdstr_t and moved it to file "btcore/include/bdaddr.h" Bug: 28765514 Change-Id: Iacd9376cfb9e18b58e18865581da8edad9f68821
-
- 25 Mar, 2016 1 commit
-
-
Jakub Pawlowski authored
Change-Id: I91a19b2cfbc96d7567e0e0914058619ea364c1d4
-
- 22 Mar, 2016 2 commits
-
-
Jakub Pawlowski authored
Bug: 27778668 Change-Id: Id7454450c1ce2164001a1f9ca0b91f18d84e3fd6
-
Jakub Pawlowski authored
This patch changes how GATTC is structured. Up till now, it contained tBTA_GATTC_CACHE and tBTA_GATTC_CACHE_ATTR. Those structures were so ugly, someone hide them inside internal header, to make sure noone would ever access them from outside GATTC. They are now replaced with: tBTA_GATTC_SERVICE, tBTA_GATTC_CHARACTERISTIC, tBTA_GATTC_DESCRIPTOR and tBTA_GATTC_INCLUDED_SVC. Those looks much better, and were made globally avaliable. Thanks to way they're build, we no longer need set of access methods, which were also very ugly: BTA_GATTC_GetFirstChar BTA_GATTC_GetNextChar BTA_GATTC_GetFirstIncludedService etc. This patch breaks HID, DO NOT SUBMIT without HID refactor. Bug: 27455533 Change-Id: Ic42cfff175e0cc1a0d8e1a1216e2b4b756cbf77d
-
- 09 Mar, 2016 5 commits
-
-
Jakub Pawlowski authored
Now that the instance id is equal to handle, we no longer need this mapping function. Bug: 27455533 Change-Id: I6760f8fc81460df8520d4ebf1899ed256ce5ad1e
-
Jakub Pawlowski authored
Currently we generate an id for each GATT attribute. Those ids are used to differentiate between attributes that have the same UUID. We need to get rid of those ids because it won't work with partial GATT database updates due to "service change" notifications. Instead, attribute handles, which are unique across the whole GATT database will be used. This is first patch in series to achieve that. It gets rid of id generation, and just assigns handle in place of ids inside of gatt cache. Upcoming patches will change the GATT cache API and eventually get rid of "id" completly. Bug: 27455533 Change-Id: I74c10872ecc223329b8ac7fef4085963bf272624
-
Jakub Pawlowski authored
Currently when storing GATT cache into file, we save it piece after piece, max 10 elements at once. This is not necessary, we have enough space to just save all at once. Also the logic doesn't need to be so complicated - no need to state machine for such simple task. Bug: 27455533 Change-Id: I82923dbedfb317835e45e13e0ea28151eb524d37
-
Jakub Pawlowski authored
Bug: 27455533 Change-Id: Ie5661577320810468dd635022027a1e1a2f70a3e
-
Jakub Pawlowski authored
Bug: 27455533 Change-Id: I653b563d3b3c233ffe31b0a35d396a66db363459
-
- 18 Feb, 2016 7 commits
-
-
Pavlin Radoslavov authored
* Remove unused functions: -Wno-unused-function * Fix logical operations that are missing parentheses: -Wno-logical-not-parentheses, -Wno-parentheses * Add missing braces in initializers: -Wno-missing-braces * Remove unused variables: -Wno-unused-variable * Fix printf()-like formatting issues: -Wno-format * Avoid using unitialized variables: -Wno-maybe-uninitialized, -Wno-uninitialized * Fix a bug inside bta_gattc_get_gatt_db_impl() when the processed GATT DB attribute type is unknown. * Fix warnings about missing field initializers: -Wno-missing-field-initializers * Re-implement macro COMPILE_ASSERT(COND) to fix a compilation warning: -Wno-non-literal-null-conversion * Fix sign mismatch comparison warnings: -Wno-sign-compare * Fix warnings related to enum conversion: -Wno-enum-conversion * Fix warnings related to incompatible pointer types: -Wno-incompatible-pointer-types * Fix warnings related to enum conversion: -Wno-enum-con...
-
Jakub Pawlowski authored
This typo was introduced in commit 48db2d25 3years ago. This cause unnecesary purge of cache and rediscovery even though discovery was successfull. Change-Id: I828e148ad489af1e231d33d7807bbe0e46f445c5
-
Jakub Pawlowski authored
Change-Id: Iaf0280853278a4f28dde5b952b646096cfb12d97
-
Pavlin Radoslavov authored
Removed explicit checks for NULL pointer returns after calls to osi_calloc() and osi_malloc(), because those are not needed. If the memory allocation fails, osi_calloc() and osi_malloc() will trigger an assert. Bug: 27048759 Change-Id: I2791eb2f69c08f991f8fcdef10e101a41568cd95
-
Jakub Pawlowski authored
Fix possible memory leak when allocating reused server cache control block. Change-Id: I3aab727e4f60e55530f49b0b05ccf2c891c72760
-
Pavlin Radoslavov authored
Removed the alternative buffer allocation osi_getbuf() / osi_freebuf() and use instead osi_malloc() / osi_free(). Correspondingly, replaced usage of osi_freebuf_and_reset() with osi_free_and_reset(). Bug: 24914560 Change-Id: I7a9599ba7fa900321f087da684428133eb0ddd6b
-
Jakub Pawlowski authored
Change-Id: I60674c47246d8fe2094fe78ce31b752fa2acb89e
-
- 06 Feb, 2016 1 commit
-
-
Jakub Pawlowski authored
Change-Id: I624aeaa0c562b5c7404ad37411ad209beac3a5e1
-
- 04 Feb, 2016 2 commits
-
-
Pavlin Radoslavov authored
* Allow to call osi_freebuf(ptr) on NULL pointers. This simplifies the code: a notable number of "if (foo != NULL)" checks are removed. * Add new function osi_free_and_reset(p_ptr) that frees the buffer, and explicitly resets the pointer to NULL. This prevents unintended usage of free memory. * Add corresponding function osi_freebuf_and_reset(p_ptr) * Minor cleanup around usages of osi_free() and osi_freebuf() Also: * Removed unused function btif_gattc_cleanup() * Replaced usage of the following functions with osi_freebuf_and_reset() - mca_free_buf() - utl_freebuf() - btif_hl_free_buf() * Replaced usage of rc_supported_event_free() with osi_freebuf() * Replaced usage of btif_hl_get_buf() with osi_getbuf() * Eliminate some of the osi_get_buf_size() calls Bug: 22948224 Change-Id: Ife860658b26274da6f228d7353cb0f1531587337
-
Jakub Pawlowski authored
Change-Id: Ie02dd72a2d4a423ab532ec84a4d588ab83f3e22b
-
- 29 Jan, 2016 5 commits
-
-
Andre Eisenbach authored
Change-Id: I41e95f880bd37647278ad9dba4e12c2b54db273b
-
Jakub Pawlowski authored
Currently getting GATT database from HAL requires multiple calls and iterating over each element. This is long, unnecessary complicated process, error prone process. This patch adds new method, get_gatt_db that can be used to grab whole GATT database for remote device just in one call. Change-Id: Ib5d88fbc28d09d5c191e7c0152ca61d6a34f7a81
-
Pavlin Radoslavov authored
The revert includes a compilation fix as well (missing include of a header file). This reverts commit 3a4082d7. Change-Id: I5bb1f468d2c64839037afe5ed2d3ed5d1b21dca2
-
Ian Pedowitz authored
This reverts commit 12091a32. (cherry picked from commit 3a4082d7) Change-Id: I2bc9969a7bd5d434b68ca05a4899a7f52ffb4f3e
-
Ian Pedowitz authored
This reverts commit 12091a32. Change-Id: I01deaa5024bfef1782887fd8f8137f83916d8be0
-
- 28 Jan, 2016 2 commits
-
-
Nitin Arora authored
1. Prevent GATT operations to proceed if queue is not empty This change returns a FALSE from GATT enqueue operation, in case there is already a GATT command enqueued. This simple change will a. Prevent incorrect memory freeing of the currently queued command. b. Prevent incorrect dequeing of the ongoing command and enqueing another command which will never be executed. c. Double free of memory causing segmentation fault 2. Prevent performing pending operations when link is down This change prevents performing the execution of pending operations when the link is disconnected. The pending operation in that case is bound to fail thus freeing the memory pointed to by the p_q_cmd which is cleaned up again by the discovery completion routine and thus causing double free. Bug:24178843 Change-Id: Ief2756f289a7db73d251ef7e247774dd3f7fc413
-
Subramanian Srinivasan authored
Prevents the crash which happens when device is disconnected during service discovery and the services list is not yet properly allocated memory and populated. This change frees up the services list after discovery complete only when it is not null. Change-Id: I0ced14d2ee133a332fa2fd7c456267438813a600
-
- 04 Dec, 2015 1 commit
-
-
Jakub Pawlowski authored
Right now sdp_conn_id and p_sdp_db are stored in static global bta_gattc_cb between call to bta_gattc_sdp_service_disc and bta_gattc_sdp_callback. If multiple instances of SDP discovery are running simultaneously, they override this field, and free same memory multiple times. This patch fixes that by making sure sdp_conn_id and p_sdp_db are unique for each SDP discovery. Bug: 25801255 Change-Id: I8ec52229e906e6b8748db7504f77e1f4d7006fbe
-
- 19 Oct, 2015 4 commits
-
-
Pavlin Radoslavov authored
* Moved the following GKI buffer allocation functions to OSI: - GKI_getbuf() -> osi_getbuf() - GKI_freebuf() -> osi_freebuf() - GKI_get_buf_size() -> osi_get_buf_size() For now we need the osi_getbuf() / osi_freebuf() allocation wrapper, because we need to be able to call osi_get_buf_size() on the allocated buffer. In the future those should be replaced with osi_malloc() / osi_free(). Currently, the osi_malloc() buffer size internal allocation tracker does not always track the size, hence we need the osi_getbuf() wrapper. * Replaced GKI_MAX_BUF_SIZE with BT_DEFAULT_BUFFER_SIZE * Added new file include/bt_common.h that can be usee to include few files that should be included alost everywhere (e.g. bt_target.h" NOTE: This file might be removed in the future and we should include everywhere the right set of header files. * Removed some of the GKI-related references * Removed file include/gki_target.h Change-Id: Ie87830e731...
-
Pavlin Radoslavov authored
* Added new functions to OSI: - fixed_queue_init() - fixed_queue_length() - fixed_queue_try_remove_from_queue() - fixed_queue_try_peek_last() * Renamed fixed_queue_try_peek() to fixed_queue_try_peek_first() * Replaced usage of GKI queue functions with OSI fixed_queue functions: - GKI_init_q() -> fixed_queue_new(SIZE_MAX) NOTE: unlike GKI_init_q(), fixed_queue_new() allocates memory / state that needs to be released by calling fixed_queue_free() - GKI_enqueue() -> fixed_queue_enqueue() - GKI_dequeue() -> fixed_queue_try_dequeue() NOTE: fixed_queue_try_dequeue() is non-blocking - GKI_queue_length() -> fixed_queue_length() - GKI_queue_is_empty() -> fixed_queue_is_empty() - GKI_getfirst() -> fixed_queue_try_peek_first() - GKI_getlast() -> fixed_queue_try_peek_last() - GKI_remove_from_queue() -> fixed_queue_try_remove_from_queue() - Queue elements iteration. In the fixed_queue implementation we have to use the underlying list_t mechanism to iterate over the elements. OLD: p = GKI_getfirst(queue); ... while ((p = GKI_getnext(p) != NULL) { ... } NEW: list_t *list = fixed_queue_get_list(queue); for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node)) { p = list_node(node); } * Remove initialization of the GKI module, because it is not needed anymore * Removed unused files in GKI: gki/common/gki_common.h gki/ulinux/gki_int.h gki/ulinux/gki_ulinux.c Change-Id: I3ff9464db75252d6faf7476a9ca67c88e535c51c
-
Pavlin Radoslavov authored
* Replace usage of function GKI_getpoolbuf() with GKI_getbuf() * Remove usage of function GKI_poolutilization() * Remove usage of function GKI_poolfreecount() Change-Id: Ide938192b878bbfb4912642c903fce548f2b5368
-
Pavlin Radoslavov authored
If there are errors when processing GATT related events (e.g., configuring the MTU), don't use recursive calls into bta_gattc_sm_execute(), because it breaks the free-ing of some of the memory. Bug: 23756301 Change-Id: I3c685170e868ffbf4e488d2bb5a31904e3f7b39d
-
- 06 Oct, 2015 1 commit
-
-
Pavlin Radoslavov authored
* Moved the following GKI buffer allocation functions to OSI: - GKI_getbuf() -> osi_getbuf() - GKI_freebuf() -> osi_freebuf() - GKI_get_buf_size() -> osi_get_buf_size() For now we need the osi_getbuf() / osi_freebuf() allocation wrapper, because we need to be able to call osi_get_buf_size() on the allocated buffer. In the future those should be replaced with osi_malloc() / osi_free(). Currently, the osi_malloc() buffer size internal allocation tracker does not always track the size, hence we need the osi_getbuf() wrapper. * Replaced GKI_MAX_BUF_SIZE with BT_DEFAULT_BUFFER_SIZE * Added new file include/bt_common.h that can be usee to include few files that should be included alost everywhere (e.g. bt_target.h" NOTE: This file might be removed in the future and we should include everywhere the right set of header files. * Removed some of the GKI-related references * Removed file include/gki_target.h Change-Id: Ie87830e731...
-
- 05 Oct, 2015 1 commit
-
-
Pavlin Radoslavov authored
* Added new functions to OSI: - fixed_queue_init() - fixed_queue_length() - fixed_queue_try_remove_from_queue() - fixed_queue_try_peek_last() * Renamed fixed_queue_try_peek() to fixed_queue_try_peek_first() * Replaced usage of GKI queue functions with OSI fixed_queue functions: - GKI_init_q() -> fixed_queue_new(SIZE_MAX) NOTE: unlike GKI_init_q(), fixed_queue_new() allocates memory / state that needs to be released by calling fixed_queue_free() - GKI_enqueue() -> fixed_queue_enqueue() - GKI_dequeue() -> fixed_queue_try_dequeue() NOTE: fixed_queue_try_dequeue() is non-blocking - GKI_queue_length() -> fixed_queue_length() - GKI_queue_is_empty() -> fixed_queue_is_empty() - GKI_getfirst() -> fixed_queue_try_peek_first() - GKI_getlast() -> fixed_queue_try_peek_last() - GKI_remove_from_queue() -> fixed_queue_try_remove_from_queue() - Queue elements iteration. In the fixed_queue implementation we have to use the underlying list_t mechanism to iterate over the elements. OLD: p = GKI_getfirst(queue); ... while ((p = GKI_getnext(p) != NULL) { ... } NEW: list_t *list = fixed_queue_get_list(queue); for (const list_node_t *node = list_begin(list); node != list_end(list); node = list_next(node)) { p = list_node(node); } * Remove initialization of the GKI module, because it is not needed anymore * Removed unused files in GKI: gki/common/gki_common.h gki/ulinux/gki_int.h gki/ulinux/gki_ulinux.c Change-Id: I3ff9464db75252d6faf7476a9ca67c88e535c51c
-
- 22 Sep, 2015 1 commit
-
-
Pavlin Radoslavov authored
* Replace usage of function GKI_getpoolbuf() with GKI_getbuf() * Remove usage of function GKI_poolutilization() * Remove usage of function GKI_poolfreecount() Change-Id: Ide938192b878bbfb4912642c903fce548f2b5368
-
- 08 Sep, 2015 1 commit
-
-
Pavlin Radoslavov authored
If there are errors when processing GATT related events (e.g., configuring the MTU), don't use recursive calls into bta_gattc_sm_execute(), because it breaks the free-ing of some of the memory. Bug: 23756301 Change-Id: I3c685170e868ffbf4e488d2bb5a31904e3f7b39d
-
- 06 Aug, 2015 1 commit
-
-
Marie Janssen authored
Fix the order of includes across a bunch of files, and declare LOG_TAG at the top of every file in which it is used. Consistently use bt_ as a LOG_TAG prefix. Fix issues with LOG macro usage. Remove unused includes and double-includes (when in related .h) Add includes as necessary to compile cleanly (problems surfaced by reordering includes) Change-Id: Ic55520c8302b06bbc1942c10c448b20844669da6
-
- 16 Jul, 2015 1 commit
-
-
Arman Uguray authored
This patch fixes an issue that is reproducible in highly noisy environments (massive deployment of BLE beacons), through repeated connect/disconnect attempts on a remote peripheral while scanning for beacons in the background. The state machine in bta/gatt has a special control flow for handling disconnect requests during discovery, which in this case failed to resolve the original request by issuing an HCI_Disconnect command. This is now fixed by always explicitly triggering the connection close sequence once the discovery state has been cleaned up. This patch also includes a fix for a crash that occurred as a side-effect of the scenario described above. Bug: 22350508 Change-Id: Ie9cbd3c8f54239b142bfb8dde80d9581ae70ed43
-
- 08 Jul, 2015 1 commit
-
-
Marie Janssen authored
Fixes build breakages related to r.android.com/156982 Change-Id: Ib1143c41fe05a17c296226998afdb41a8cb6294a
-
- 07 Jul, 2015 1 commit
-
-
Marie Janssen authored
Fixes build breakages related to r.android.com/156982 Change-Id: Ib1143c41fe05a17c296226998afdb41a8cb6294a
-