summaryrefslogtreecommitdiff
path: root/android/avdtp.c
Commit message (Collapse)AuthorAgeFilesLines
* shared/util: use 64-bit bitmap in util_get/clear_uidPauli Virtanen2021-09-061-1/+1
| | | | | | | | | | | The util_get/clear_uid functions use int type for bitmap, and are used e.g. for SEID allocation. However, valid SEIDs are in range 1 to 0x3E (AVDTP spec v1.3, 8.20.1), and 8*sizeof(int) is often smaller than 0x3E. The function is also used in src/advertising.c, but an explicit maximum value is always provided, so growing the bitmap size is safe there. Use 64-bit bitmap instead, to be able to cover the valid range.
* android: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- Apache-2.0 : 80 LGPL-2.1-or-later : 42 GPL-2.0-or-later : 9 License: Apache-2.0 android/bluetoothd-wrapper.c android/tester-hidhost.c android/tester-map-client.c android/hal-audio-aptx.c android/hal-audio.c android/hal-handsfree-client.c android/tester-gatt.c android/hal-pan.c android/hal-socket.c android/tester-hdp.c android/tester-pan.c android/tester-avrcp.c android/hal-a2dp-sink.c android/hal-gatt.c android/hal-avrcp.c android/tester-a2dp.c android/hal-audio.h android/hal-bluetooth.c android/tester-socket.c android/hal-health.c android/hal-a2dp.c android/hal-ipc.c android/hal-avrcp-ctrl.c android/hal-sco.c android/hal-ipc.h android/tester-main.c android/hal-audio-sbc.c android/hal-utils.c android/hal-map-client.c android/hal-handsfree.c android/hal-log.h android/hal.h android/hal-utils.h android/tester-bluetooth.c android/hal-hidhost.c android/audio_utils/resampler.h android/audio_utils/resampler.c android/system/audio.h android/hardware/bt_sock.h android/hardware/bt_gatt_client.h android/hardware/bt_hh.h android/hardware/bluetooth.h android/hardware/hardware.h android/hardware/bt_hf_client.h android/hardware/bt_rc.h android/hardware/bt_hf.h android/hardware/bt_pan.h android/hardware/bt_gatt_types.h android/hardware/hardware.c android/hardware/audio_effect.h android/hardware/audio.h android/hardware/bt_gatt_server.h android/hardware/bt_gatt.h android/hardware/bt_hl.h android/hardware/bt_mce.h android/hardware/bt_av.h android/client/if-hh.c android/client/if-sco.c android/client/pollhandler.h android/client/haltest.c android/client/tabcompletion.c android/client/if-hf-client.c android/client/history.h android/client/if-audio.c android/client/terminal.h android/client/if-av.c android/client/if-main.h android/client/if-av-sink.c android/client/terminal.c android/client/if-mce.c android/client/if-hf.c android/client/pollhandler.c android/client/if-sock.c android/client/if-rc-ctrl.c android/client/if-rc.c android/client/history.c android/client/if-pan.c android/client/if-gatt.c android/client/if-bt.c android/client/if-hl.c License: LGPL-2.1-or-later android/sco.h android/socket.c android/tester-main.h android/hidhost.h android/map-client.h android/utils.h android/hal-msg.h android/health.h android/avrcp-lib.c android/bluetoothd-snoop.c android/a2dp.c android/bluetooth.h android/a2dp-sink.c android/handsfree-client.c android/audio-msg.h android/main.c android/pan.c android/ipc-tester.c android/health.c android/socket.h android/handsfree.h android/avrcp-lib.h android/a2dp-sink.h android/system-emulator.c android/gatt.c android/avrcp.h android/pan.h android/test-ipc.c android/hidhost.c android/a2dp.h android/avrcp.c android/sco-msg.h android/bluetooth.c android/map-client.c android/handsfree-client.h android/ipc.c android/handsfree.c android/gatt.h android/ipc.h android/ipc-common.h android/compat/wordexp.h android/cutils/properties.h License: GPL-2.0-or-later android/avdtp.h android/avctp.c android/avdtptest.c android/sco.c android/log.c android/avdtp.c android/avctp.h android/compat/readline/history.h android/compat/readline/readline.h
* a2dp-codecs: Define a2dp_vendor_codec_t struct in endian neutral wayPali Rohár2018-12-281-2/+4
| | | | | | And define new macros A2DP_GET_VENDOR_ID(), A2DP_GET_CODEC_ID() and A2DP_SET_VENDOR_ID_CODEC_ID() for easily filling a2dp_vendor_codec_t struct.
* android: Add missing fall through declarationMarcel Holtmann2017-07-111-0/+1
|
* android: Remove dead codeSzymon Janc2015-10-301-4/+1
| | | | | This removes dead code due to memory allocation with new0 not being able to fail.
* audio/avdtp: Fix resuming only the first SEIDLuiz Augusto von Dentz2015-08-111-1/+1
| | | | AVDTP_Start can contain several Stream Endpoing IDs to be resumed.
* audio/avdtp: Fix suspending only the first SEIDLuiz Augusto von Dentz2015-08-111-1/+1
| | | | AVDTP_Suspend can contain several Stream Endpoing IDs to be suspended.
* android/avdtp: Fix test /TP/SIG/SMG/BV-09-CLuiz Augusto von Dentz2015-03-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test /TP/SIG/SMG/BV-09-C frees the session after set_configuration is called causing the following backtrace: Invalid read of size 8 at 0x412B81: avdtp_sep_set_state (avdtp.c:846) by 0x413F3F: avdtp_set_configuration_resp (avdtp.c:2515) by 0x413F3F: avdtp_parse_resp (avdtp.c:2656) by 0x4159B7: session_cb (avdtp.c:2057) by 0x4E7E7FA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E7EB97: ??? (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E7EEC1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4189D1: tester_run (tester.c:831) by 0x40C8C7: main (test-avdtp.c:1392) Address 0x58572b8 is 8 bytes inside a block of size 64 free'd at 0x4C2ACE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E8450E: g_free (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4164B8: avdtp_unregister_sep (avdtp.c:3417) by 0x40CEA5: unregister_sep (test-avdtp.c:123) by 0x41704F: queue_remove_all (queue.c:387) by 0x4170B4: queue_destroy (queue.c:76) by 0x40CE54: destroy_context (test-avdtp.c:133) by 0x40CE54: context_quit (test-avdtp.c:145) by 0x40E74F: sep_setconf_cfm (test-avdtp.c:417) by 0x413F27: avdtp_set_configuration_resp (avdtp.c:2512) by 0x413F27: avdtp_parse_resp (avdtp.c:2656) by 0x4159B7: session_cb (avdtp.c:2057) by 0x4E7E7FA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E7EB97: ??? (in /usr/lib64/libglib-2.0.so.0.4200.2)
* android/avdtp: Fix test /TP/SIG/SMG/BI-19-CLuiz Augusto von Dentz2015-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Test /TP/SIG/SMG/BI-19-C was causing the following backtrace: Invalid write of size 4 at 0x415653: avdtp_parse_rej (avdtp.c:2801) by 0x415653: session_cb (avdtp.c:2067) by 0x4E7E7FA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E7EB97: ??? (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E7EEC1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4189D1: tester_run (tester.c:831) by 0x40C8C7: main (test-avdtp.c:1392) Address 0x5c75b60 is 96 bytes inside a block of size 104 free'd at 0x4C2ACE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E8450E: g_free (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4101F0: stream_free (avdtp.c:697) by 0x4E9C7FC: g_slist_foreach (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E9C81A: g_slist_free_full (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4106FF: avdtp_free (avdtp.c:974) by 0x4106FF: avdtp_unref (avdtp.c:1042) by 0x40CE18: destroy_context (test-avdtp.c:130) by 0x40CE18: context_quit (test-avdtp.c:145) by 0x40E38F: sep_start_cfm (test-avdtp.c:481) by 0x415652: avdtp_parse_rej (avdtp.c:2799) by 0x415652: session_cb (avdtp.c:2067) by 0x4E7E7FA: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E7EB97: ??? (in /usr/lib64/libglib-2.0.so.0.4200.2) by 0x4E7EEC1: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4200.2)
* android/avdtp: Fix crashes caused by re-entrant callsLuiz Augusto von Dentz2015-03-261-1/+15
| | | | | This make sure that while processing a PDU the session callbacks are not able to destroy the session causing crashes.
* android: Fix coding styleLuiz Augusto von Dentz2015-03-061-1/+0
|
* android: Remove unused fieldLuiz Augusto von Dentz2015-03-061-2/+0
| | | | struct avdtp_server is no longer needed.
* android/avdtp: Remove extra checkAndrei Emeltchenko2015-02-221-3/+0
|
* android/avdtp: Refactor local SEP list handlingAndrei Emeltchenko2015-02-221-36/+54
| | | | | | In order to deduplicate similar code in android/ and profiles/ we need to handle local SEP queue outside of avdtp.c. GSList is transformed to queue.
* android/avdtp: Fix registering SEP with wrong SEIDAndrei Emeltchenko2015-02-191-1/+5
| | | | Add seid check fixing registering too many SEPs
* android/avdtp: Fix SEID generationAndrei Emeltchenko2015-02-191-1/+4
| | | | | | | | | Fixes SEID generation for avdtp. Currently SEIDs were assigned assuming that SEID are registered and unregistered in the same order like: seid = g_slist_length(seps) + 1 which makes it possible to reuse similar SEIDs. Note that helper function allows maximum id of sizeof(int) * 8 which is smaller then MAX_SEID but more then enough for local SEPs.
* android: List all enum values in switchSzymon Janc2014-12-081-0/+3
| | | | As described in coding style M10.
* android/avdtp: Fix crash on disconnectSzymon Janc2014-09-261-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Last reference to session may be dropped while calling connection_lost so move watch ID clean before that. external/bluetooth/bluez/android/avdtp.c:session_cb() external/bluetooth/bluez/android/avdtp.c:avdtp_parse_resp() CLOSE request succeeded external/bluetooth/bluez/android/avdtp.c:avdtp_sep_set_state() stream state changed: OPEN -> CLOSING external/bluetooth/bluez/android/a2dp.c:sep_close_cfm() external/bluetooth/bluez/android/avdtp.c:avdtp_sep_set_state() stream state changed: CLOSING -> IDLE external/bluetooth/bluez/android/avdtp.c:session_cb() external/bluetooth/bluez/android/avdtp.c:connection_lost() Disconnected: I/O error (5) external/bluetooth/bluez/android/avdtp.c:avdtp_ref() 0x4a27fc8: ref=2 external/bluetooth/bluez/android/a2dp.c:bt_a2dp_notify_state() device 00:1E:DE:21:85:6A state 0 external/bluetooth/bluez/android/avrcp.c:bt_avrcp_disconnect() external/bluetooth/bluez/android/avctp.c:avctp_shutdown() AVCTP: closing uinput external/bluetooth/bluez/android/avrcp.c:disconnect_cb() external/bluetooth/bluez/android/avdtp.c:avdtp_unref() 0x4a27fc8: ref=1 external/bluetooth/bluez/android/avdtp.c:avdtp_unref() 0x4a27fc8: ref=0 external/bluetooth/bluez/android/avdtp.c:avdtp_free() 0x4a27fc8 ==1225== Invalid write of size 4 ==1225== at 0x11ABDE: session_cb (avdtp.c:2084) ==1225== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166) ==1225== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539) ==1225== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146) ==1225== by 0x48C3167: g_main_loop_run (gmain.c:3340) ==1225== by 0x10D379: main (main.c:628) ==1225== Address 0x4a27fdc is 20 bytes inside a block of size 1,104 free'd ==1225== at 0x4897E6C: free (in /system/lib/valgrind/ vgpreload_memcheck-arm-linux.so) ==1225== by 0x48C5E2B: g_free (gmem.c:252) ==1225== by 0x11ABDB: session_cb (avdtp.c:2082) ==1225== by 0x48BD9C7: g_io_unix_dispatch (giounix.c:166) ==1225== by 0x48C2CCB: g_main_context_dispatch (gmain.c:2539) ==1225== by 0x48C2ED9: g_main_context_iterate.isra.19 (gmain.c:3146) ==1225== by 0x48C3167: g_main_loop_run (gmain.c:3340) ==1225== by 0x10D379: main (main.c:628) ==1225==
* android/avdtp: Cleanup watch id when removing session watchSzymon Janc2014-08-291-1/+6
| | | | | | | | When session_cb returns FALSE respective watch id is removed so it must be cleanup. This fix following Glib warning when unrefing avdtp after transport was disconnected by remote: (process:28510): GLib-CRITICAL **: Source ID 2 was not found when attempting to remove it
* android/avdtp: Move PSM definition to AVDTP headerSzymon Janc2014-08-281-2/+0
|
* android/avdtp: Constify data in avdtp_service_cap_newSzymon Janc2014-08-281-1/+2
|
* android/a2dp: Fix for PTS testcaseLukasz Rymanowski2014-08-081-1/+2
| | | | | | This patch is a fix for PTS TC_SRC_REL_BV_01_I PTS expects us to CLOSE stream not to ABORT the stream when disconnecting A2DP.
* android/a2dp: Improve avdtp_close functionLukasz Rymanowski2014-08-081-3/+4
| | | | | With this patch avdtp_close does avdtp_abort under the hood in case stream is not yet in OPEN state.
* android/a2dp: Fix SEP selectionAndrzej Kaczmarek2014-05-301-0/+23
| | | | | | | | | | | When matching remote SEP to local SEP we do not match vendor codecs properly, i.e. neither vendor ID not codec ID are checked, which may cause wrong endpoint to be selected in case there are more that one endpoints using vendor codec on remote. This patch fixes this by assinging vendor codec indentification to local SEP after it's registered and uses this information when matching SEPs.
* android: Make multi-line comments style consistentSzymon Janc2014-04-291-2/+4
| | | | | Use common style for multi-line comments consistent with rest of codebase.
* android: Fix some random code style issuesSzymon Janc2014-03-201-1/+1
| | | | Fix whitespace problems and not needed empty lines.
* android/avdtp: Fix crash when DISCOVER failedAndrzej Kaczmarek2014-03-051-1/+2
| | | | | Discover callback is only set when avdtp_discover was successful so we need to check if it's set before calling.
* android/avdtp: Fix coding styleLuiz Augusto von Dentz2014-02-101-14/+23
| | | | Respect 80 columns limit.
* android/avdtp: Fix passing NULL pointer to memcpyAndrei Emeltchenko2014-02-101-1/+6
| | | | | | | | | The patch fixes following clang warning: ... profiles/audio/avdtp.c:3293:2: warning: Null pointer passed as an argument to a 'nonnull' parameter memcpy(cap->data, data, length); ^ ~~~~
* android/avdtp: Fix passing NULL pointer to memcpyAndrei Emeltchenko2014-02-101-2/+10
| | | | | | send_request can be called as send_request(session, FALSE, NULL, AVDTP_DISCOVER, NULL, 0) with NULL pointer which is passed to memcpy().
* android/a2dp: Shutdown AVDTP gracefullyAndrzej Kaczmarek2014-02-101-4/+17
| | | | | When shutting down AVDTP connection we first abort and wait for stream to go to idle state before disconnecting signalling channel.
* build: Fix make checkLuiz Augusto von Dentz2014-01-281-14/+18
| | | | Fix not checking for ENOTSOCK while setting priority.
* android/AVDTP: Make stream channel priority 5Luiz Augusto von Dentz2014-01-291-0/+9
| | | | | This makes channel priority 5 so it has higher priority than regular traffic but less than signalling channel.
* android/AVDTP: Make signalling channel priority 6Luiz Augusto von Dentz2014-01-291-1/+9
| | | | | | This makes signalling priority 6 so it can push commands before the stream channel, without this the stream channel may be schedule first and cause the signalling commands to timeout while waiting a slot.
* android: Use full include path for header filesMarcel Holtmann2014-01-251-1/+1
|
* android/AVDTP: Fix invalid free of struct discoverLuiz Augusto von Dentz2014-01-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | If callback releases the last reference it can cause the following: Invalid free() / delete / delete[] / realloc() at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x386244EF7E: g_free (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x410356: finalize_discovery (avdtp.c:933) by 0x414462: session_cb (avdtp.c:2555) by 0x38624492A5: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449627: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449A39: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x403A95: main (main.c:439) Address 0x4cf7af0 is 0 bytes inside a block of size 24 free'd at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x386244EF7E: g_free (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x410356: finalize_discovery (avdtp.c:933) by 0x4110BC: avdtp_unref (avdtp.c:1026) by 0x416491: a2dp_device_free (a2dp.c:122) by 0x4165DF: bt_a2dp_notify_state (a2dp.c:166) by 0x417170: discover_cb (a2dp.c:333) by 0x41034E: finalize_discovery (avdtp.c:931) by 0x414462: session_cb (avdtp.c:2555) by 0x38624492A5: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449627: ??? (in /usr/lib64/libglib-2.0.so.0.3800.2) by 0x3862449A39: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3800.2)
* android/AVDTP: Fix ignoring endpoint delay reportingLuiz Augusto von Dentz2013-12-231-1/+1
| | | | The code was setting TRUE ignoring what the caller set.
* android/AVDTP: Remove get_all parameter for get_capability callbackLuiz Augusto von Dentz2013-12-231-2/+2
| | | | | This is not necessary anymore since all delay reporting is now added automatically whenever supported.
* android/AVDTP: Fix rejecting DELAY_REPORT command while in OPEN stateLuiz Augusto von Dentz2013-12-231-2/+6
| | | | | This fixes rejection of DELAY_REPORT command while in OPEN state which is tested by /TP/SIG/SYN/BV-05-C.
* android/AVDTP: Fix not sending delay reporting capabilityLuiz Augusto von Dentz2013-12-231-0/+6
| | | | | If the SEP supports delay reporting and remote device request is GET_ALL add delay report capability.
* android/AVDTP: Duplicate fd passed to avdtp_newLuiz Augusto von Dentz2013-12-201-1/+8
| | | | | | | This use dup to create a new fd to be used by AVDTP session leaving the caller free to close the original fd. Note that even if the caller decides to keep the original fd it will still be notified when avdtp_shutdown is called since it uses shutdown.
* android/AVDTP: Add avdtp_shutdownLuiz Augusto von Dentz2013-12-201-0/+19
| | | | | avdtp_shutdown can be used to disconnect closing all existing stream properly.
* android/AVDTP: Add avdtp_add_disconnect_cb and avdtp_remove_disconnect_cbLuiz Augusto von Dentz2013-12-201-3/+58
| | | | | With these functions the user application can detect when the AVDTP has been disconnected and cleanup properly.
* android/AVDTP: Fix not removing start_timer sourceLuiz Augusto von Dentz2013-12-181-0/+3
| | | | | | | | It is possible that stream->start_timer can be set on stream_free which should then should take care of remove it properly otherwise it can trigger which would very likely cause a crash. Thanks to Hannu Mallat <hannu.mallat@jolla.com> for reporting it.
* android/AVDTP: Fix not calling callback if GET_CONFIGURATION is rejectedLuiz Augusto von Dentz2013-12-051-0/+9
| | | | | If GET_CONFIGURATION command is rejected and a callback exists it should be called with the reject error, this fixes test /TP/SIG/SMG/BI-10-C.
* android/AVDTP: Fix not calling callback if GET_CAPABILITIES is rejectedLuiz Augusto von Dentz2013-12-051-9/+7
| | | | | If GET_CAPABILITIES command is rejected and a callback exists it should be called with the reject error, this fixes test /TP/SIG/SMG/BI-04-C.
* android/AVDTP: Fix not calling callback if DISCOVER is rejectedLuiz Augusto von Dentz2013-12-051-0/+6
| | | | | If DISCOVER command is rejected and a callback exists it should be called with the reject error, this fixes test /TP/SIG/SMG/BI-01-C
* android/AVDTP: Strip dependenciesLuiz Augusto von Dentz2013-11-251-684/+73
| | | | | This strips AVDTP code of any dependency of core and btio to make it transport agnostic.
* android: Add copy of current AVDTP implementionLuiz Augusto von Dentz2013-11-251-0/+3867
These files are not added to any makefile on purpose because they still have external dependencies.