summaryrefslogtreecommitdiff
path: root/src/profile.c
Commit message (Collapse)AuthorAgeFilesLines
* profile: Add support for experimental flagLuiz Augusto von Dentz2023-05-151-0/+6
| | | | | This adds experimental field to btd_profile so the plugin can indicate drivers that depends on experimental to be enabled.
* core: block not allowed UUID connect in authYun-Hao Chung2021-08-041-0/+11
| | | | | | | | | | This ensures any incoming profile connection will be blocked if its UUID is not allowed by the following assumption: 1. Each system profile asks adapter authorization when seeing a incoming connection. 2. Each external profile checks if its UUID is allowed by adapter when seeing a incoming connection.
* profile: Fail RegisterProfile if UUID already existsJoão Paulo Rechi Vita2021-07-011-0/+30
| | | | | | | | | | | | | | | | If a process tries to register a profile implementation that is already registered, RegisterProfile should fail. This should help address issues when two instances of PulseAudio are running at the same time, and the second instance tries to register an audio profile implementation that has already been registered by the first instance. Two situations where this may happen is when more than one user is logged in, or during the transition between the GDM session and the user session, when PulseAudio gets started on the new session before the old session has been fully terminated. https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/303 https://gitlab.gnome.org/GNOME/gdm/-/issues/486
* src: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- LGPL-2.1-or-later : 62 GPL-2.0-or-later : 51 BSD-2-Clause : 2 License: LGPL-2.1-or-later src/adv_monitor.c src/adv_monitor.h src/shared/mainloop-glib.c src/shared/btp.c src/shared/tester.c src/shared/btsnoop.c src/shared/gatt-helpers.h src/shared/log.h src/shared/util.h src/shared/mainloop-ell.c src/shared/hci-crypto.c src/shared/mainloop.c src/shared/hfp.h src/shared/mainloop-notify.c src/shared/io-mainloop.c src/shared/btsnoop.h src/shared/uhid.h src/shared/util.c src/shared/ringbuf.c src/shared/btp.h src/shared/shell.h src/shared/io-glib.c src/shared/queue.h src/shared/gatt-server.h src/shared/crypto.c src/shared/crypto.h src/shared/io-ell.c src/shared/timeout-glib.c src/shared/mgmt.c src/shared/gatt-db.c src/shared/mainloop-notify.h src/shared/hfp.c src/shared/timeout-ell.c src/shared/shell.c src/shared/hci.c src/shared/log.c src/shared/ringbuf.h src/shared/gatt-helpers.c src/shared/queue.c src/shared/tty.h src/shared/timeout-mainloop.c src/shared/tester.h src/shared/gap.h src/shared/mgmt.h src/shared/gatt-db.h src/shared/uhid.c src/shared/mainloop.h src/shared/timeout.h src/shared/att-types.h src/shared/pcap.c src/shared/gap.c src/shared/att.c src/shared/pcap.h src/shared/hci.h src/shared/gatt-client.h src/shared/io.h src/shared/gatt-client.c src/shared/ad.c src/shared/att.h src/shared/gatt-server.c src/shared/hci-crypto.h src/shared/ad.h License: GPL-2.0-or-later src/attrib-server.h src/advertising.h src/textfile.c src/attrib-server.c src/uinput.h src/log.h src/eir.h src/sdpd.h src/sdpd-request.c src/service.h src/sdpd-database.c src/adapter.h src/plugin.h src/uuid-helper.h src/plugin.c src/main.c src/sdp-xml.c src/error.h src/oui.c src/device.c src/agent.h src/sdp-client.c src/oui.h src/device.h src/gatt-database.c src/error.c src/backtrace.c src/sdpd-server.c src/adapter.c src/log.c src/agent.c src/backtrace.h src/sdp-xml.h src/hcid.h src/dbus-common.h src/uuid-helper.c src/storage.c src/profile.c src/advertising.c src/storage.h src/dbus-common.c src/profile.h src/sdpd-service.c src/eir.c src/sdp-client.h src/gatt-database.h src/gatt-client.h src/rfkill.c src/gatt-client.c src/service.c src/textfile.h License: BSD-2-Clause src/shared/ecc.h src/shared/ecc.c
* profile: Fix reporting error message when connection failedPali Rohár2020-04-221-2/+3
| | | | | | | | | | | | | | | | | | | | | | Some bluetooth headsets do not support connecting more then one bluetooth profile (e.g. in parallel A2DP and HSP, or HSP and HFP) and issuing connect() syscall for second profile returns just ECONNREFUSED. Prior this patch bluetooth daemon for such situation reported following message to log: Unable to get connect data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107) Message is incorrect as connect() syscall failed, not getpeername(). This patch fixes this problem and logs correct error message: Headset Voice gateway failed connect to XX:XX:XX:XX:XX:XX: Connection refused (111) Main problem was in ext_connect() function which called bt_io_get() for retrieving remote address (BT_IO_OPT_DEST) and if it failed then original error from connect() syscall was masked. Because it is not possible to retrieve BT_IO_OPT_DEST for unconnected socket, original destination address for error message is propagated via connect_add() function in btio.
* profile: Return -ENOENT for HSP AGLuiz Augusto von Dentz2020-04-141-1/+1
| | | | HSP AG role doesn't have any supported features.
* profile: Add default SDP record for Headset role of HSP 1.2Pali Rohár2020-04-131-0/+63
| | | | This would allow D-Bus agents to implement HS role of HSP profile.
* profile: Export Remote Audio Volume Control SDP valuePali Rohár2020-04-131-2/+14
| | | | | | | | | | | | Remote Audio Volume Control property in SDP record for HSP HS role indicates if device supports volume control. It is required for D-Bus agents which implements audio part of HSP profile to know if remote device supports volume control or not. With this change bluez exports status of this SDP property via firt bit in Features entry in NewConnection() DBus callback method, like for HFP profile.
* profile: Remove duplicate initialization of version and profileLuiz Augusto von Dentz2020-04-131-3/+0
| | | | These values are always set later by send_new_connection.
* profile: Fix not setting default features for HFP 1.7Pali Rohár2020-04-131-6/+14
| | | | | When HFP AG features are not set then according to HFP 1.7.2 specification it has value 0b001001.
* build: Move declaration of _GNU_SOURCE back into individual source filesMarcel Holtmann2018-12-061-0/+1
|
* src/profile: Updates HFP version to 1.7Ankit Navik2018-05-161-2/+2
| | | | | | Add changes to update HFP version to 0x0107 for HFP_HS_UUID and HFP_AG_UUID. Ofono get this version from bluez and enable HFP 1.7 specific commands.
* core/profile: Fix calling service_acceptLuiz Augusto von Dentz2016-10-241-1/+1
| | | | | | service_accept shall only be used with profiles that implement .accept callback, to set connecting state directly use service_set_connecting which does not require .accept to be implemented.
* profile: Fix accepting connections without an associated serviceJohan Hedberg2016-05-241-4/+5
| | | | | | | | | | This fixes the flawed logic from the following commit: commit b669604f43bbbf04ebaa66dd14ad9cfb005e561b Author: Hsin-Yu Chao <hychao@chromium.org> Date: Fri Apr 24 10:36:09 2015 -0700 src/profile: Set service to connecting in ext_connect
* core/profile: Fix possible crash when registering profilesLuiz Augusto von Dentz2015-11-081-12/+2
| | | | | | Profiles under ext_profiles are local and should no be mixed with other external profiles since its type is different which can may cause invalid memory when accessing member of ext_profile struct.
* src/profile: Fix segmentation faultVinicius Costa Gomes2015-10-191-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The change that made the 'deviceinfo' profile "external" had an side effect, now it is possible to have an external profile without 'owner' and 'path' information. The fix considers that having an external profile without that information is not an error. Valgrind log: bluetoothd[9974]: src/adapter.c:adapter_service_insert() /org/bluez/hci0 bluetoothd[9974]: src/adapter.c:add_uuid() sending add uuid command for index 0 bluetoothd[9974]: Endpoint registered: sender=:1.38 path=/MediaEndpoint/A2DPSink bluetoothd[9974]: src/profile.c:register_profile() sender :1.38 path /Profile/HSPAGProfile ==9974== Invalid read of size 1 ==9974== at 0x65F21E0: __strcmp_sse2_unaligned (in /usr/x86_64-pc-linux-gnu/lib/libc-2.22.so) ==9974== by 0x4E6C7E8: g_str_equal (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x467917: find_ext_profile (profile.c:745) ==9974== by 0x469A8D: register_profile (profile.c:2373) ==9974== by 0x4889C3: process_message.isra.5 (object.c:259) ==9974== by 0x518E33E: _dbus_object_tree_dispatch_and_unlock (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3) ==9974== by 0x51805E3: dbus_connection_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3) ==9974== by 0x4856DF: message_dispatch (mainloop.c:72) ==9974== by 0x4E7C669: g_main_context_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x4E7C9E7: g_main_context_iterate.isra.29 (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x4E7CD01: g_main_loop_run (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x40BABE: main (main.c:661) ==9974== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==9974== ==9974== ==9974== Process terminating with default action of signal 11 (SIGSEGV) ==9974== Access not within mapped region at address 0x0 ==9974== at 0x65F21E0: __strcmp_sse2_unaligned (in /usr/x86_64-pc-linux-gnu/lib/libc-2.22.so) ==9974== by 0x4E6C7E8: g_str_equal (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x467917: find_ext_profile (profile.c:745) ==9974== by 0x469A8D: register_profile (profile.c:2373) ==9974== by 0x4889C3: process_message.isra.5 (object.c:259) ==9974== by 0x518E33E: _dbus_object_tree_dispatch_and_unlock (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3) ==9974== by 0x51805E3: dbus_connection_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libdbus-1.so.3.14.3) ==9974== by 0x4856DF: message_dispatch (mainloop.c:72) ==9974== by 0x4E7C669: g_main_context_dispatch (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x4E7C9E7: g_main_context_iterate.isra.29 (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x4E7CD01: g_main_loop_run (in /usr/x86_64-pc-linux-gnu/lib/libglib-2.0.so.0.4600.1) ==9974== by 0x40BABE: main (main.c:661) ==9974== If you believe this happened as a result of a stack ==9974== overflow in your program's main thread (unlikely but ==9974== possible), you can try to increase the size of the ==9974== main thread stack using the --main-stacksize= flag. ==9974== The main thread stack size used in this run was 8388608. ==9974==
* core/gatt: Cleanup service probeLuiz Augusto von Dentz2015-09-031-2/+9
| | | | | | | | | | | | This cleanup code related to service probe making it use a single function, because of that now all driver must implement device_probe in order for the service probe to work properly. In addition to that a new flag called external was introduced to btd_profile to be possible to distinguish whether it is a internal plugin or external client, this was needed in order to decide if an attribute should be claimed which whould prevent it to be exported over D-Bus.
* src/profile: Add GoepL2CapPsm in SDP recordGowtham Anandha Babu2015-08-101-7/+31
| | | | | | | | | | As per the MAP & PBAP v1.2 SDP table, it should contain the GoepL2CapPsm in its SDP record. This patch adds the same. The below test cases verifies the presence of GoepL2CapPsm attribute is in SDP record. TC_PSE_CON_BV_02_C - PASS TC_MSE_CON_BV_02_C - PASS
* core/profiles: Fix not handling disconnections properlyLuiz Augusto von Dentz2015-07-071-2/+7
| | | | | | If a profiles disconnects while in connecting state but ext_connect has already been called the state is never updated since ext_io_disconnected always calls btd_service_disconnecting_complete.
* src/profile: Set service to connecting in ext_connectHsin-Yu Chao2015-04-271-2/+4
| | | | | | | | | | | | | | | | | | | For the profile connection initiated by remote device, ext_connect() function is triggered without advance the state of device's service to BTD_SERVICE_STATE_CONNECTING. This is causing a problems when the later 'NewConnection' dbus method call is made to registered application. If the remote device gets disconnected during the period of time waiting for the reply of 'NewConnection' method, the btd_service_disconnect() call will fail at the service state check and never handle the profile disconnection due to that state was incorrectly left as BTD_SERVICE_STATE_DISCONNECTED. Fix the problem by use service_accept() call in ext_connect() to assure the service state has changed. Also modify the logic of service state check in btd_service_connecting_complete() to prevent the problem when the 'NewConnect' reply changes service state to BTD_SERVICE_STATE_CONNECTED while the device has already disconnected before it arrives.
* core: Use local libbluetooth includesMarcel Holtmann2015-02-281-5/+6
|
* core/profiles: Update PCE record versionLuiz Augusto von Dentz2014-12-021-1/+1
| | | | This updates PCE record version to 1.2
* core: Fix error not returned if service is not supportedJaganath Kanakkassery2014-11-261-0/+3
| | | | | | Without this patch, error will not be returned if remote device does not support the service and hence application will never get any response for the connect request
* src/profile: Add HSP default record for external profilesRakesh M K2014-11-261-0/+47
|
* src/profile: Add pbapsupportedfeatures to PSEGowtham Anandha Babu2014-11-121-0/+3
| | | | | | | Add PbapSupportedFeatures(0x0317) to PSE Record. PTS Test case passed: TP/SSM/BV-11-C [PSE Shares PbapSupportedFeatures bits].
* src/profile: Add feature bits to MAS SDP recordGowtham Anandha Babu2014-10-221-0/+3
| | | | | | | | | Add MAP supported features bits to MAS SDP record as per the MAP 1.2 specs section 7.1.1. Fix the PTS 5.3 test-cases: TC_MSE_MFB_BV_02_I TC_MSE_MFB_BV_05_I
* core: Remove unneeded assignmentAndrei Emeltchenko2014-08-011-1/+0
| | | | Variable rfcomm is never used after assignment
* core: Remove dead codeAndrei Emeltchenko2014-07-041-4/+0
| | | | rfcomm can only be NULL in this path
* core/profile: Fix regression when registering for client onlyLuiz Augusto von Dentz2014-04-221-1/+1
| | | | | | | | | | | | This got introduced with PCE that register a record for PBAP client, but it end up causing a regression where all profiles that have records would be probed as if server was enabled as well. Note that is was possible to register PBAP client with PCE record, in that case Role option should be omitted so both server and client role are enabled by default which does not affect PBAP server component since it uses a different UUID, in fact the correct form to add PCE record is probably to register as server only.
* core: Minor coding style fixJohan Hedberg2014-03-271-2/+4
|
* core/profile: Fix failing to accept connections without a serviceLuiz Augusto von Dentz2014-03-271-9/+31
| | | | | | For incoming connections it is not mandatory to have a service since the profile may be a server only (enable_client is false) therefore it does not need to track connection status.
* core: Update btd_adapter_find_device to also match the address typeJohan Hedberg2014-03-221-1/+1
| | | | This is necessary to do accurate matching for LE devices.
* core/profile: Add MapSupportedFeatures to MSN recordLuiz Augusto von Dentz2014-03-211-0/+3
| | | | | This add MapSupportedFeatures and set it to support everything including instance information and extended event report.
* core/profile: Remove code for waiting services to be resolvedLuiz Augusto von Dentz2014-03-201-56/+0
| | | | | This remove code related to waiting service to be resolved as it is now part of btd_request_authorization.
* core: Don't use GLib allocators for bt_uuid2string and bt_name2stringJohan Hedberg2014-01-211-11/+11
|
* Rename glib-helper to uuid-helperJohan Hedberg2014-01-211-1/+1
|
* core: Add flags parameter to bt_search_serviceSzymon Janc2014-01-201-1/+1
| | | | This allows to pass custom SDP flags to sdp_connect.
* Rename adapter_find_device to btd_adapter_find_deviceSzymon Janc2013-11-271-1/+1
| | | | Allow this symbol to be exported and usable from external plugins.
* Rename adapter_get_address to btd_adapter_get_addressSzymon Janc2013-11-271-6/+6
| | | | Allow this symbol to be exported and usable from external plugins.
* profile: Add missing browse group to MAS, MNS and SYNC recordsSzymon Janc2013-11-191-0/+15
| | | | This fix not updating UUIDs when those services are registered.
* core/profile: Fix MNS record versionLuiz Augusto von Dentz2013-10-091-1/+2
| | | | | | To be able to use OBEX over L2CAP the version number should be at least 0x102, in addition to that ERTM mode should be used to comply to GOEP 2.0.
* adapter: Handle removing of SDP recordsSzymon Janc2013-09-231-1/+1
| | | | | Make adapter in charge of updating SDP database. This allow to decouple SDP of code used for notifying adapters about SDP database change.
* adapter: Handle adding new SDP recordsSzymon Janc2013-09-231-4/+3
| | | | | Make adapter in charge of updating SDP database. This allow to decouple SDP of code used for notifying adapters about SDP database change.
* profile: Remove support for Cancel methodDenis Kenzior2013-09-111-18/+0
|
* core: Make use of g_dbus_send_message_with_replyLuiz Augusto von Dentz2013-09-091-2/+2
| | | | | This replaces dbus_connection_send_with_reply with g_dbus_send_message_with_reply which does not alter message order.
* core: Fix error message in profile ext_auth functionFrederic Danis2013-08-011-1/+1
|
* core: Fix default authorize value for external profilesMartin Xu2013-07-171-0/+13
| | | | | | | | Previously the value of "authorize" was essentially ignored in the settings table. This wasn't very noticeable since almost all profiles use the default true value. Since the default value of "authorize" is true it cannot be left out from the default settings table entries (leaving it out would set it implicitly to false).
* core: Add mode option to external profile default configurationLuiz Augusto von Dentz2013-06-241-0/+9
| | | | | Some external profiles, FTP and OPP, require a different L2CAP mode such as ERTM to interoperate properly.
* profile: Fix incoming connections without SDP recordChristian Fetzer2013-05-221-0/+1
| | | | | | | After commit 7bd3626b6715ac6a117d56b95b455960f7cf34de, incoming connections require the service being available from SDP. This is not always guaranteed because some services might not be listed in SDP (like MNS).
* profile: Error-cases for incoming connectionsMikel Astiz2013-05-081-11/+23
| | | | | When an incoming connection attempt is received, if the corresponding device or service is not found, handle the error-case.