| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
Without this patch it is possible to enter infinite loop when
searching included services on remote device. This patch fixes that.
Issue happens when remote device replies with ending handle which is
lower than start handle we use for search
|
|
|
|
|
|
|
|
| |
Without this patch it is possible to enter infinite loop when
searching descriptors on remote device. This patch fixes that.
Issue happens when remote device replies with ending handle which is
lower than start handle we use for search.
|
|
|
|
| |
This is needed for next patch
|
|
|
|
|
|
|
|
|
|
|
| |
Without this patch it is possible to enter infinite loop when searching
characteristics on remote device.
This patch fixes that.
Issue happens when remote device replies with ending handle which is
lower than start handle we use for search.
Found on robustness session on UPF50
|
|
|
|
| |
This will be needed by next patch
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this it is possible to put BlueZ into infinite loop when
doing primary service search on remote device.
Issue happens when remote device replies with ending handle which is
lower than start handle we use for search.
This patch fixes that
Found on robustness session on UPF50
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds means to reuse ATT request id for GATT operations
which might need more then one ATT request for complete GATT operation.
E.g discover primary\included services and discover
characteristics/descriptors
This is needed for the user of gattib, to make sure that ATT request id he
holds is valid during whole GATT operation.
So far, it could happen that gattrib did additional ATT request without
user knowledge which leads to situation that user had outdated ATT
request id.
Note that request id is used by the user for canceling request.
|
| |
|
|
|
|
|
| |
This patch makes sure that attrib instance will not disappear while
reading characteristic
|
|
|
|
|
| |
Discover all attributes in given range. In same cases we ommited
last attribute in range.
|
|
|
|
|
|
|
| |
As per spec (BT spec 4.1 Vol[3], Part F, chapter 3.4.5.4) we need to
take opcode, handle and parameters to generate signature.
In order to support it signing is moved to att.c, place where pdu is
encoded
|
| |
|
|
|
|
|
| |
This function is no longer used since all code is changed to use
gatt_discover_desc instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds gatt_discover_desc() function which performs descriptor
discovery in a manner similar to gatt_discover_char(), i.e. it does
complete discovery procedure and returns list of descriptors found when
finished. For 16-bit UUIDs in addition to string UUID, short UUID is
provided.
It's also possible to specify single descriptor UUID to look for and
discovery procedure is interrupted as soon as UUID is found. This way
no more than one descriptor is returned which is useful when searching
for common descriptors like CCC.
|
|
|
|
| |
This is needed to cover Android API
|
|
|
|
|
| |
Android expose to application api for reliable write. Therefore we need
to add this support to gattrib
|
|
|
|
|
| |
According to Core SPEC, attribute data list must be grouped in elements
of the same size.
|
|
|
|
| |
Source buffer for write operations should be immutable.
|
| |
|
|
|
|
|
|
| |
GATT/ATT use little-endian byte order format for 128-bit UUID. No matter
the system byte order representation, internally the core will handle
128-bit UUID on big-endian format.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Use standard C types instead of GLib ones (which are unnecessary here)
and move the "status" parameter to the first position, so it is
consistent with other callbacks.
|
|
|
|
| |
This makes it easy to identify where variables are being used.
|
|
|
|
|
| |
All parameters can be retrieved from struct write_long_data fields,
therefore there is no need to pass them separately.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, if no callback was given to gatt_write_char(), it was
assumed that a "Write Without Response" (which uses Write Command)
should be used instead of Write Request.
This "shortcut" is unnecessary (there is gatt_write_cmd() for the
situations where Write Without Response is required) and just duplicates
code.
This commit also fixes the few places where gatt_write_cmd() should be
used.
|
|
|
|
|
|
| |
The old name referred to the underlying ATT PDU (Find Information
Request and Find Information Response) and not to the actual GATT
procedure (Discover All Characteristic Descriptors).
|
| |
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
g_atomic_* end up using G_STATIC_ASSERT, causing gcc 4.8 to yell due to
-Wunused-local-typedefs.
/usr/include/glib-2.0/glib/gmacros.h:162:53: error: typedef ‘_GStaticAssertCompileTimeAssertion_2’ locally defined but not used [-Werror=unused-local-typedefs]
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1]
Most of the uses of atomic operations were wrong. They were fixed as
well. If we are using atomic operations, reading the variable again
later for logging is not an option, we should use the return of the
atomic function used to fetch the variable.
|
|
|
|
|
| |
If memory allocation fails, ATT_ECODE_INSUFF_RESOURCES should be
reported to the callback.
|
| |
|
|
|
|
|
| |
If g_try_new0() fails due to low memory condition, "list" should be
freed before returning from primary_all_cb().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When doing the Find Included Services GATT procedure, the status of the ATT
procedure was being ignored, and in the case of a timeout it is possible to
crash bluetooth with an invalid memory access.
Valgrind log:
==1755== Invalid read of size 8
==1755== at 0x46971A: find_included_cb (device.c:2964)
==1755== by 0x4465AE: isd_unref (gatt.c:92)
==1755== by 0x446885: find_included_cb (gatt.c:425)
==1755== by 0x448266: disconnect_timeout (gattrib.c:269)
==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x40A2EE: main (main.c:583)
==1755== Address 0x69530a8 is 8 bytes inside a block of size 64 free'd
==1755== at 0x4C2874F: free (vg_replace_malloc.c:446)
==1755== by 0x40BFA6: service_filter (watch.c:486)
==1755== by 0x40BC6A: message_filter (watch.c:554)
==1755== by 0x5160A1D: dbus_connection_dispatch (in /usr/lib64/libdbus-1.so.3.7.2)
==1755== by 0x40AAB7: message_dispatch (mainloop.c:76)
==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x40A2EE: main (main.c:583)
==1755==
==1755== Invalid read of size 8
==1755== at 0x4486D5: g_attrib_get_buffer (gattrib.c:657)
==1755== by 0x4467C5: find_included (gatt.c:363)
==1755== by 0x4465AE: isd_unref (gatt.c:92)
==1755== by 0x446885: find_included_cb (gatt.c:425)
==1755== by 0x448266: disconnect_timeout (gattrib.c:269)
==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x40A2EE: main (main.c:583)
==1755== Address 0x18 is not stack'd, malloc'd or (recently) free'd
==1755==
==1755==
==1755== Process terminating with default action of signal 11 (SIGSEGV)
==1755== Access not within mapped region at address 0x18
==1755== at 0x4486D5: g_attrib_get_buffer (gattrib.c:657)
==1755== by 0x4467C5: find_included (gatt.c:363)
==1755== by 0x4465AE: isd_unref (gatt.c:92)
==1755== by 0x446885: find_included_cb (gatt.c:425)
==1755== by 0x448266: disconnect_timeout (gattrib.c:269)
==1755== by 0x4E76BCA: g_timeout_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76044: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76377: g_main_context_iterate.isra.24 (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x4E76771: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.3400.2)
==1755== by 0x40A2EE: main (main.c:583)
|
|
|
|
| |
These headers are not public anymore, so need to use "lib/uuid.h".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 8a03376544b046a84301847d1594f6c3674983ff.
The patch needs to be split up and the gdbus/ changes were bogus
compared to the original commit message.
Conflicts:
Makefile.am
Makefile.obexd
profiles/cyclingspeed/cyclingspeed.c
profiles/heartrate/heartrate.c
src/error.c
|
|
|
|
|
|
|
|
|
|
| |
Instead of trying to include config.h in each file over the tree and
possibly forgetting to include it, give a "-include config.h" argument
to the compiler so it's guaranteed that a) it will be included for all
source files and b) it will be the first header included.
gdbus/ directory is left out, since it would break other projects using
it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the Discover Characteristics by UUID sub-procedure, if a fetched
characteristic doesn't matches with the target UUID, all others
characteristics in that response were discarded.
Because of this, the procedure will make a new request to possibly
rediscover the characteristics in the range beyond this last
characteristic.
At present, this procedure works because the gatt library will send a
Read by Type Request starting at the first attribute after the non
matching characteristic.
This commit makes the rest of the characteristics to be checked for a
matching type, which should reduce the number of requests sent during
the discovery of characteristics.
|
|
|
|
|
|
|
|
|
| |
If the Discover Characteristics by UUID sub-procedure has been
executed and the first characteristic is not the target, a memory
leak occurs.
This commit fixes this leak by postponing the allocation to after
the UUID verification.
|
|
|
|
|
|
| |
In all uses of g_attrib_send() the opcode of the command/event is
already clear because of the att.h functions used to build the ATT
PDU.
|
|
|
|
|
|
|
|
| |
Some services like HID over LE can reference another service using
included services.
See Vol 3, Part G, section 2.6.3 of Core specification for more
details.
|
|
|
|
|
|
| |
The Core spec allows to implement Read Long Characteristic Value as a
Read Request, followed by zero or more Read Blob Requests, therefore the
offset parameter is unnecessary and is always 0 for normal use.
|
|
|
|
|
|
|
| |
This patch avoids raising errors to the upper layer if at least one
characteristic declaration has been found. According to the Core SPEC
Characteristic declarations shall be read without authentication or
authorization.
|