Commit Graph

24134 Commits

Author SHA1 Message Date
Marcel Holtmann
2954f7072d build: Don't install btconfig utility just yet 2017-09-14 11:32:43 +02:00
Marcel Holtmann
5dfcfc4d1f build: Update library version 2017-09-14 10:27:17 +02:00
ERAMOTO Masaya
a5ceed91fb client: Fix default_ctrl change when new adapter is found
Since 4e111f3448, when another adapter is
found, the default adapter would be changed, which is not expected.
Default adapter can only be changed by select command.
2017-09-14 11:22:28 +03:00
Tomasz Duszynski
b7742ccc1f test/example-advertisement: add LocalName to properties
Since local name in advertisement is useful for telling the difference
between devices expose LocalName via properties.
2017-09-14 11:22:27 +03:00
Brian Gix
2b3be1c2e7 Rename sample JSON Databases 2017-09-14 11:22:27 +03:00
Luiz Augusto von Dentz
125a2e237e a2dp: Fix possible crash when accepting stream transport
During the course of bt_io_accept the setup can be freed causing the
callback to be called which can lead to the following crash:

bluetoothd[853]: profiles/audio/a2dp.c:setup_unref() 0x8183c1c0: ref=0
bluetoothd[853]: profiles/audio/a2dp.c:setup_free() 0x8183c1c0
...
bluetoothd[853]: HUP or ERR on socket: Connection reset by peer (104)
bluetoothd[853]: profiles/audio/a2dp.c:setup_unref() 0x8183c1c0: ref=-80438434
bluetoothd[853]: profiles/audio/a2dp.c:setup_free() 0x8183c1c0

0  0x80106888 in stream_free ()
1  0xb7621d49 in g_slist_foreach () from /usr/lib/libglib-2.0.so.0
2  0xb7621d92 in g_slist_free_full () from /usr/lib/libglib-2.0.so.0
3  0x80107d09 in avdtp_unref ()
4  0x8010273b in setup_unref ()
5  0x80104c54 in transport_cb ()
6  0x80136a9c in accept_cb ()
2017-09-14 11:22:25 +03:00
Luiz Augusto von Dentz
a446569b86 mesh: Add 'security' command
This adds 'security' command which can be used to display and change
the provision security level:

[meshctl]# security
Provision Security Level set to 1 (medium)
[meshctl]# security 2
Provision Security Level set to 2 (high)

Note: This doesn't change the default which is still medium.
2017-09-14 11:22:24 +03:00
Luiz Augusto von Dentz
9e009647b1 sdp: Fix Out-of-bounds heap read in service_search_attr_req function
Check if there is enough data to continue otherwise return an error.
2017-09-13 09:05:51 +02:00
Inga Stotland
660081ce5a mesh: Use correct length for config server response
Also check if the length is nonzero before sending response
2017-09-11 16:02:12 +03:00
Inga Stotland
9c2c9d3c71 mesh: Add characteristic property name check
If PropertyChanged signal is not emitted due to a change in
characteristic's "Value" property, the characteristic does
not need to be processed.
2017-09-11 16:02:12 +03:00
Luiz Augusto von Dentz
ed63d7e5a9 gatt: Fix not calling gatt_db_attribute_write_result
In case an error happens in send_write it should call
gatt_db_attribute_write_result not gatt_db_attribute_read_result as it
is a read operation.
2017-09-07 17:18:40 +03:00
Luiz Augusto von Dentz
161691ae36 build: Cleanup GATT profiles
Alert, cyclingspeed, heartrate and proximity can all be implemented
using the GATT D-Bus API so they no longer need dedicated APIs.
2017-09-06 17:22:08 +03:00
Łukasz Rymanowski
a75b37a476 mesh: Typo fix 2017-09-04 14:57:36 +03:00
Łukasz Rymanowski
22d943a798 mesh: Fix for handling unprovisioned device
If there is no ServiceData there is no valid provisioning data for
PB-GATT
2017-09-04 14:57:32 +03:00
Luiz Augusto von Dentz
a5b844cb8f mesh: Use DuplicateData filter
Also use the term duplicate instead of reset to make it more clear
the intent of the filter.
2017-08-30 14:59:55 +03:00
Luiz Augusto von Dentz
7c2e76aa80 client: Use DuplicateData filter
Also use the term duplicate instead of reset to make it more clear
the intent of the filter.
2017-08-30 14:59:55 +03:00
Luiz Augusto von Dentz
edd07f7a5f adapter-api: Rename ResetData to DuplicateData filter
Since essencially what this filter would be doing is disable duplicate
for data use it instead of ResetData.

Also inline the documentation of each filter option to make it easier to
read what each option does.
2017-08-30 14:59:55 +03:00
Yunhan Wang
48f1e3c5b7 client: Add Confirm implementation
Add Confirm implementation when indication is received.
2017-08-29 16:05:09 +03:00
Yunhan Wang
193c49b965 gatt: Add indication confirm callback using Gatt Confirm method 2017-08-29 16:05:09 +03:00
Yunhan Wang
d782f08d91 doc/gatt-api: Add Confirm
Add Confirm method which doesn't expect a reply so it is just
confirmation that value was received.
2017-08-29 16:05:01 +03:00
Inga Stotland
cce5161556 mesh: move GATT defines to the appropriate header file
Group mesh GATT definitions in mesh/gatt.h file.
Also remove unused members in mesh_node structure.
2017-08-28 13:56:55 +03:00
ERAMOTO Masaya
b0fe6045b7 client: Add autocompletion for on/off
For some commands bluetoothctl gives the hint of argument, which is "on"
and "off", it is convenient even if the argument of command was overlooked
in help message.
2017-08-28 13:56:55 +03:00
ERAMOTO Masaya
a8a57c02d6 client: Use the common argument generator 2017-08-28 13:56:55 +03:00
Luiz Augusto von Dentz
e5562190af mesh: Make use of rl_prompt_input
This removes unnecessary code to ask user input which is already
supported by rl_prompt_input.
2017-08-28 13:54:24 +03:00
Luiz Augusto von Dentz
c8c680e14a gatt: Fix crash while disconnecting
The following crash happens if user shutdown the its pipe before the
device gets disconnected:

Invalid read of size 8
   at 0x4E47ED: io_shutdown (io-glib.c:285)
   by 0x4D1366: queue_remove_all (queue.c:351)
   by 0x4A1D22: btd_gatt_client_disconnected (gatt-client.c:2207)
   by 0x4A517B: att_disconnected_cb (device.c:4663)
   by 0x4D5945: disconn_handler (att.c:538)
   by 0x4D0FBF: queue_foreach (queue.c:220)
   by 0x4D75D9: disconnect_cb (att.c:590)
   by 0x4E419A: watch_callback (io-glib.c:170)
   by 0x50CD246: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x50CD5E7: ??? (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x50CD901: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x40CD0E: main (main.c:781)
 Address 0x9240bc8 is 8 bytes inside a block of size 40 free'd
   at 0x4C2FD18: free (vg_replace_malloc.c:530)
   by 0x50D2B4D: g_free (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x4E4200: io_unref (io-glib.c:68)
   by 0x4E4257: watch_destroy (io-glib.c:107)
   by 0x50C9C67: ??? (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x50CD27B: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x50CD5E7: ??? (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x50CD901: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.5200.3)
   by 0x40CD0E: main (main.c:781)
2017-08-24 16:37:08 +03:00
Luiz Augusto von Dentz
ebfcb76cbe client: Reset prompt before printing user input
This fixes printing input such as:

m[agent] Confirm passkey 754788 (yes/no):
2017-08-23 15:22:28 +03:00
Luiz Augusto von Dentz
c144863767 client: Use rl_prompt_input to prompt agent input
This uses rl_prompt_input to ask user input instead of maintaining its
own handling in agent.c lets display.c handle all user prompt requests.
2017-08-23 15:22:17 +03:00
Yunhan Wang
4cfbb394ec advertising: Fix UUIDs in adv_parser
The API is actually ServiceUUIDs
2017-08-23 10:54:57 +03:00
Yunhan Wang
4e111f3448 client: Fix the selection bug of ad manager
If there are multiple adapters, bluetoothctl may choose the wrong
advertising manager. In addition, select command cannot update
current advertising manager when choosing another adapter. Therefore, we
need to put advertising manager under adapter structure to resolve this
issue.
2017-08-22 16:37:18 +03:00
Luiz Augusto von Dentz
0766120230 gdbus: Fix not always appending proxy to the list
Changes introduced by ef024c2c44 have a
regression were a proxy may not be appended to the proxy_list causing
tests to fail as the proxies maybe be added multiple time since
proxy_look would not be able to find existing instances.
2017-08-22 12:42:44 +03:00
Marcel Holtmann
de6c9e2cf0 mesh: Remove circular include protection guards 2017-08-21 18:43:31 +02:00
Marcel Holtmann
0da5161154 build: Include health, mesh and midi into distcheck testing 2017-08-21 13:40:51 +02:00
Marcel Holtmann
8e96790482 mesh: Fix includes to use root relative path names 2017-08-21 13:40:03 +02:00
Brian Gix
2cbd0d69eb mesh: Add mesh to main bluez build 2017-08-21 12:54:11 +02:00
Brian Gix
9b92507843 mesh: Baseline Mesh implementation 2017-08-21 12:40:35 +02:00
Brian Gix
112ebe6e71 mesh: Baseline Mesh runtime configuration files 2017-08-21 12:40:35 +02:00
Brian Gix
846af2a229 mesh: define APIs for Bluetooth Mesh 2017-08-21 12:40:35 +02:00
Brian Gix
1a1204666e mesh: Add BT SIG reserved numbers for Mesh 2017-08-21 12:40:35 +02:00
Marcel Holtmann
017df1b4b5 tools: Add skeleton for new btconfig utility 2017-08-21 12:30:28 +02:00
Marcel Holtmann
f2ca356460 monitor: Add more Broadcom vendor decodings 2017-08-17 10:25:37 +02:00
Luiz Augusto von Dentz
a41a625b1d client: Emit PropertiesChanged if advertising changes
This allows bluetoothd to detect changes done by the user without
having to rely on advertise command to unregister and register again:

bluetooth]# set-advertise-name blah
[bluetooth]# advertise on

@ MGMT Command: Add Advertising (0x003e) plen 17
        Instance: 1
        Flags: 0x00000003
          Switch into Connectable mode
          Advertise as Discoverable
        Duration: 0
        Timeout: 0
        Advertising data length: 0
        Scan response length: 6
        Name (complete): blah

[bluetooth]# set-advertise-name bleh

@ MGMT Command: Add Advertising (0x003e) plen 17
        Instance: 1
        Flags: 0x00000003
          Switch into Connectable mode
          Advertise as Discoverable
        Duration: 0
        Timeout: 0
        Advertising data length: 0
        Scan response length: 6
        Name (complete): bleh
2017-08-16 13:59:00 +03:00
Luiz Augusto von Dentz
b12b7e7655 advertising: Allow changes to properties
This enables the application to change the advertising object instead of
having it unregistered and registered once again.
2017-08-16 13:59:00 +03:00
Marcel Holtmann
0c663ff5e0 monitor: Add additional Broadcom vendor command decodings 2017-08-16 10:43:09 +02:00
Luiz Augusto von Dentz
ef024c2c44 gdbus: Fix calling GetAll while GetManagedObjects is pending
If proxies are created while the client is not ready put them into a
pending list so only if they are not found in GetManagedObject reply
call GetAll.
2017-08-15 11:20:42 +03:00
Luiz Augusto von Dentz
5c3a39e642 client: Enable set-advertise-appearance to set Appearance
This enables set-advertise-appearance to use Appearance property:

[bluetooth]# set-advertise-appearance 128
[bluetooth]# advertise on

@ MGMT Command: Add Advertising (0x003e) plen 15
        Instance: 1
        Flags: 0x00000003
          Switch into Connectable mode
          Advertise as Discoverable
        Duration: 0
        Timeout: 0
        Advertising data length: 4
        Appearance: Computer (0x0080)
        Scan response length: 0
2017-08-10 16:32:09 +03:00
Luiz Augusto von Dentz
80cee3a56c advertising: Add Appearance property
With this property applications can select their own appearance to be
advertised, as opposed to just including the adapter's appearance.
2017-08-10 16:32:08 +03:00
Luiz Augusto von Dentz
177eccc145 client: Enable set-advertise-name to set LocalName
This enables set-advertise-name to use LocalName property:

[bluetooth]# set-advertise-name blah
[bluetooth]# advertise on

@ MGMT Command: Add Advertising (0x003e) plen 17
        Instance: 1
        Flags: 0x00000003
          Switch into Connectable mode
          Advertise as Discoverable
        Duration: 0
        Timeout: 0
        Advertising data length: 0
        Scan response length: 6
        Name (complete): blah
2017-08-10 16:32:07 +03:00
Luiz Augusto von Dentz
e90c5ee0ba advertising: Add LocalName property
With this property applications can select their own local name to be
advertised, as opposed to just including the adapter's name.
2017-08-10 16:32:06 +03:00
Luiz Augusto von Dentz
2bfd5dc8af advertising: Don't depend on kernel to include an appearance
The flag to include an Appearance may not be available in older kernels
so instead of depending on the kernel to add it just generate it locally
and add as part of advertising data:

@ MGMT Command: Add Advertising (0x003e) plen 15
        Instance: 1
        Flags: 0x00000003
          Switch into Connectable mode
          Advertise as Discoverable
        Duration: 0
        Timeout: 0
        Advertising data length: 4
        Appearance: Unknown (0x0000)
        Scan response length: 0
2017-08-10 16:32:05 +03:00
Luiz Augusto von Dentz
2c65fc8588 advertising: Don't depend on kernel to include the Local Name
The flag to include Local Name may not be available in older kernel so
instead of depending on the kernel to add the adapter name in the scan
response generate it and set it as instance scan response:

@ MGMT Command: Add Advertising (0x003e) plen 31
        Instance: 1
        Flags: 0x00000003
          Switch into Connectable mode
          Advertise as Discoverable
        Duration: 0
        Timeout: 0
        Advertising data length: 0
        Scan response length: 20
        Name (complete): Vudentz's T460s #1
2017-08-10 16:32:04 +03:00