| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This adds initiator argument to service_accept so profiles accepting
the connection can use btd_service_is_initiator to determine if the
connection was initiated locally (central) or remotely (peripheral).
|
|
|
|
|
|
|
|
| |
Since BTD_SERVICE_STATE_CONNECTING is being used for both initiator and
responder case it is no longer possible to use the state distint when
the service connection was initiated locally or not, so to fix this a
new flag is introduce to track when btd_service_connect has been
called.
|
|
|
|
|
|
|
|
| |
This adds is_allowed property in btd_service. When is_allowed is set to
false, calling btd_service_connect and service_accept will fail and the
existing service connection gets disconnected.
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
|
|
|
|
|
|
| |
When policy_connect() is called, there might be a case where the
power is just turned off, hence the adapter is down. Add a check in
btd_service_connect to detect such condition.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
When DisconnectProfile is called with disconnected UUID, bluetooth daemon
often returned error "Operation already in progress". This change fixed it
and no error message is returned for this case.
|
|
|
|
|
|
| |
btd_service_set_user_data shall be allowed to be called when the state is
unavailable since device_probe is called with that state the callback
attempt to set its user_data.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
The accept calback may transit the state to connected on the call itself
since most of the time it is just a matter of selecting the attributes
in case of GATT profiles.
|
|
|
|
|
|
|
| |
If the profile don't implement .accept callback it means it cannot
connect in this mode, which is normally used for GATT profiles, so the
code shall not assume the service will start connecting and instead just
return an error.
|
|
|
|
|
|
|
|
|
|
| |
By ignoring case where service->state == BTD_SERVICE_STATE_DISCONNECTED
in btd_service_connecting_complete(), state_callbacks don't get
executed. Such case occurs when e.g., phone using a2dp-source profile
connects to the bluez. Because no state_callbacks are executed
(including one added by policy plugin) no reconnection is attempted
after connection timeout, although if situation is reversed (bluez
connects to the phone) reconnection works.
|
|
|
|
|
| |
If the profile(s) is already connected don't reply with an error, if the
profile is in fact connecting already just wait until it completes.
|
| |
|
|
|
|
|
|
|
|
| |
When initiating a connection to a external profile btd_service_connect
will be called which will change the service state to
BTD_SERVICE_STATE_CONNECTING but then once the connection completes
service_accept is called but since it now checks the state it would
return -EALREADY to prevent driver accept to be called more than once.
|
|
|
|
| |
service_accept shall not call driver .accept callback multiple times.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following crash happen when attempting to remove a device while it
is connecting, this will turn all services to unavailable without first
setting it to disconnected causing the backtrace:
Invalid read of size 8
at 0x495BF8: btd_service_connect (service.c:200)
by 0x49D942: connect_next.isra.7 (device.c:1283)
by 0x4A2B82: device_profile_connected (device.c:1328)
by 0x4A2B82: service_state_changed (device.c:5325)
by 0x4957A9: change_state (service.c:108)
by 0x495AF4: service_remove (service.c:173)
by 0x4A4BD9: device_remove (device.c:3207)
by 0x48AAC1: btd_adapter_remove_device (adapter.c:1135)
by 0x48B536: remove_device (adapter.c:2270)
by 0x4BF4CB: process_message.isra.3 (object.c:259)
by 0x4BFD12: generic_message (object.c:1070)
by 0x518C5CE: ??? (in /usr/lib64/libdbus-1.so.3.8.10)
by 0x517E193: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.8.10)
Address 0x7a22e60 is 16 bytes inside a block of size 40 free'd
at 0x4C2ACE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4E847FE: g_free (in /usr/lib64/libglib-2.0.so.0.4200.1)
by 0x495988: btd_service_unref (service.c:130)
by 0x495B26: service_remove (service.c:177)
by 0x4A4BD9: device_remove (device.c:3207)
by 0x48AAC1: btd_adapter_remove_device (adapter.c:1135)
by 0x48B536: remove_device (adapter.c:2270)
by 0x4BF4CB: process_message.isra.3 (object.c:259)
by 0x4BFD12: generic_message (object.c:1070)
by 0x518C5CE: ??? (in /usr/lib64/libdbus-1.so.3.8.10)
by 0x517E193: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.8.10)
by 0x4BA45F: message_dispatch (mainloop.c:72)
|
|
|
|
|
| |
This patch reverts the recent addition of GATT service handles to
btd_service.
|
|
|
|
|
|
|
|
|
| |
This patch introduces the "accept" function to btd_profile. The purpose
of this function is to notify a profile when a btd_service is ready to
interact with and will be called by btd_device when a bt_gatt_client
becomes ready (MTU exchange and discovery has been completed). This is
initially meant to be optional for non-GATT based profiles but could be
generalized for them in the future.
|
|
|
|
|
|
|
|
|
|
| |
When GATT services are discovered, added, and removed, profiles will
be notified using btd_profile device_probe and device_remove functions.
Since a single profile may handle multiple services from the same
device, it is useful to distinguish each btd_service by its service
handle range. This patch adds the start_handle and end_handle fields to
btd_service and an accessor for getting them, which reports failure if
the service was initialized without handles.
|
|
|
|
|
|
| |
If .connect fails and the service state changes it may re-enter
connect_next, inverting the order and messing up the error of each
connect request.
|
|
|
|
|
|
| |
This rename service_shutdown to service_remove to make it more similar to
other internal APIs such as device_remove which only do object
cleanup/free and do not have any disconnect logic.
|
|
|
|
|
| |
Device.Disconnect should be able to interrupt the connection attempt
started by Device.Connect.
|
|
|
|
|
| |
Use plain int instead of gint. In glib gint is always a typedef to int,
so it's safe to use it even for callbacks with glib.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the btd_profile connect/disconnect callbacks to receive a
btd_service pointer. This should make it possible to handle multiple
instances of the same profile in a specific device.
The patch strongly influences how the profiles should interact with the
core. The state transitions, previously reported using the device.h API
(device_profile_connected() and device_profile_disconnected()), have
now been replaced by the btd_service API.
The transitions will then be propagated to device.c by means of the
conventional state-changed callback mechanism.
|
|
|
|
| |
Extend the btd_service API to support state observers.
|
|
|
|
|
| |
The error-code represents the result of a connection/disconnection
procedure and can be useful when a state transition is detected.
|
|
|
|
|
| |
Profile implementations can benefit from a user_data associated to a
service, which will typically be set during probe.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change the profile probe mechanism in order to pass the btd_service
instance representing the remote service. This object is bound to a
btd_profile and a btd_device, thus replacing the previous parameters.
The probe callback is allowed to hold a reference to the btd_service
by means of btd_service_ref(), which should be unreferenced during
removal.
Keeping such a reference of the btd_service allows supporting multiple
instances of the same UUID, since the reference can serve as a handle
during the interactions between the profile implementation and the core.
|
|
|
|
|
| |
Add a state to btd_service in order to distinguish which operations are
allowed in a certain point in time.
|
|
|
|
|
| |
Make use of the btd_profile connect/disconnect callbacks directly within
service.c instead of doing it inside device.c.
|
|
|
|
|
| |
Make use of the btd_profile callbacks directly within service.c instead
of doing it inside device.c.
|
|
Add a new object to centralize all data corresponding to a service
provided by a remote device, coupling a pair of btd_profile and
btd_device pointers.
|