- Mar 16, 2015
-
-
Chris Manton authored
-
Sharvil Nanavati authored
-
Sharvil Nanavati authored
-
Sharvil Nanavati authored
-
Sharvil Nanavati authored
It's far from complete but provides a starting point for codifying best practices and guidelines for developing in this codebase.
-
Sharvil Nanavati authored
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 authored
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 authored
Some other minor cosmetic improvements
-
Zach Johnson authored
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 authored
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 authored
Waited for the merge to complete before reworking the feature into the stack.
-
VenkatRaghavan VijayaRaghavan authored
1. Fix for initializing all the un-initialized variables 2. Potential strncpy overbound Bug: 19417758
-
VenkatRaghavan VijayaRaghavan authored
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 authored
-
Zach Johnson authored
-
Sharvil Nanavati authored
This change removes all remaining GKI task remnants as well as a few timer and buffer bits.
-
Sharvil Nanavati authored
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 authored
-
Sharvil Nanavati authored
-
June R. Tate-Gans authored
-
Zach Johnson authored
This will ensure we log accordingly when the other end decides to put the connection into sniff mode.
-
Sharvil Nanavati authored
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 authored
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 authored
This function allows a client to specify callback routines per- connection instead of per-PSM.
-
Chris Manton authored
-
Sharvil Nanavati authored
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.
-
Sharvil Nanavati authored
Start reviewing in include/bt_target.h.
-
Sharvil Nanavati authored
Both of these features are always available in bluedroid.
-
Sharvil Nanavati authored
-
Sharvil Nanavati authored
The WC_* macros only expand to something meaningful when _DEBUG is also defined. However, on enabling _DEBUG, bluedroid fails to build because the wc_assert function is not defined anywhere. We can get what I imagine is the equivalent behavior by switching over to the standard C assert macro.
-
Zach Johnson authored
If profile connection requests come in too quickly for us to handle, clients can effectively DoS the bluetooth stack. We used to see out of buffer errors because the requests were batched up and sitting on buffers the rest of the stack needed. With the switch to pure allocation we didn't see that specific problem anymore, but we were still running into the sanity assert. Bug: 18323666
-
Chris Manton authored
-
June R. Tate-Gans authored
-
Chris Manton authored
-
Chris Manton authored
-
Chris Manton authored
-
Chris Manton authored
-
Zach Johnson authored
-
Zach Johnson authored
Was never called, and the removal of which obviated a lot of other code.
-
Zach Johnson authored
The btm callback was never set, so this code did nothing useful.
-