OSDN Git Service

android-x86/system-bt.git
9 years agoasync_result abstraction for signaling async return values
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.

9 years agoFix packet fragmenter so it doesn't request acl sizes unless it's actually an ACL...
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.

9 years agoShuffle HCI layer internal functions into a more logical ordering
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

9 years agoRefactor bte_main into more of a shell.
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.

9 years agoAdd non-repeating timer wrapper for alarm
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.

9 years agoHCI layer cleanup
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.

9 years agoRemove must-always-be-true BTU_BTA_INCLUDED
Chris Manton [Wed, 3 Sep 2014 23:40:58 +0000 (16:40 -0700)]
Remove must-always-be-true BTU_BTA_INCLUDED

Change-Id: I7ddfb9d611b7f4a2787e0f4bec4a090cd9efc202

9 years agoAdd a check for a NULL root element from tinyxml2's XMLDocument.
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

9 years agoFix silly freeing of buffer.data instead of buffer
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.

9 years agoSink all HCI transmission management into the HCI layer
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.

9 years agoDemote timer hashmap entry failure log message
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.

9 years agobtif task removal and reactor insertion
Chris Manton [Mon, 8 Sep 2014 22:01:39 +0000 (15:01 -0700)]
btif task removal and reactor insertion

9 years agoGKI task entry points should have a consistent signature.
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.

9 years agoCode cleanup in GKI layer.
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

9 years agoEliminate unnecessary macros GKI_API, EXPORT_API, and UDRV_API.
Sharvil Nanavati [Sun, 7 Sep 2014 03:09:11 +0000 (20:09 -0700)]
Eliminate unnecessary macros GKI_API, EXPORT_API, and UDRV_API.

9 years agoDelete GKI debug code.
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.

9 years agoEliminate GKI_os_malloc and GKI_os_free.
Sharvil Nanavati [Sun, 7 Sep 2014 02:42:22 +0000 (19:42 -0700)]
Eliminate GKI_os_malloc and GKI_os_free.

9 years agoEliminate unused variables bufpool{0..15} in GKI control block.
Sharvil Nanavati [Sun, 7 Sep 2014 01:55:43 +0000 (18:55 -0700)]
Eliminate unused variables bufpool{0..15} in GKI control block.

9 years agoGKI_USE_DEFERED_ALLOC_BUF_POOLS is always defined. Flatten code paths.
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.

9 years agoRemove unused fields from GKI internal header.
Sharvil Nanavati [Sun, 7 Sep 2014 01:31:03 +0000 (18:31 -0700)]
Remove unused fields from GKI internal header.

9 years agoCleanup and remove unused variables in GKI's common OS control block.
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.

9 years agoUse arrays instead of variable names like Tmr0, Tmr1, ... in GKI.
Sharvil Nanavati [Sun, 7 Sep 2014 00:58:25 +0000 (17:58 -0700)]
Use arrays instead of variable names like Tmr0, Tmr1, ... in GKI.

9 years agoEliminate all attempts to set scheduling policy (all no-ops).
Sharvil Nanavati [Sat, 6 Sep 2014 23:53:25 +0000 (16:53 -0700)]
Eliminate all attempts to set scheduling policy (all no-ops).

9 years agoEliminate GKI_run and GKI_stop. Neither had any effect.
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.

9 years agoEliminate always-on macro GKI_PTHREAD_JOINABLE.
Sharvil Nanavati [Sat, 6 Sep 2014 23:40:18 +0000 (16:40 -0700)]
Eliminate always-on macro GKI_PTHREAD_JOINABLE.

9 years agoEliminate unused 'stack' concept for GKI tasks.
Sharvil Nanavati [Sat, 6 Sep 2014 23:31:37 +0000 (16:31 -0700)]
Eliminate unused 'stack' concept for GKI tasks.

This change also fixes the type for task names: should be a const
string, not a mutable INT8*.

9 years agoMove BTU task creation into stack/btu/btu_init.c.
Sharvil Nanavati [Sat, 6 Sep 2014 23:16:19 +0000 (16:16 -0700)]
Move BTU task creation into stack/btu/btu_init.c.

Also fixed function naming where the BTE prefix was used
instead of BTU.

9 years agoReplace timers and btu_task
Chris Manton [Fri, 29 Aug 2014 16:12:06 +0000 (09:12 -0700)]
Replace timers and btu_task

Replace GKI timers with alarms.

9 years agoReplace mailboxes with fixed queues.
Chris Manton [Wed, 27 Aug 2014 17:30:47 +0000 (10:30 -0700)]
Replace mailboxes with fixed queues.

Also refactored btu_task a bit.

9 years agoRemove #define BTA_SYS_TIMER_PERIOD
Chris Manton [Thu, 28 Aug 2014 20:28:39 +0000 (13:28 -0700)]
Remove #define BTA_SYS_TIMER_PERIOD

9 years agoRemove unused BTU timer/event APIs
Chris Manton [Wed, 3 Sep 2014 18:04:36 +0000 (11:04 -0700)]
Remove unused BTU timer/event APIs

btu_register_timer
btu_deregister_timer
btu_register_event_range
btu_deregister_event_range

9 years agoFix memory leak in L2CAP utils
Sharvil Nanavati [Wed, 3 Sep 2014 05:15:37 +0000 (22:15 -0700)]
Fix memory leak in L2CAP utils

A list was not freed (just its contents was).

9 years agoReplace BUFFER_Q with list_t
Chris Manton [Tue, 5 Aug 2014 05:03:39 +0000 (22:03 -0700)]
Replace BUFFER_Q with list_t

9 years agoReplace A2DP BUFFER_Q with a list
Chris Manton [Tue, 5 Aug 2014 20:24:41 +0000 (13:24 -0700)]
Replace A2DP BUFFER_Q with a list

The functions acting upon this list are all executed from action
or event context; which would be the same thread.

9 years agoRemove unused function BTM_SecSetConnectFilterCallback
Zach Johnson [Tue, 2 Sep 2014 21:54:49 +0000 (14:54 -0700)]
Remove unused function BTM_SecSetConnectFilterCallback

9 years agoMake SCO sockets request eSCO instead of SCO
Zach Johnson [Tue, 16 Sep 2014 23:34:31 +0000 (16:34 -0700)]
Make SCO sockets request eSCO instead of SCO

This fixes some audio routing problems.

9 years agoFix memory leak in RFCOMM sockets where some lists were not being freed.
Sharvil Nanavati [Sat, 30 Aug 2014 01:26:23 +0000 (18:26 -0700)]
Fix memory leak in RFCOMM sockets where some lists were not being freed.

9 years agoRemove unused #define BTU_CMD_CMPL_TOUT_DOUBLE_CHECK
Chris Manton [Tue, 26 Aug 2014 17:35:35 +0000 (10:35 -0700)]
Remove unused #define BTU_CMD_CMPL_TOUT_DOUBLE_CHECK

9 years agoRemove unused definitions using GKI events
Chris Manton [Tue, 26 Aug 2014 17:21:12 +0000 (10:21 -0700)]
Remove unused definitions using GKI events

9 years agoRe-layout Android.mk for single shared library
Chris Manton [Wed, 7 May 2014 23:21:00 +0000 (16:21 -0700)]
Re-layout Android.mk for single shared library

9 years agoRemove unncessary socket write to SCO socket.
Sharvil Nanavati [Sat, 23 Aug 2014 00:13:22 +0000 (17:13 -0700)]
Remove unncessary socket write to SCO socket.

I've verified that the BluetoothSocket is terminated in a timely manner
even without the write(2).

9 years agoUpdate SCO sockets to use OSI.
Sharvil Nanavati [Fri, 22 Aug 2014 01:17:19 +0000 (18:17 -0700)]
Update SCO sockets to use OSI.

This change brings us one step closer to eliminating btsock_thread.

9 years agoRewrite the btif_sock module.
Sharvil Nanavati [Thu, 21 Aug 2014 20:17:43 +0000 (13:17 -0700)]
Rewrite the btif_sock module.

The initialization flow now handles errors. The btif_sock module is
now solely responsible for managing the lifetime of the btsock_thread
it creates.

This change lays the foundation for switching all btif sockets to use
the OSI primitives.

9 years agoImplement GKI timers in terms of alarm.c. This also fixes some alarm/wake lock bugs.
Sharvil Nanavati [Thu, 28 Aug 2014 04:30:59 +0000 (21:30 -0700)]
Implement GKI timers in terms of alarm.c. This also fixes some alarm/wake lock bugs.

The OS callout implementation expects only a single outstanding alarm
and a single wake lock being taken. Since alarm.c uses both and GKI
timers use both, they were occasionally clobbering each other resulting
in unpredictable behaviour. By writing GKI timers in terms of alarm.c,
this change addresses those bugs.

9 years agoRemove unused "file system" concept & friends
Zach Johnson [Fri, 5 Sep 2014 06:05:55 +0000 (23:05 -0700)]
Remove unused "file system" concept & friends

Not actually ever used in the code, beyond importing some
header files and not calling any of their functions.

9 years agoRemove Windows related macros
Zach Johnson [Fri, 5 Sep 2014 01:33:10 +0000 (18:33 -0700)]
Remove Windows related macros

9 years agoEliminate call out/in indirection in bta_sys
Zach Johnson [Fri, 5 Sep 2014 00:57:58 +0000 (17:57 -0700)]
Eliminate call out/in indirection in bta_sys

9 years agoRemove FM/GPS/NFC related definitions
Zach Johnson [Thu, 4 Sep 2014 20:45:06 +0000 (13:45 -0700)]
Remove FM/GPS/NFC related definitions

9 years agoMake the DURING test stub macro support checking multiple modes at a time
Zach Johnson [Thu, 4 Sep 2014 07:17:41 +0000 (00:17 -0700)]
Make the DURING test stub macro support checking multiple modes at a time

This allows test modes which have almost identical code paths to share
some test stub code instead of having to duplicate it for each of them.

9 years agoRemove _WIDCOMM defines and AMP VSE events from hcidefs.h
Zach Johnson [Tue, 2 Sep 2014 22:41:26 +0000 (15:41 -0700)]
Remove _WIDCOMM defines and AMP VSE events from hcidefs.h

9 years agoRemove some more unused Broadcom specific macros
Zach Johnson [Tue, 2 Sep 2014 23:31:43 +0000 (16:31 -0700)]
Remove some more unused Broadcom specific macros

9 years agoRemove BTM_ReadBrcmFeatures because it shouldn't exist and isn't used
Zach Johnson [Tue, 2 Sep 2014 23:18:33 +0000 (16:18 -0700)]
Remove BTM_ReadBrcmFeatures because it shouldn't exist and isn't used

Also eliminates some related macros.

9 years agoRemove the company id defines (except broadcom for now)
Zach Johnson [Tue, 2 Sep 2014 23:01:00 +0000 (16:01 -0700)]
Remove the company id defines (except broadcom for now)

9 years agoRemove printf when attempting SDP requests.
Sharvil Nanavati [Wed, 3 Sep 2014 04:29:48 +0000 (21:29 -0700)]
Remove printf when attempting SDP requests.

9 years agoImplement BTM_InqDbRead in terms of btm_inq_db_find
Zach Johnson [Tue, 2 Sep 2014 20:54:18 +0000 (13:54 -0700)]
Implement BTM_InqDbRead in terms of btm_inq_db_find

duplicated_code--;

9 years agoRemove never used function BTM_GetNumLeLinks
Zach Johnson [Tue, 2 Sep 2014 21:24:56 +0000 (14:24 -0700)]
Remove never used function BTM_GetNumLeLinks

verified unused, even in the latest android code

9 years agoModify allocation tracking to include and verify the allocation source
Zach Johnson [Sat, 30 Aug 2014 00:08:44 +0000 (17:08 -0700)]
Modify allocation tracking to include and verify the allocation source

This will help detect and prevent allocator alloc/free mismatch.

9 years agoAdd memory canaries and turn them on for unit tests
Zach Johnson [Thu, 28 Aug 2014 20:30:17 +0000 (13:30 -0700)]
Add memory canaries and turn them on for unit tests

This will allow us to verify with resonable certainty
that the code is not writing past the end or beginning
of the memory allocation that it was given.

With canaries on, the canaried pointers returned by the
osi alloc functions are no longer passable directly to
free, since they must be offset to get the real allocation
pointers. This means all legacy code must be converted
over to the osi alloc functions before turning canaries
on in the wider codebase.

9 years agoRemove unused function BTM_SetInquiryFilterCallback
Zach Johnson [Tue, 2 Sep 2014 18:49:55 +0000 (11:49 -0700)]
Remove unused function BTM_SetInquiryFilterCallback

9 years agoRemove unused function BTM_InquiryRegisterForChanges and associated code
Zach Johnson [Tue, 2 Sep 2014 18:42:09 +0000 (11:42 -0700)]
Remove unused function BTM_InquiryRegisterForChanges and associated code

9 years agoAdd a VALGRIND #define to heap-allocate all GKI buffers.
Sharvil Nanavati [Tue, 2 Sep 2014 17:53:46 +0000 (10:53 -0700)]
Add a VALGRIND #define to heap-allocate all GKI buffers.

This change allows us to run Valgrind on bluedroid to find memory
leaks. It has already been used to track down multiple memory leaks
which weren't trackable with the existing GKI buffer implementation.

9 years agoFix memory leak in BTU where enequeued buffers were never freed on shutdown.
Sharvil Nanavati [Sat, 30 Aug 2014 01:28:19 +0000 (18:28 -0700)]
Fix memory leak in BTU where enequeued buffers were never freed on shutdown.

This resulted in the stack running out of GKI buffers on repeated
enable/disable cycles.

9 years agoRename init/cleanup to start_up/shut_down in the HCI layer
Zach Johnson [Sat, 30 Aug 2014 01:20:48 +0000 (18:20 -0700)]
Rename init/cleanup to start_up/shut_down in the HCI layer

9 years agoDon't pass in uninitialized memory to epoll_ctl. Make valgrind happy.
Sharvil Nanavati [Fri, 29 Aug 2014 23:30:25 +0000 (16:30 -0700)]
Don't pass in uninitialized memory to epoll_ctl. Make valgrind happy.

9 years agoRemove incomplete FTP #defines and implementation
Zach Johnson [Fri, 29 Aug 2014 23:03:20 +0000 (16:03 -0700)]
Remove incomplete FTP #defines and implementation

9 years agoRemove unreferenced BTRC_DISP macro
Zach Johnson [Fri, 29 Aug 2014 21:57:53 +0000 (14:57 -0700)]
Remove unreferenced BTRC_DISP macro

9 years agoRemove unreferenced BTE macros
Zach Johnson [Fri, 29 Aug 2014 21:54:43 +0000 (14:54 -0700)]
Remove unreferenced BTE macros

9 years agoFix heap memory leak by placing the BT device struct in static storage
Sharvil Nanavati [Fri, 29 Aug 2014 22:39:56 +0000 (15:39 -0700)]
Fix heap memory leak by placing the BT device struct in static storage

9 years agoRemoved always false macro BTM_INQ_GET_REMOTE_NAME
Zach Johnson [Fri, 29 Aug 2014 21:05:36 +0000 (14:05 -0700)]
Removed always false macro BTM_INQ_GET_REMOTE_NAME

9 years agoRemove some never used BTM macros
Zach Johnson [Fri, 29 Aug 2014 20:57:21 +0000 (13:57 -0700)]
Remove some never used BTM macros

9 years agoRemove always false macro L2CAP_HOST_FLOW_CTRL
Zach Johnson [Fri, 29 Aug 2014 20:23:07 +0000 (13:23 -0700)]
Remove always false macro L2CAP_HOST_FLOW_CTRL

9 years agoRemove unused #define's BTM_IS_CONNECTABLE and BTM_IS_DISCOVERABLE
Zach Johnson [Fri, 29 Aug 2014 18:11:22 +0000 (11:11 -0700)]
Remove unused #define's BTM_IS_CONNECTABLE and BTM_IS_DISCOVERABLE

9 years agoEliminate unused #define BTM_INTERNAL_BB
Zach Johnson [Fri, 29 Aug 2014 05:09:14 +0000 (22:09 -0700)]
Eliminate unused #define BTM_INTERNAL_BB

9 years agoUse osi_free with osi_calloc in HCI layer to avoid corruption
Sharvil Nanavati [Fri, 29 Aug 2014 08:35:03 +0000 (01:35 -0700)]
Use osi_free with osi_calloc in HCI layer to avoid corruption

There was a mismatch where the free function was GKI_free for a
pointer allocated with osi_calloc. This resulted in GKI exceptions
being thrown if the adapter goes through enable -> disable -> enable
-> disable without terminating the process.

9 years agoRemove unused auto-reset code path, with associated macros.
Zach Johnson [Fri, 29 Aug 2014 04:42:39 +0000 (21:42 -0700)]
Remove unused auto-reset code path, with associated macros.

9 years agoRemove unused #define BTM_AFTER_RESET_TIMEOUT
Zach Johnson [Fri, 29 Aug 2014 04:25:04 +0000 (21:25 -0700)]
Remove unused #define BTM_AFTER_RESET_TIMEOUT

9 years agoRemove indirection in the controller reset sequence
Zach Johnson [Fri, 29 Aug 2014 00:05:08 +0000 (17:05 -0700)]
Remove indirection in the controller reset sequence

9 years agoFix issue where last character of device name is missing
Sharvil Nanavati [Thu, 28 Aug 2014 04:56:41 +0000 (21:56 -0700)]
Fix issue where last character of device name is missing

The device name stored on disk is correct but has a missing character
at the end when read off of disk. This happened because the returned
|length| parameter to |btif_config_get_str| is in number of *bytes*,
not in number of characters (i.e. must add one for NULL character).

9 years agoAdd a UUID module to btcore for operating on UUIDs.
Sharvil Nanavati [Thu, 28 Aug 2014 02:03:03 +0000 (19:03 -0700)]
Add a UUID module to btcore for operating on UUIDs.

This change only adds a single function, uuid_is_empty, but I expect
other UUID-related functions to find themselves here.

9 years agoIntroduce btcore, a low-level library to manipulate Bluetooth data types.
Sharvil Nanavati [Wed, 20 Aug 2014 16:39:25 +0000 (09:39 -0700)]
Introduce btcore, a low-level library to manipulate Bluetooth data types.

This change adds a single module to btcore: bdaddr. The bdaddr module
is reponsible for manipulating and working with Bluetooth addresses.

9 years agoFix digital transposition in saving binary config data
Zach Johnson [Thu, 21 Aug 2014 00:09:25 +0000 (17:09 -0700)]
Fix digital transposition in saving binary config data

Was causing link keys to be saved/read incorrectly, causing reconnect on reboot to fail.

9 years agoEliminate unused arguments to btif_config and clarify variable names
Sharvil Nanavati [Tue, 19 Aug 2014 16:50:18 +0000 (09:50 -0700)]
Eliminate unused arguments to btif_config and clarify variable names

9 years agoSwitch over from an XML based file format to .INI-style conf files
Sharvil Nanavati [Sat, 16 Aug 2014 01:58:22 +0000 (18:58 -0700)]
Switch over from an XML based file format to .INI-style conf files

This change moves us to using a single file format for all configuration
throughout bluedroid. I've provided a transcoder that converts the
previous config file to the new format so settings will be preserved.

In a future revision of bluedroid, we should remove the transcoder and
drop our dependency on tinyxml2.

9 years agoAdd a method to check for available bytes on a socket
Sharvil Nanavati [Thu, 28 Aug 2014 02:05:40 +0000 (19:05 -0700)]
Add a method to check for available bytes on a socket

The available bytes function shouldn't normally be required (and
if it is, the code design is probably bad and should be rethought) but
is introduced as a stop-gap until we can redesign the BTA code that
expects a priori knowledge of the number of bytes that can be read from
the socket.

This change also relaxes the requirement that on socket_register that
at least one of read_cb or write_cb must be specified.

9 years agoMake osi_strdup report allocation size correctly
Zach Johnson [Thu, 28 Aug 2014 03:26:00 +0000 (20:26 -0700)]
Make osi_strdup report allocation size correctly

9 years agoMove HCI over to the osi allocators, and fix the tests accordingly
Zach Johnson [Wed, 27 Aug 2014 23:30:29 +0000 (16:30 -0700)]
Move HCI over to the osi allocators, and fix the tests accordingly

9 years agoFinish allocation tracking for the rest of osi
Zach Johnson [Wed, 27 Aug 2014 03:16:03 +0000 (20:16 -0700)]
Finish allocation tracking for the rest of osi

And found a memory leak in config, so it's doing its job! :)

9 years agoRemove unused #define RPC_INCLUDED
Chris Manton [Wed, 27 Aug 2014 04:20:44 +0000 (21:20 -0700)]
Remove unused #define RPC_INCLUDED

9 years agoFix timer allocations in the test harness, so bdtest runs again
Zach Johnson [Wed, 27 Aug 2014 22:45:35 +0000 (15:45 -0700)]
Fix timer allocations in the test harness, so bdtest runs again

9 years agoCorrect comments and some redundant statements.
Steve Gu [Wed, 27 Aug 2014 17:44:52 +0000 (10:44 -0700)]
Correct comments and some redundant statements.

9 years agoRemove must-always-be-on #define HCISU_H4_INCLUDED
Chris Manton [Tue, 26 Aug 2014 23:11:45 +0000 (16:11 -0700)]
Remove must-always-be-on #define HCISU_H4_INCLUDED

9 years agoAdd strdup to tracked allocations
Zach Johnson [Wed, 27 Aug 2014 03:15:19 +0000 (20:15 -0700)]
Add strdup to tracked allocations

9 years agoAdd internal constructors to hash map and list
Zach Johnson [Wed, 27 Aug 2014 00:21:44 +0000 (17:21 -0700)]
Add internal constructors to hash map and list

This makes allocation tracker safe and ensures the hash map
and associated lists for the allocation tracker don't show
up in the allocation tracker's stats.

9 years agoClean up scattered naive hash functions
Zach Johnson [Tue, 26 Aug 2014 19:23:09 +0000 (12:23 -0700)]
Clean up scattered naive hash functions

9 years agoMove some of osi to use the allocation interfaces
Zach Johnson [Tue, 26 Aug 2014 06:22:24 +0000 (23:22 -0700)]
Move some of osi to use the allocation interfaces

Also changes some tests to ensure all memory freed.

9 years agoAdd a method to pass file descriptors and one to create a socket from an fd.
Sharvil Nanavati [Fri, 22 Aug 2014 01:13:46 +0000 (18:13 -0700)]
Add a method to pass file descriptors and one to create a socket from an fd.

9 years agoRewrite the SCO socket implementation to be more robust.
June R. Tate-Gans [Thu, 19 Feb 2015 22:29:35 +0000 (14:29 -0800)]
Rewrite the SCO socket implementation to be more robust.

This code presents a socket interface for SCO connections. Like the
previous implementation, it does not support sending/receiving data
over the sockets; rather, it only provides a mechanism to establish
and tear down connections. It is assumed that all SCO data routing is
done out-of-band over PCM/I2S.

A SCO socket is represented internally by a file descriptor and SCO
handle. The file descriptor is one end of a socketpair (the other
end is sent to the Java process) and the SCO handle represents a
server (listening) or client (connecting) socket owned by the BTM
layer of the stack.

The most notable implementation detail is that, unlike typical
sockets, listening SCO sockets get "upgraded" when a connection is
established. In other words, a SCO handle for a listening socket
turns into a handle for a connected socket. To present a BSD-style
API to Java processes, we play a trick: when a listening socket gets
upgraded, we create a new listening SCO socket and reassociate the
SCO handle for the two sockets. The reassociation allows the Java
process to continue listening for new incoming SCO connections on
the same file descriptor.

9 years agoMove the disconnect_immediately logic so that it's only in effect for data sockets
Ian McKellar [Wed, 19 Feb 2014 23:33:32 +0000 (15:33 -0800)]
Move the disconnect_immediately logic so that it's only in effect for data sockets

9 years agoClear connected & disconnect_immediately flags when intializing SCO sockets
Ian McKellar [Thu, 13 Feb 2014 22:11:06 +0000 (14:11 -0800)]
Clear connected & disconnect_immediately flags when intializing SCO sockets

9 years agoFix a race condition where closing a SCO connection that was not yet fully open would...
Ian McKellar [Tue, 11 Feb 2014 00:52:26 +0000 (16:52 -0800)]
Fix a race condition where closing a SCO connection that was not yet fully open would silently fail.