Previously devices list was cleared when selecting new default
controller. Now devices list is preserverd allowing to list and suggest
devices for default controller even after changing the default
controller.
This adds set-advertise-tx-power which can be used include TX power
in the advertisement data:
set-advertise-manufacturer <on/off>
[bluetooth]# set-advertise-tx-power on
[bluetooth]# advertise on
@ Advertising Added: 1
< HCI Command: LE Set Aidvertising Data (0x08|0x0008) plen 32
Length: 6
Flags: 0x02
LE General Discoverable Mode
TX power: 9 dBm
This adds set-advertise-manufacturer which can be used set manfacturer
spefic data to be advertised:
set-advertise-manufacturer [id][data=[xx xx ...]
[bluetooth]# set-advertise-manufacturer 0xffff 0x00 0x01 0x02 0x03
[bluetooth]# advertise on
@ Advertising Added: 1
< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
Length: 11
Flags: 0x02
LE General Discoverable Mode
Company: internal use (65535)
Data: 00010203
This adds set-advertise-service which can be used set UUID data to be
advertised:
set-advertise-service [uuid][data=[xx xx ...]
[bluetooth]# set-advertise-service 180D 0xff 0xff
[bluetooth]# advertise on
@ Advertising Added: 1
< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
Length: 9
Flags: 0x02
LE General Discoverable Mode
Service Data (UUID 0x180d): ffff
This adds set-advertise-uuids which can be used set UUIDs to be
advertised:
set-advertise-uuids [uuid1 uuid2...]
[bluetooth]# set-advertise-uuids 180D 180F
[bluetooth]# advertise on
@ Advertising Added: 1
< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
Length: 9
Flags: 0x02
LE General Discoverable Mode
16-bit Service UUIDs (complete): 2 entries
Heart Rate (0x180d)
Battery Service (0x180f)
This adds advertise command which uses org.bluez.LEAdvertisingManager1 to
add an advertising instance:
[bluetooth]# advertise
broadcast off on peripheral
[bluetooth]# advertise on
Advertising object registered
@ Advertising Added: 1
< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
Length: 3
Flags: 0x02
LE General Discoverable Mode
[bluetooth]# advertise off
Advertising object unregistered
@ Advertising Removed: 1
< HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1
Advertising: Disabled (0x00)
connect_handler() gets called when we're connected to D-Bus but before
introspection of the remote service (org.bluez) is complete. The
client_ready() callback otoh waits until the introspection is complete
and is already also taking care of attaching input.
Make it clear that bluetoothctl is waiting to connect to bluetoothd
instead of showing something that looks like a prompt but which
doesn't accept any input.
When started, bluetoothctl doesn't process input until it has
connected to bluetoothd. To be consistent if the D-Bus connection is
later lost also remove the input processing then.
When exiting the available proxies are destroy in the same order they are
added causing the following crash when there are attributes whose service
has already been removed:
Invalid read of size 8
at 0x414AAD: g_dbus_proxy_get_path (client.c:525)
by 0x40B948: characteristic_is_child (gatt.c:136)
by 0x40C420: gatt_remove_characteristic (gatt.c:157)
by 0x4067A7: proxy_removed (main.c:446)
by 0x414A2E: proxy_free (client.c:439)
by 0x4E7AF6C: g_list_foreach (in /usr/lib64/libglib-2.0.so.0.4400.1)
by 0x4E7AF8A: g_list_free_full (in /usr/lib64/libglib-2.0.so.0.4400.1)
by 0x415D54: g_dbus_client_unref (client.c:1310)
by 0x40511B: main (main.c:2067)
Address 0x5eb5450 is 16 bytes inside a block of size 80 free'd
at 0x4C29D6A: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
by 0x4E8479E: g_free (in /usr/lib64/libglib-2.0.so.0.4400.1)
by 0x4149D6: g_dbus_proxy_unref (client.c:517)
by 0x414A8D: proxy_free (client.c:451)
by 0x4E7AF6C: g_list_foreach (in /usr/lib64/libglib-2.0.so.0.4400.1)
by 0x4E7AF8A: g_list_free_full (in /usr/lib64/libglib-2.0.so.0.4400.1)
by 0x415D54: g_dbus_client_unref (client.c:1310)
by 0x40511B: main (main.c:2067)
This command can be used to write attributes, it only works if an
attribute has been selected with select-attribute.
The data argument should be passed hexdump format, %02x separated by
spaces, which is the same format used by read command.
It seems some in some version of readline rl_redisplay does not update
when rl_printf is called, so this uses rl_forced_update_display which
should force the new lines to be displayed.
This allows to terminate bluetoothctl with CTRL-C if daemon didn't
start. Otherwise input is not functional and user must kill
bluetoothctl by sending signal from another terminal.