summaryrefslogtreecommitdiff
path: root/client/advertising.c
Commit message (Collapse)AuthorAgeFilesLines
* client/advertising: Add support for advertise.rsi commandLuiz Augusto von Dentz2023-04-051-2/+28
| | | | | | | | | | | | | | | | | | | | | This adds support for advertise.rsi command which can be used to request the generation of RSI and include it as part of advertising data: [bluetooth]# advertise.rsi --help Show/Enable/Disable RSI to be advertised Usage: rsi [on/off] [bluetooth]# advertise.rsi RSI: on [bluetooth]# advertise on ... Advertising object registered Tx Power: off Name: off Appearance: off Discoverable: on RSI: on [bluetooth]#
* client: Fix advertise.data commandLuiz Augusto von Dentz2022-10-201-1/+1
| | | | | | advertise.data when no parameter is given shall print what is set on ad.data not the ad.manufacturer which is a different field set by advertise.manufacturer.
* client/advertising: Fix typos: *_exits --> *_existsChristian Eggers2022-08-291-16/+18
|
* client/advertising: Fixes errors found by scan-buildLuiz Augusto von Dentz2022-06-221-4/+2
| | | | | | | | | | | | | This fixes the following errors: client/advertising.c:129:4: warning: Value stored to 'n' is never read [deadcode.DeadStores] n = sizeof(str) - 1; ^ ~~~~~~~~~~~~~~~ client/advertising.c:1012:25: warning: Dereference of null pointer (loaded from variable 'min') [core.NullDereference] if (ad.min_interval != *min) { ^~~~
* client/advertising: Fix not disabling local-name in IncludesLuiz Augusto von Dentz2021-08-101-0/+7
| | | | | | When setting a advertising.name other than on/off it shall also disable local-name flag from Includes as that would cause an error when parsed by the daemon.
* client: Fix advertise broadcastLuiz Augusto von Dentz2021-05-141-0/+3
| | | | | When advertising with type broadcast it cannot be discoverable as that would require setting flags which is not allowed by the spec.
* client/advertising: Add support for setting min/max intervalsLuiz Augusto von Dentz2021-05-131-0/+62
| | | | This adds support for setting MinInterval/MaxInterval.
* client: Add SPDX License IdentifierTedd Ho-Jeong An2020-09-211-14/+1
| | | | | | | | | | | | | | | | | | | | | | This patch adds SPDX License Identifier and removes the license text. ------------------------------------- License COUNT ------------------------------------- GPL-2.0-or-later : 11 License: GPL-2.0-or-later client/adv_monitor.c client/adv_monitor.h client/advertising.h client/display.c client/main.c client/display.h client/agent.h client/gatt.c client/agent.c client/advertising.c client/gatt.h
* client: Fix typo in bluetoothctlBarry Byford2020-08-311-2/+2
|
* client: Make advertise instances default to discoverableLuiz Augusto von Dentz2020-04-071-0/+1
| | | | | The more common case is that advertisements are discoverable not the other way around.
* client: Fix crash when setting advertising.discoverable onLuiz Augusto von Dentz2019-05-101-2/+3
| | | | DBUS_TYPE_BOOLEAN expect a pointer to dbus_bool_t not bool.
* client: Add advertise.secondary commandLuiz Augusto von Dentz2019-02-211-0/+43
| | | | | This adds advertose.secondary command which can be used to set a secondary channel to advertise.
* build: Move declaration of _GNU_SOURCE back into individual source filesMarcel Holtmann2018-12-061-0/+1
|
* client: Add advertise.discoverable-timeout commandLuiz Augusto von Dentz2018-05-241-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds advertise.discoverable-timeout command which can be used to limit the amount of time the advertisement is discoverable: [bluetooth]# advertise.discoverable on [bluetooth]# advertise.discoverable-timeout 10 [bluetooth]# advertise on @ MGMT Command: Add Advertising (0x003e) plen 14 Instance: 1 Flags: 0x00000001 Switch into Connectable mode Duration: 0 Timeout: 0 Advertising data length: 3 Flags: 0x02 LE General Discoverable Mode Scan response length: 0 @ MGMT Event: Advertising Added (0x0023) plen 1 Instance: 1 @ MGMT Event: Command Complete (0x0001) plen 4 Add Advertising (0x003e) plen 1 Status: Success (0x00) Instance: 1 @ MGMT Command: Add Advertising (0x003e) plen 14 Instance: 1 Flags: 0x00000001 Switch into Connectable mode Duration: 0 Timeout: 0 Advertising data length: 3 Flags: 0x00 Scan response length: 0
* client: Print AD Data and Discoverable once registeredLuiz Augusto von Dentz2018-05-241-0/+7
| | | | | | | | | | | | | | | This prints both Data and Discoverable if advertise command succeeds: [bluetooth]# advertise.data 0x26 0x01 0x00 [bluetooth]# advertise.discoverable on [bluetooth]# advertise on Advertising object registered Data Type: 0x26 01 00 .. Tx Power: off Name: off Apperance: off Discoverable: on
* client: Add advertise.discoverable commandLuiz Augusto von Dentz2018-05-241-0/+35
| | | | | | | | | | | | | | | | | | | | | | | This adds advertise.discoverable command which can be used to set it own instance: [bluetooth]# advertise.discoverable on [bluetooth]# advertise on @ MGMT Command: Add Advertising (0x003e) plen 14 Instance: 1 Flags: 0x00000001 Switch into Connectable mode Duration: 0 Timeout: 0 Advertising data length: 3 Flags: 0x02 LE General Discoverable Mode Scan response length: 0 < HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32 Length: 3 Flags: 0x02 LE General Discoverable Mode
* client: Fix use of g_freeLuiz Augusto von Dentz2018-05-211-1/+1
| | | | g_free shall only be used with pointer allocated with g_* functions.
* client: Add support for setting advertising Data propertyLuiz Augusto von Dentz2018-05-021-43/+115
| | | | | | | This adds data command to advertise menu which can be used to set an arbitrary/profile specific advertising type and data: [bluetooth]# data 0x26 0x01 0x01 0x00
* client: Fix stay on error handling in non-interactiveERAMOTO Masaya2018-03-231-1/+1
| | | | | | | | Returns the FAILURE status since there is no meaning of stay in non-interactive mode when executing some commands with an invalid argument or with no controller. Also returns with the SUCCESS status when getting a scan filtering value or disconnecting a non-default device.
* client: Fix lines going beyond 80 columnsLuiz Augusto von Dentz2018-03-011-1/+2
|
* client: Use g_dbus_dict_append_*()ERAMOTO Masaya2018-03-011-55/+3
|
* client: Quit when done with commandLuiz Augusto von Dentz2018-02-281-25/+59
| | | | | This ensures that the commands don't stay hanging since bt_shell no longer quits immediatelly after executing a command.
* client: Introduce ad_disable_{uuids,service,manufacturer}ERAMOTO Masaya2018-02-191-3/+36
|
* client: Fix data growth if reconfiguring ad serviceERAMOTO Masaya2018-02-191-0/+2
| | | | | | | | | | | | | | | Since commit 65eff5c2 ("client: Rename set-service to service"), data are appended in every run of advertise service with data arguments as below: [bluetooth]# service 1 1 2 [bluetooth]# service UUID: SDP(1) 01 02 .. [bluetooth]# service 1 1 2 3 [bluetooth]# service UUID: SDP(1) 01 02 01 02 03 .....
* client: Not output ad service info if no uuid setsERAMOTO Masaya2018-02-191-2/+5
|
* client: Fix null output for ad service uuidERAMOTO Masaya2018-02-191-1/+1
| | | | | | | | If getting the advertise service information without setting, outputs null as UUID as below: [bluetooth]# service UUID: ((null))
* client: Print advertising detailsLuiz Augusto von Dentz2018-01-191-31/+73
| | | | Print advertising details when active.
* client: Rename set-timeout to timeoutLuiz Augusto von Dentz2018-01-191-3/+9
| | | | | | | | Make the command return the current value if no parameters: [bluetooth]# timeout 1 [bluetooth]# timeout Timeout: 1 sec
* client: Rename set-duration to durationLuiz Augusto von Dentz2018-01-191-3/+9
| | | | | | | | Make the command return the current value if no parameters: [bluetooth]# duration 1 [bluetooth]# duration Duration: 1 sec
* client: Rename set-appearance to appearanceLuiz Augusto von Dentz2018-01-191-3/+15
| | | | | | | | Make the command return the current value if no parameters: [bluetooth]# appearance 0x0001 [bluetooth]# appearance Appearance: Unknown (0x0001)
* client: Rename set-name to nameLuiz Augusto von Dentz2018-01-191-0/+9
| | | | | | | | Make the command return the current value if no parameters: [bluetooth]# name blah [bluetooth]# name LocalName: blah
* client: Rename set-tx-power to tx-powerLuiz Augusto von Dentz2018-01-191-3/+8
| | | | | | | | Make the command return the current value if no parameters: [bluetooth]# tx-power on [bluetooth]# tx-power Tx Power: on
* client: Rename set-manufacturer to manufacturerLuiz Augusto von Dentz2018-01-191-2/+10
| | | | | | | | | Make the command return the current value if no parameters: [bluetooth]# manufacturer 2 00 [bluetooth]# manufacturer Manufacturer: 2 00
* client: Rename set-service to serviceLuiz Augusto von Dentz2018-01-191-4/+5
| | | | | | | | | Make the command return the current value if no parameters: [bluetooth]# service 0x1820 00 00 00 [bluetooth]# service UUID: Internet Protocol Support (0x1820) 00 00 00 ...
* client: Rename set-uuids to uuidsLuiz Augusto von Dentz2018-01-191-3/+36
| | | | | | | | Make the command return the current value if no parameters: [bluetooth]# uuids 0x1820 [bluetooth]# uuids UUID: Internet Protocol Support (0x1820
* shared/shell: Don't remove command from argumentsLuiz Augusto von Dentz2017-12-081-7/+7
| | | | | Maintain the original argc and argv so the callback has a chance to parse the command if it has to.
* shared/shell: Use wordexp to parse argumentsLuiz Augusto von Dentz2017-11-171-39/+20
| | | | This ensures the arguments are parsed properly.
* client: Make use of bt_shellLuiz Augusto von Dentz2017-11-171-21/+21
| | | | Use bt_shell instead of readline directly.
* client: Add set-advertise-{duration, timeout}Luiz Augusto von Dentz2017-11-021-0/+50
| | | | | | | | | | | | | | This adds the following command which can be used to control the advertisement intervals: [bluetooth]# set-advertise-duration 4 [bluetooth]# set-advertise-timeout 4 [bluetooth]# advertise on [CHG] Controller B8:8A:60:D8:17:D7 SupportedInstances: 0x04 [CHG] Controller B8:8A:60:D8:17:D7 ActiveInstances: 0x01 Advertising object registered [CHG] Controller B8:8A:60:D8:17:D7 SupportedInstances: 0x05 [CHG] Controller B8:8A:60:D8:17:D7 ActiveInstances: 0x00
* client: Clear ad manufacturer/service data when too much dataERAMOTO Masaya2017-11-021-0/+2
| | | | | | When data is too much, the data may include values not making sense, so this patch clears the advertising manufacturer/service data corresponding to the running command.
* client: Fix clearing advertising service dataERAMOTO Masaya2017-11-021-1/+1
| | | | | | Even if running set-advertise-manufacturer with data having an invalid value, client does not clear the advertising service data and clears the advertising manufacturer data.
* client: Fix segmentation fault while fetching advertising dataAnupam Roy2017-10-261-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While testing advertisement, I encountered Seg fault in client, when bluetoothd tries to fetch the Adv data set by client. It can happen either while fetching Manufacturer specific data or Service data. Backtrace is provided below for reference After fix is applied, advertisement works fine for me. I am sending the following patch your review. Thank you. Passing val instead of &val in dbus_message_iter_append_fixed_array DBUS API causes segmentation fault while fecthing Manufacturer data or service data set by client. BT Before Fix: [bluetooth]# set-advertise-name Test [bluetooth]# set-advertise-uuids 0x1824 [bluetooth]# set-advertise-manufacturer 0x75 0x02 0x03 0x04 [bluetooth]# advertise on Program received signal SIGSEGV, Segmentation fault. in append_array_variant(iter=iter@entry=0x7fffffffd780, val=val@entry=0x62485a <ad+90>, n_elements=n_elements@entry=3, type=121) at client/advertising.c:178 in dict_append_basic_array(type=121, n_elements=3, val=0x62485a <ad+90>, key=0x624858 <ad+88>, key_type=113, dict=0x7fffffffd730) at client/advertising.c:205 get_manufacturer_data(property=<optimized out>, iter=0x7fffffffd840, user_data=<optimized out>) at client/advertising.c:253 After Fix: [bluetooth]# set-advertise-name Test [bluetooth]# set-advertise-uuids 0x1824 [bluetooth]# set-advertise-manufacturer 0x75 0x02 0x03 0x04 [bluetooth]# advertise on [CHG] Controller 00:19:0E:11:55:44 SupportedInstances: 0x04 [CHG] Controller 00:19:0E:11:55:44 ActiveInstances: 0x01 Advertising object registered [bluetooth]#
* client: Prevent to pass invalid ad type to D-BusERAMOTO Masaya2017-09-251-1/+1
|
* client: Fix core dump when using set-advertise-nameERAMOTO Masaya2017-09-251-3/+5
| | | | | | If repeating to set on/off with set-advertise-name after setting local name, and then may dump core by double free. This patch uses g_free() instead of free().
* client: Fix memory leak of advertise commandERAMOTO Masaya2017-09-251-0/+4
| | | | | | | | | | | | | | | | | | | Since advertise command does not free the variable ad.type when repeating to enable and disable advertising, the following memory leak occurs. 11 bytes in 1 blocks are definitely lost in loss record 20 of 190 at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E89718: g_malloc (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) by 0x4EA24EE: g_strdup (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) by 0x40EBC8: ad_register (advertising.c:343) by 0x40A666: cmd_advertise (main.c:2344) by 0x40ABA3: rl_handler (main.c:2664) by 0x53C16F4: rl_callback_read_char (in /lib/x86_64-linux-gnu/libreadline.so.6.3) by 0x405AFC: input_handler (main.c:110) by 0x4E84049: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) by 0x4E843EF: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) by 0x4E84711: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2) by 0x4055FE: main (main.c:2865)
* client: Emit PropertiesChanged if advertising changesLuiz Augusto von Dentz2017-08-161-9/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* client: Enable set-advertise-appearance to set AppearanceLuiz Augusto von Dentz2017-08-101-1/+27
| | | | | | | | | | | | | | | | | | 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
* client: Enable set-advertise-name to set LocalNameLuiz Augusto von Dentz2017-08-101-0/+24
| | | | | | | | | | | | | | | | | | 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
* client: Add set-advertise-name and set-advertise-appearanceLuiz Augusto von Dentz2017-08-101-59/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | set-advertise-appearance enables the use of adapter's appearance in the scan response: [bluetooth]# set-advertise-appearance on [bluetooth]# advertise on @ MGMT Command: Add Advertising (0x003e) plen 11 Instance: 1 Flags: 0x00000023 Switch into Connectable mode Advertise as Discoverable Add Appearance field to Scan Response Duration: 0 Timeout: 0 Advertising data length: 0 Scan response length: 0 set-advertise-name enables the use of adapter's name/alias in the scan response: [bluetooth]# set-advertise-name on [bluetooth]# advertise on @ MGMT Command: Add Advertising (0x003e) plen 11 Instance: 1 Flags: 0x00000043 Switch into Connectable mode Advertise as Discoverable Add Local Name in Scan Response Duration: 0 Timeout: 0 Advertising data length: 0 Scan response length: 0
* client: fix calling ad_unregisterSeulKi Shin2017-02-141-0/+3
| | | | | | ad_register shall only be called in case the advertise command has been called so registered flag should be checked before calling UnregisterAdvertisement.