OSDN Git Service
Sharvil Nanavati [Tue, 14 Oct 2014 00:41:19 +0000 (17:41 -0700)]
avdt: Make sure LCID field is filled out even on incoming connections.
Zach Johnson [Wed, 24 Sep 2014 20:57:45 +0000 (13:57 -0700)]
Make bdtest report the total number of tests (sanity + suite)
There are currently 11 tests, but if one failed it would report 1/9 rather than 1/11.
Zach Johnson [Wed, 24 Sep 2014 20:41:33 +0000 (13:41 -0700)]
Change bdtest text color gray to the default color
My command prompt outputs white text, so this change makes bdtest
restore the default color after running, instead of leaving it gray.
Sharvil Nanavati [Wed, 3 Sep 2014 18:47:48 +0000 (11:47 -0700)]
Add system tests for RFCOMM sockets.
Sharvil Nanavati [Mon, 22 Sep 2014 07:47:50 +0000 (00:47 -0700)]
Add a watchdog timer to test suite.
If a test case doesn't make forward progress after some amount
of time, we terminate the process and assume failure. It's important
for test automation that the test suite does not hang forever.
Sharvil Nanavati [Sat, 20 Sep 2014 17:43:01 +0000 (10:43 -0700)]
Only colorize test result output if stdout is attached to a tty.
This will make sure redirected output won't have escape sequences
while still leaving the output pretty when running tests by hand.
Sharvil Nanavati [Tue, 24 Feb 2015 01:31:48 +0000 (17:31 -0800)]
Make build more strict by adding more warning flags.
This change introduces -Wunused-but-set-variable to help catch
programming errors. It also undefines NDEBUG so assertions are
fatal and defines LOG_NDEBUG=1 to suppress LOGV.
June R. Tate-Gans [Mon, 20 Oct 2014 19:41:43 +0000 (12:41 -0700)]
Removing a duplicate call to socket_register.
Chris Manton [Thu, 9 Oct 2014 23:04:05 +0000 (16:04 -0700)]
First entry for bdtool
Zach Johnson [Wed, 8 Oct 2014 16:18:48 +0000 (09:18 -0700)]
Comment said BTM_PM_SNIFF_SLOT_WORK_AROUND would be removed someday. Today is that day.
Looks like this has been around for a while, and isn't/shouldn't be used.
restore_pkt_types then becomes obsolete, so removed.
Sharvil Nanavati [Sun, 4 May 2014 00:32:05 +0000 (17:32 -0700)]
Make hci/ depend on bdroid_CFLAGS
Zach Johnson [Wed, 29 Oct 2014 00:59:13 +0000 (17:59 -0700)]
Fix BLE GAP handling after callback refactoring
BLE supported states was moved to controller during the callback
re-factoring CL, but in the commotion I forgot to remove the
supported states variable from devcb.
This meant I didn't realize GAP was looking at the wrong place
for BLE supported states. This CL fixes that.
Zach Johnson [Tue, 28 Oct 2014 00:23:49 +0000 (17:23 -0700)]
Remove unused function BTM_ChangeLinkKey & friends
Not used in the codebase. Removed it along with
all its related code.
According to the spec the change link key event is only
sent in response to the change link key command, so
it should be completely safe to remove that logic.
Sharvil Nanavati [Tue, 21 Oct 2014 09:38:01 +0000 (02:38 -0700)]
Remove excessive log message from btu_task.
Zach Johnson [Mon, 20 Oct 2014 22:40:01 +0000 (15:40 -0700)]
Remove some remaining references to OBX
Android implements the Object Push Profile in java
against RFCOMM sockets with its own implementation of
OBX there.
OBX in Bluedroid isn't compiled, and is missing header files required
to compile it anyway. Removed a number of OBX related headers and updated
a few references where they were used out of place.
Change-Id: Ifaecfb6f85b1dca9055932886af484b6dc107fc1
Zach Johnson [Mon, 20 Oct 2014 20:22:43 +0000 (13:22 -0700)]
Remove a bunch of always-false macros
Referenced missing header files, so they wouldn't even
compile if set to true.
Zach Johnson [Mon, 20 Oct 2014 20:06:52 +0000 (13:06 -0700)]
Remove definitions for DUN
Missing header files, etc so it wouldn't compile anyway.
Zach Johnson [Mon, 20 Oct 2014 18:43:02 +0000 (11:43 -0700)]
Remove always false TCS_INCLUDED macro & friends
Referenced non existent headers, so would not compile if set to true.
Zach Johnson [Sat, 18 Oct 2014 01:25:18 +0000 (18:25 -0700)]
Remove remaining references to GOEP
FALSE by bt_target. Header files never used. Missing header files.
Zach Johnson [Sat, 18 Oct 2014 01:17:20 +0000 (18:17 -0700)]
Remove unused header utfc.h
Zach Johnson [Sat, 18 Oct 2014 00:56:28 +0000 (17:56 -0700)]
Remove a bunch of unused functions and definitions from HCIC
Left the BLE stuff alone for now.
Zach Johnson [Sat, 18 Oct 2014 00:07:30 +0000 (17:07 -0700)]
Remove unused macros LMP_TEST and BTISE
Zach Johnson [Fri, 17 Oct 2014 18:28:46 +0000 (11:28 -0700)]
Disambiguate event mask setting for bluetooth DUT mode
The nuances of addressing a string literal are tricky, so it
looks like we're using a char ** when in reality it's a pointer to
the array containing the literal, which converts just fine.
Removing the address-of makes it easier to see correctness.
Zach Johnson [Wed, 15 Oct 2014 00:56:37 +0000 (17:56 -0700)]
Remove unused code in GAP
Left the BLE stuff for now, since some of it appears to
be used at least right now.
Zach Johnson [Thu, 16 Oct 2014 22:52:45 +0000 (15:52 -0700)]
Don't call null callback in vendor lib
Don't require a vendor library command transmit to provide a callback.
If the vendor library provides a null callback just ignore it.
Zach Johnson [Wed, 15 Oct 2014 20:43:26 +0000 (13:43 -0700)]
Fix accidental hardcoding of 2+ extended feature page numbers
Happened to be ok on devices with 1 or 2 feature pages, but for
devices with 3 or more feature pages it was always loading the
page at index 1 for pages past the page at index 0, causing
an infinite loop, causing bluetooth enable to time out.
Chris Manton [Wed, 15 Oct 2014 05:00:32 +0000 (22:00 -0700)]
Move properties data primitive into btcore
This is a valuable data structure that could be
used widely within the stack. It's used by
bdtest and bdtool, and could be used by any
other application built on top of the stack.
Zach Johnson [Tue, 14 Oct 2014 23:41:21 +0000 (16:41 -0700)]
Add comments to the device features and event mask structs
Zach Johnson [Wed, 8 Oct 2014 20:51:06 +0000 (13:51 -0700)]
Remove L2CAP_CORRUPT_ERTM_PKTS macro
In general, test code and production code should not coexist in the same file.
Zach Johnson [Wed, 8 Oct 2014 03:21:37 +0000 (20:21 -0700)]
Refactor bta_jv functions
Remove unused L2CAP and SDP code to reduce distraction from unused code
path.
In general, if we need any of this behavior in the future, it's best
to talk directly to the apis instead of through another layer.
Zach Johnson [Mon, 6 Oct 2014 20:15:00 +0000 (13:15 -0700)]
Remove duplicate local bdaddr management functions
Zach Johnson [Sat, 27 Sep 2014 04:14:34 +0000 (21:14 -0700)]
Refactor btm_devctl reset sequence
* Controller bring up on blockable thread now
* Removed some duplicate and commands during controller bring up
* The code to make commands for controller bring up is smaller and better
Zach Johnson [Wed, 1 Oct 2014 02:10:56 +0000 (19:10 -0700)]
Prune BTM_ReadLocalVersion
It was called once, but the version info read back was
never used. The status returned was used, but that was
implicitly getting whether the device was up or not so
replaced with a call to BTM_IsDeviceUp.
Zach Johnson [Mon, 29 Sep 2014 21:03:20 +0000 (14:03 -0700)]
Remove <BT 2.0 workarounds
Zach Johnson [Tue, 30 Sep 2014 07:09:55 +0000 (00:09 -0700)]
Prune BTM_SetSecurityMode and GAP_SetSecurityMode
BTM_SetSecurityMode was only used from GAP_SetSecurityMode,
and GAP_SetSecurityMode was never used.
Zach Johnson [Sun, 28 Sep 2014 22:46:25 +0000 (15:46 -0700)]
Add temporary callbacked wrapper for module startup
When all is said and done with the module conversions, all lifecycle functions
will run on the lifecycle managment thread, which can be blocked while waiting
for futures.
This CL means new modules can depend on that fact during start_up, alllowing
newly converted modules to be spliced into the existing startup callback madness
without having to sacrifice clean implementation.
We can add other callbacked lifecycle function variants as necessary.
June R. Tate-Gans [Wed, 24 Sep 2014 22:25:02 +0000 (15:25 -0700)]
Removing unnecessary BTAPI #defines.
Zach Johnson [Sun, 28 Sep 2014 05:10:32 +0000 (22:10 -0700)]
Add a futured version of the HCI transmit_command
This will allow the controller restart sequence to be serialized into a single function.
Zach Johnson [Wed, 1 Oct 2014 02:38:44 +0000 (19:38 -0700)]
Remove some < BT 2.1 code & repeated init
Simple pairing is already enabled and the BLE event mask
is already set by this point.
Zach Johnson [Wed, 1 Oct 2014 02:23:09 +0000 (19:23 -0700)]
Remove BTM_SetDeviceClass call in devctl
BTM_SetDeviceClass is called later on in bta_dm_sys_hw_cback
during BTA_SYS_HW_ON_EVT using the real device class. No need
to set an "init" device class as far as I know.
Chris Manton [Mon, 29 Sep 2014 23:35:34 +0000 (16:35 -0700)]
Remove duplicate L2CAP_NUM_FIXED_CHNLS
Zach Johnson [Fri, 26 Sep 2014 21:03:13 +0000 (14:03 -0700)]
Remove unused hci_cmd_cb in btu
An earlier change obviated the need for it, but I
forgot to remove it at that time.
Zach Johnson [Thu, 25 Sep 2014 00:27:25 +0000 (17:27 -0700)]
Modulizification of bt_utils
Zach Johnson [Wed, 24 Sep 2014 19:04:01 +0000 (12:04 -0700)]
Modulizification of btif_config
Zach Johnson [Wed, 24 Sep 2014 03:53:41 +0000 (20:53 -0700)]
Remove BTTRC_INCLUDED
It used functions that didn't exist, so there's no way it
would compile if it was defined to true.
Also removes some defines that would nop without it.
Zach Johnson [Wed, 24 Sep 2014 03:25:47 +0000 (20:25 -0700)]
Modulizification of GKI
Zach Johnson [Wed, 24 Sep 2014 01:30:45 +0000 (18:30 -0700)]
Modulizification of the HCI layer
Shutdown is managed by the stack manager now, so we don't need to lock
around it. The fetching of the device address is a bit hacky right now,
until it becomes part of its own module.
Chris Manton [Sat, 27 Sep 2014 04:31:38 +0000 (21:31 -0700)]
Add paired cleanup routine for logmsg
Zach Johnson [Sat, 27 Sep 2014 04:16:20 +0000 (21:16 -0700)]
Move module_management_stop to clean_up
Module management isn't done when the stack is shut_down (bluetooth disabled)
Zach Johnson [Tue, 23 Sep 2014 05:11:55 +0000 (22:11 -0700)]
Refactor btsnoop and stack config into modules
Moves stack config out of the combined bte_config, and into
its own module.
Makes btsnoop more self sufficient and removes uneccessary
levels of indirection.
Refactor logging slightly into a (temporary) module to disassociate
from the direct calls from config. Eliminates some useless stuff in
the module as well.
Zach Johnson [Tue, 23 Sep 2014 05:14:04 +0000 (22:14 -0700)]
First pass at implementing modules
This first step creates the notion of a module and corresponding
lifecycle functions, with helpers to simplify working with them.
Once everything is converted over to this module format, then we
can make the stack manager automagically find the correct order for
init/start_up/shut_down/clean_up
Zach Johnson [Sat, 27 Sep 2014 00:04:51 +0000 (17:04 -0700)]
Unregister BTU queues upon shutdown
This ensures that the next run doesn't try to access memory
that is no longer valid.
Chris Manton [Fri, 26 Sep 2014 20:31:41 +0000 (13:31 -0700)]
Remove HCI access macros
And some other minor bt_target cleanup.
Chris Manton [Fri, 26 Sep 2014 18:42:20 +0000 (11:42 -0700)]
Remove GKI task code
Chris Manton [Fri, 26 Sep 2014 18:41:53 +0000 (11:41 -0700)]
Replace bt media GKI task with thread_t
Chris Manton [Fri, 5 Sep 2014 02:48:49 +0000 (19:48 -0700)]
Remove btu_task and replace with bt_workqueue reactor
Chris Manton [Wed, 24 Sep 2014 22:18:41 +0000 (15:18 -0700)]
Logging cleanup
Chris Manton [Wed, 24 Sep 2014 17:27:52 +0000 (10:27 -0700)]
Remove unused definitions from bt_target.h
Sharvil Nanavati [Mon, 22 Sep 2014 06:50:54 +0000 (23:50 -0700)]
Eliminate memory leaks and unsafe callbacks in BTA and BTE.
Alarms were being added to a hash map but were not freed during
teardown. This results in both memory leaks and potential access
of torn-down data (in case the still-armed alarm fires after
teardown completes).
Chris Manton [Fri, 19 Sep 2014 16:08:32 +0000 (09:08 -0700)]
Add string hashing function using djb2
Zach Johnson [Mon, 8 Sep 2014 18:39:49 +0000 (11:39 -0700)]
Disassociate hash algorithm with hash function name
This will make it easier to select the correct one for the job, and also
make it possible to substitute a better one in the future if need be without
having to change the function name.
kunth is duplicated, once for integer hashing and once for shallow pointer hashing, to
make usage more readable.
Zach Johnson [Tue, 23 Sep 2014 00:59:02 +0000 (17:59 -0700)]
Rewerite btif_sendmsg in terms of thread_post
Zach Johnson [Tue, 24 Feb 2015 07:43:03 +0000 (23:43 -0800)]
Fix alarm setting for newer deadlines
If an alarm is being set and is the newest deadline
among a set of existing alarms, it would be appended
after the first existing alarm rather than prepended
in front.
This in turn meant the root alarm wasn't getting
rescheduled correctly, especially if the old
deadline was rather distant in the future.
(This was causing the bluetooth disable sequence to
fail intermittently.)
Zach Johnson [Thu, 25 Sep 2014 18:58:50 +0000 (11:58 -0700)]
Post adapter_state_changed events to the JNI workqueue
Otherwise, JNI rejects the callbacks. Fix for b/
17655336
Zach Johnson [Wed, 24 Sep 2014 23:01:29 +0000 (16:01 -0700)]
Don't send adapter change until stack manager updates state
Since the callback occurred before the stack manager updated its
state to say the stack was fully loaded, there was a chance that
the adapter name change would be attempted before the state was
updated.
This would cause the adapter property change function to return
a "not ready" status.
Sharvil Nanavati [Mon, 22 Sep 2014 06:49:23 +0000 (23:49 -0700)]
Eliminate memory leak in stack initialization.
A heap allocated semaphore was not freed after use.
Sharvil Nanavati [Thu, 18 Sep 2014 08:54:06 +0000 (01:54 -0700)]
Fix bug where some BTU timer callbacks weren't propagated in a timely manner.
This change sends an event to the BTU task after enqueuing a timer
callback into its timer queue so that the BTU task thread wakes up
and dispatches the callback ASAP. Otherwise, the callback will be
dispatched at a random time or sometimes not at all.
All bdtest cases pass after this change.
Sharvil Nanavati [Thu, 18 Sep 2014 07:55:11 +0000 (00:55 -0700)]
Fix timeout values for BTA system timers.
bta_sys_start_timer assumes a timeout value in GKI ticks but the
callers are passing in a timeout value in milliseconds. This change
updates the implementation to use units of milliseconds.
Chris Manton [Wed, 17 Sep 2014 20:30:13 +0000 (13:30 -0700)]
Add back timer list entry in_use field
I thought this field was used for internal
bookkeeping, but it turns the higher layer
protocols use it to condition if a timer
should be started or stopped.
Sharvil Nanavati [Fri, 1 Aug 2014 23:40:56 +0000 (16:40 -0700)]
Enable assertions.
Zach Johnson [Fri, 19 Sep 2014 01:46:39 +0000 (18:46 -0700)]
Remove btif enable state management
It's no longer necessary with the stack manager.
With these changes I don't think we'll be able to handle clean_up
as a result of an enable timeout coming down from Java.
But I think I'm ok with that.
At that point we're already hosed because of something else
which should be fixed. And if we wanted to handle clean_up during
start_up we'd violate the mutually exclusive guarantees the stack
management thread makes about init/start_up/shut_down/clean_up.
Zach Johnson [Fri, 19 Sep 2014 01:13:13 +0000 (18:13 -0700)]
Make stack manager functions not finish until action complete
It's a bit hacky at the moment, but this incremental update means the
stack manager booleans should be correct now and we can start removing
code that relies on the btif states.
Zach Johnson [Fri, 19 Sep 2014 00:16:41 +0000 (17:16 -0700)]
s/async_result/future/g and also improve the future API
Freeing now happens implicitly upon await, and immediate
futures will allow a uniform usage pattern for calls
that are async and calls that are not.
Zach Johnson [Fri, 19 Sep 2014 00:29:54 +0000 (17:29 -0700)]
Make semaphore_free idempotent
Passing NULL before would lead to a segfault.
Zach Johnson [Tue, 9 Sep 2014 23:31:14 +0000 (16:31 -0700)]
Move all stack init/start_up/shut_down/clean_up on a single known thread
Execution happens on the same thread, but the next step will be to
ensure each of the functions do not complete until start_up/shut_down/clean_up
complete. That will ensure each is mutually exclusive.
Zach Johnson [Wed, 10 Sep 2014 01:18:12 +0000 (18:18 -0700)]
async_result abstraction for signaling async return values
This will be useful when signaling success/fail during individual
asynchronous steps of stack start up and shut down.
Zach Johnson [Wed, 17 Sep 2014 22:20:04 +0000 (15:20 -0700)]
Fix packet fragmenter so it doesn't request acl sizes unless it's actually an ACL packet
During the startup process, commands are sent before the ACL sizes are fetched.
With the change that we now assert the acl sizes are fetched when you request
them from the controller, the assertion was being triggered during that phase.
When I was rebasing the waiting changes and also making the assertion change,
I should have been more careful to test this. mea culpa
Also simplifies that code path just a bit.
Zach Johnson [Tue, 9 Sep 2014 01:53:52 +0000 (18:53 -0700)]
Shuffle HCI layer internal functions into a more logical ordering
No actual code additions/deletions, other than additional forward declarations
Zach Johnson [Tue, 9 Sep 2014 01:31:39 +0000 (18:31 -0700)]
Refactor bte_main into more of a shell.
Moves all HCI initialization into hci_layer. Removes superfluous exposed
functionality on the HCI layer (like turning the chip on/off and logging)
Also reorganizes some of hci_layer to group related functions together.
Zach Johnson [Mon, 8 Sep 2014 22:20:22 +0000 (15:20 -0700)]
Add non-repeating timer wrapper for alarm
Refactor the hci layer to use it.
The timer wrapper allows you to specify the duration, etc at construction time
rather than at start time, making some usage patterns of alarm more convenient.
Zach Johnson [Mon, 8 Sep 2014 16:56:35 +0000 (09:56 -0700)]
HCI layer cleanup
- x_interface_t started to get annoyingly verbose, changed to x_t
- buffer_allocator is standalone now, no longer part of bte_main
- new controller_t to handle controller start up and hold controller state
- new hci_packet_factory to make packets, and hci_packet_parser
to read information out of packets.
Chris Manton [Wed, 3 Sep 2014 23:40:58 +0000 (16:40 -0700)]
Remove must-always-be-true BTU_BTA_INCLUDED
Change-Id: I7ddfb9d611b7f4a2787e0f4bec4a090cd9efc202
Sharvil Nanavati [Tue, 16 Sep 2014 07:11:35 +0000 (00:11 -0700)]
Add a check for a NULL root element from tinyxml2's XMLDocument.
This shouldn't really be necessary since a parsed document
should have at least a root element. In practice, however, tinyxml2
sometimes returns success on LoadFile() and NULL on RootElement().
Bug:
17504829
Zach Johnson [Tue, 16 Sep 2014 03:58:21 +0000 (20:58 -0700)]
Fix silly freeing of buffer.data instead of buffer
Also remove an unnecessary log message.
Zach Johnson [Wed, 3 Sep 2014 21:36:44 +0000 (14:36 -0700)]
Sink all HCI transmission management into the HCI layer
Begins the refactoring of the HCI related code in BTA, corrects some
hacks in the HCI layer (no more concept of internal commands, yay!),
and corrects the handling of multiple commands pending response in the
HCI layer.
This introduce a horrible hack external to the HCI layer to keep BTU HCI
handling of command complete/status events on the BTU task. That hack
will be removed when BTU moves to a reactor model and we have osi
threads to work with.
Chris Manton [Mon, 15 Sep 2014 16:46:58 +0000 (09:46 -0700)]
Demote timer hashmap entry failure log message
The procedures that use timers immediately cancel them upon startup
assuming they existed previously. The first time though the codepath
these traversalls cause the hashmap lookup failure.
Chris Manton [Mon, 8 Sep 2014 22:01:39 +0000 (15:01 -0700)]
btif task removal and reactor insertion
Sharvil Nanavati [Sun, 7 Sep 2014 09:48:19 +0000 (02:48 -0700)]
GKI task entry points should have a consistent signature.
Previously, GKI task entry points had inconsistent signatures. For
example, we had:
int btif_media_task(void *p)
void btif_task(UINT32 params)
void btu_task (UINT32 param)
The single argument was universally ignored and the caller always
set it to 0. This change consolidates all of that and defines the
entry point as having 0 arity and no return value.
Sharvil Nanavati [Sun, 7 Sep 2014 09:15:19 +0000 (02:15 -0700)]
Code cleanup in GKI layer.
* move buffer macros into .c from .h
* delete dead code (e.g. GKI_igetpoolbuf, pool_list variable)
* define task states as an enum and not a bitfield
* start renaming fields in GKI control block for future consolidation
Sharvil Nanavati [Sun, 7 Sep 2014 03:09:11 +0000 (20:09 -0700)]
Eliminate unnecessary macros GKI_API, EXPORT_API, and UDRV_API.
Sharvil Nanavati [Sun, 7 Sep 2014 02:49:20 +0000 (19:49 -0700)]
Delete GKI debug code.
GKI is slowly disappearing so much of that debug code isn't useful.
Sharvil Nanavati [Sun, 7 Sep 2014 02:42:22 +0000 (19:42 -0700)]
Eliminate GKI_os_malloc and GKI_os_free.
Sharvil Nanavati [Sun, 7 Sep 2014 01:55:43 +0000 (18:55 -0700)]
Eliminate unused variables bufpool{0..15} in GKI control block.
Sharvil Nanavati [Sun, 7 Sep 2014 01:42:48 +0000 (18:42 -0700)]
GKI_USE_DEFERED_ALLOC_BUF_POOLS is always defined. Flatten code paths.
Sharvil Nanavati [Sun, 7 Sep 2014 01:31:03 +0000 (18:31 -0700)]
Remove unused fields from GKI internal header.
Sharvil Nanavati [Sun, 7 Sep 2014 01:17:55 +0000 (18:17 -0700)]
Cleanup and remove unused variables in GKI's common OS control block.
Sharvil Nanavati [Sun, 7 Sep 2014 00:58:25 +0000 (17:58 -0700)]
Use arrays instead of variable names like Tmr0, Tmr1, ... in GKI.
Sharvil Nanavati [Sat, 6 Sep 2014 23:53:25 +0000 (16:53 -0700)]
Eliminate all attempts to set scheduling policy (all no-ops).
Sharvil Nanavati [Sat, 6 Sep 2014 23:46:46 +0000 (16:46 -0700)]
Eliminate GKI_run and GKI_stop. Neither had any effect.
GKI_run was called but didn't do anything: it would call
sched_setscheduler to increase the priority of the current process
but Android OS policy doesn't allow for that. And GKI_stop was never
called.
Sharvil Nanavati [Sat, 6 Sep 2014 23:40:18 +0000 (16:40 -0700)]
Eliminate always-on macro GKI_PTHREAD_JOINABLE.