tools: Use '>' as prompt end marker
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v2 1/5 tools: Use '>' as prompt end marker
From: Luiz Augusto von Dentz <[email protected]>
This replaces the use of '#' with '>' as prompt end marker since the former is used to describe comments on the script which might be confused with prompt.
--- client/main.c | 6 +++--- client/mgmt.c | 6 +++--- tools/bluetooth-player.c | 2 +- tools/btpclientctl.c | 2 +- tools/mesh-cfgclient.c | 2 +- tools/mesh-gatt/util.c | 2 +- tools/mesh/util.c | 2 +- tools/meshctl.c | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-)
client/main.c +3 -3
@@ -43,7 +43,7 @@#define COLORED_CHG COLOR_YELLOW "CHG" COLOR_OFF#define COLORED_DEL COLOR_RED "DEL" COLOR_OFF -#define PROMPT_ON "[bluetooth]# " +#define PROMPT_ON "[bluetoothctl]> "#define PROMPT_OFF "Waiting to connect to bluetoothd..."static DBusConnection *dbus_conn;
@@ -333,7 +333,7 @@ static void set_default_device(GDBusProxy *proxy, const char *attribute) path =g_dbus_proxy_get_path (proxy);dbus_message_iter_get_basic (&iter, &desc); - desc =g_strdup_printf ("[%s%s%s]# " , desc, + desc =g_strdup_printf ("[%s%s%s]> " , desc, attribute ?":" :"" , attribute ? attribute +strlen (path) :"" );
@@ -2099,7 +2099,7 @@ static void set_default_local_attribute(char *attr) default_local_attr = attr; default_attr =NULL ; - desc =g_strdup_printf ("[%s]# " , attr); + desc =g_strdup_printf ("[%s]> " , attr);bt_shell_set_prompt (desc,COLOR_BLUE );g_free (desc);
client/mgmt.c +3 -3
@@ -71,16 +71,16 @@ static int pending_index = 0;#define MIN (x, y) ((x) < (y) ? (x) : (y))#endif -#define PROMPT_ON COLOR_BLUE "[mgmt]" COLOR_OFF "# " +#define PROMPT_ON COLOR_BLUE "[mgmt]" COLOR_OFF "> "static void update_prompt (uint16_t index) {char str[32 ];if (index ==MGMT_INDEX_NONE ) -snprintf (str,sizeof (str),"[mgmt]# " ); +snprintf (str,sizeof (str),"[mgmt]> " );else -snprintf (str,sizeof (str),"[hci%u]# " , index); +snprintf (str,sizeof (str),"[hci%u]> " , index);bt_shell_set_prompt (str,COLOR_BLUE ); }
tools/bluetooth-player.c +1 -1
@@ -33,7 +33,7 @@#include "src/shared/shell.h" #include "client/player.h" -#define PROMPT "[bluetooth]# " +#define PROMPT "[bluetooth-player]> "static DBusConnection *dbus_conn;
tools/btpclientctl.c +1 -1
@@ -34,7 +34,7 @@#define DEFAULT_SOCKET_PATH "/tmp/bt-stack-tester" -#define PROMPT_ON COLOR_BLUE "[btpclient]" COLOR_OFF "# " +#define PROMPT_ON COLOR_BLUE "[btpclient]" COLOR_OFF "> "#define EVT_OPCODE_BASE 0x80
tools/mesh-cfgclient.c +1 -1
@@ -38,7 +38,7 @@#include "tools/mesh/model.h" #include "tools/mesh/remote.h" -#define PROMPT_ON "[mesh-cfgclient]# " +#define PROMPT_ON "[mesh-cfgclient]> "#define PROMPT_OFF "Waiting to connect to bluetooth-meshd..."#define CFG_SRV_MODEL 0x0000
tools/mesh-gatt/util.c +1 -1
@@ -29,7 +29,7 @@ void set_menu_prompt(const char *name, const char *id) {char *prompt; - prompt =g_strdup_printf ("[%s%s%s]# " , name, + prompt =g_strdup_printf ("[%s%s%s]> " , name, id ?": Target = " :"" , id ? id :"" );bt_shell_set_prompt (prompt,COLOR_BLUE );g_free (prompt);
tools/mesh/util.c +1 -1
@@ -28,7 +28,7 @@ void set_menu_prompt(const char *name, const char *id) {char *prompt; - prompt =l_strdup_printf ("[%s%s%s]# " , name, + prompt =l_strdup_printf ("[%s%s%s]> " , name, id ?": Target = " :"" , id ? id :"" );bt_shell_set_prompt (prompt,COLOR_BLUE );l_free (prompt);
tools/meshctl.c +2 -2
@@ -54,7 +54,7 @@#define COLORED_CHG COLOR_YELLOW "CHG" COLOR_OFF#define COLORED_DEL COLOR_RED "DEL" COLOR_OFF -#define PROMPT_ON "[meshctl]# " +#define PROMPT_ON "[meshctl]> "#define PROMPT_OFF "Waiting to connect to bluetoothd..."#define MESH_PROV_DATA_IN_UUID_STR "00002adb-0000-1000-8000-00805f9b34fb"
@@ -603,7 +603,7 @@ static void set_connected_device(GDBusProxy *proxy) goto done;dbus_message_iter_get_basic (&iter, &desc); - desc =g_strdup_printf (COLOR_BLUE "[%s%s%s]" COLOR_OFF "# " , desc, + desc =g_strdup_printf (COLOR_BLUE "[%s%s%s]" COLOR_OFF "> " , desc, (desc && mesh) ?"-" :"" , mesh ? buf :"" );
Signature · 1 line
2.47.1
Luiz Augusto von Dentz
maintainerPATCH v2 2/5 bluetoothctl: Update documentation to use '>' as prompt end marker
From: Luiz Augusto von Dentz <[email protected]>
This replaces the use of '#' with '>' as prompt end marker since the former is used to describe comments on the script which might be confused with prompt.
--- client/bluetoothctl-admin.rst | 6 +- client/bluetoothctl-advertise.rst | 38 ++++---- client/bluetoothctl-assistant.rst | 4 +- client/bluetoothctl-endpoint.rst | 136 ++++++++++++++-------------- client/bluetoothctl-gatt.rst | 42 ++++----- client/bluetoothctl-mgmt.rst | 146 +++++++++++++++--------------- client/bluetoothctl-monitor.rst | 16 ++-- client/bluetoothctl-player.rst | 38 ++++---- client/bluetoothctl-scan.rst | 20 ++-- client/bluetoothctl-transport.rst | 18 ++-- client/bluetoothctl.rst | 48 +++++----- 11 files changed, 256 insertions(+), 256 deletions(-)
client/bluetoothctl-admin.rst +3 -3
@@ -26,9 +26,9 @@ allow Allow service UUIDs and block rest of them. -:Usage: **# allow [clear/uuid1 uuid2 ...]** -:Example: **# allow 0x1101 0x1102 0x1103** -:Example: **# allow clear** +:Usage: **> allow [clear/uuid1 uuid2 ...]** +:Example: **> allow 0x1101 0x1102 0x1103** +:Example: **> allow clear** RESOURCES =========
client/bluetoothctl-advertise.rst +19 -19
@@ -26,17 +26,17 @@ uuids Set/Get advertise uuids. -:Usage: **# uuids [all/uuid1 uuid2 ...]** -:Example: **# uuids 0x1234** -:Example: **# uuids 0x12345678** -:Example: **# uuids 90f95193-35de-4306-a6e9-699328f15059** +:Usage: **> uuids [all/uuid1 uuid2 ...]** +:Example: **> uuids 0x1234** +:Example: **> uuids 0x12345678** +:Example: **> uuids 90f95193-35de-4306-a6e9-699328f15059** service ------- Set/Get advertise service data. -:Usage: **# service [uuid] [data=xx xx ...]** +:Usage: **> service [uuid] [data=xx xx ...]** manufacturer ------------
@@ -50,7 +50,7 @@ maximum has been exceeded so you may receive an error from bluetoothd that it "Failed to register advertisement" which means you need to reduce your manufacturer data length. -:Usage: **# manufacturer [id] [data=xx xx ...]** +:Usage: **> manufacturer [id] [data=xx xx ...]** data ----
@@ -68,8 +68,8 @@ You can modify the advertising data while it is advertising. To get the currently set data use the command data without any arguments. -:Usage: **# data [type] [data=xx xx ...]** -:Example: **# data 0x0C 01 0x0F 13** +:Usage: **> data [type] [data=xx xx ...]** +:Example: **> data 0x0C 01 0x0F 13** discoverable ------------
@@ -85,7 +85,7 @@ will be ignored. Entering the command by itself will show the status of the setting -:Usage: **# discoverable [on/off]** +:Usage: **> discoverable [on/off]** discoverable-timeout --------------------
@@ -101,7 +101,7 @@ discoverable [on] must be set to use this feature. Entering the command by itself will show the current value set. -:Usage: **# discoverable-timeout [seconds]** +:Usage: **> discoverable-timeout [seconds]** tx-power --------
@@ -119,7 +119,7 @@ This feature can be modified while advertising. Entering the command by itself will show the current value set. -:Usage: **# tx-power [on/off] [power]** +:Usage: **> tx-power [on/off] [power]** name ----
@@ -133,15 +133,15 @@ If the string is too big to fit into the packet it will be truncated. It will either advertise as a complete local name or if it has to be truncated then a shortened local name. -:Usage: **# name [on/off/name]** -:Example: **# name "0123456789abcdef0123456789abcdef"** +:Usage: **> name [on/off/name]** +:Example: **> name "0123456789abcdef0123456789abcdef"** appearance ---------- Configure custom appearance to be advertised. -:Usage: **# appearance [on/off/value]** +:Usage: **> appearance [on/off/value]** duration --------
@@ -172,21 +172,21 @@ The advertising interval is determined by the advertising parameters that are set for each Instance. The advertising interval is the maximum of the advertising intervals set for each Instance. -:Usage: **# duration [seconds]** +:Usage: **> duration [seconds]** timeout ------- Set/Get advertise timeout. -:Usage: **# timeout [seconds]** +:Usage: **> timeout [seconds]** secondary --------- Set/Get advertise secondary channel. -:Usage: **# secondary [1M/2M/Coded]** +:Usage: **> secondary [1M/2M/Coded]** interval --------
@@ -213,7 +213,7 @@ set for each Instance. The advertising interval is the maximum of the advertising intervals set for each Instance. -:Usage: **# interval [milliseconds]** +:Usage: **> interval [milliseconds]** clear -----
@@ -226,7 +226,7 @@ If you want to change the advertise configuration while advertising you must first clear the advertise configuration and then set the new advertise configuration. -:Usage: **# clear [uuids/service/manufacturer/config-name...]** +:Usage: **> clear [uuids/service/manufacturer/config-name...]** RESOURCES =========
client/bluetoothctl-assistant.rst +2 -2
@@ -51,8 +51,8 @@ If the auto value is chosen when prompted for the Broadcast Code, a zero filled array will be sent to the peer. Otherwise, the string entered by the user will be sent as an array of bytes. -:Usage: **# push <assistant>** -:Example: | **# push /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1** +:Usage: **> push <assistant>** +:Example: | **> push /org/bluez/hci0/src_05_1F_EE_F3_F8_7D/dev_00_60_37_31_7E_3F/bis1** | **[Assistant] Enter Metadata (auto/value): 0x03 0x02 0x04 0x00** | **[Assistant] Enter Broadcast Code (auto/value): Borne House**
client/bluetoothctl-endpoint.rst +68 -68
188 lines not on this page · raw message
client/bluetoothctl-gatt.rst +21 -21
168 lines not on this page · raw message
client/bluetoothctl-mgmt.rst +73 -73
584 lines not on this page · raw message
client/bluetoothctl-monitor.rst +8 -8
@@ -26,56 +26,56 @@ set-rssi-threshold Set RSSI threshold parameter -:Usage: **# set-rssi-threshold <low_threshold> <high_threshold>** +:Usage: **> set-rssi-threshold <low_threshold> <high_threshold>** set-rssi-timeout ---------------- Set RSSI timeout parameter -:Usage: **# set-rssi-timeout <low_timeout> <high_timeout>** +:Usage: **> set-rssi-timeout <low_timeout> <high_timeout>** set-rssi-sampling-period ------------------------- Set RSSI sampling period parameter -:Usage: **# set-rssi-timeout <low_timeout> <high_timeout>** +:Usage: **> set-rssi-timeout <low_timeout> <high_timeout>** add-or-pattern -------------- Register 'or pattern' type monitor with the specified RSSI parameters -:Usage: **# add-or-pattern [patterns=pattern1 pattern2 ...]** +:Usage: **> add-or-pattern [patterns=pattern1 pattern2 ...]** get-pattern ----------- Get advertisement monitor -:Usage: **# get-pattern <monitor-id/all>** +:Usage: **> get-pattern <monitor-id/all>** remove-pattern -------------- Remove advertisement monitor -:Usage: **# remove-pattern <monitor-id/all>** +:Usage: **> remove-pattern <monitor-id/all>** get-supported-info ------------------ Get advertisement manager supported features and supported monitor types -:Usage: **# get-supported-info** +:Usage: **> get-supported-info** print-usage ----------- Print the command usage -:Usage: **# print-usage <add-or-pattern>** +:Usage: **> print-usage <add-or-pattern>** RESOURCES =========
client/bluetoothctl-player.rst +19 -19
@@ -26,133 +26,133 @@ list List available players. -:Usage: **# list** +:Usage: **> list** show ---- Show player information. -:Usage: **# show [player]** +:Usage: **> show [player]** select ------ Select default player. -:Usage: **# select <player>** +:Usage: **> select <player>** play ---- Start playback. -:Usage: **# play [item]** +:Usage: **> play [item]** pause ----- Pause playback. -:Usage: **# pause** +:Usage: **> pause** stop ---- Stop playback. -:Usage: **# stop** +:Usage: **> stop** next ---- Jump to next item. -:Usage: **# next** +:Usage: **> next** previous -------- Jump to previous item. -:Usage: **# previous** +:Usage: **> previous** fast-forward ------------ Fast forward playback. -:Usage: **# fast-forward** +:Usage: **> fast-forward** rewind ------ Rewind playback. -:Usage: **# rewind** +:Usage: **> rewind** equalizer --------- Enable/Disable equalizer. -:Usage: **# equalizer <on/off>** +:Usage: **> equalizer <on/off>** repeat ------ Set repeat mode. -:Usage: **# repeat <singletrack/alltrack/group/off>** +:Usage: **> repeat <singletrack/alltrack/group/off>** shuffle ------- Set shuffle mode. -:Usage: **# shuffle <alltracks/group/off>** +:Usage: **> shuffle <alltracks/group/off>** scan ---- Set scan mode. -:Usage: **# scan <alltracks/group/off>** +:Usage: **> scan <alltracks/group/off>** change-folder ------------- Change current folder. -:Usage: **# change-folder <item>** +:Usage: **> change-folder <item>** list-items ---------- List items of current folder. -:Usage: **# list-items [start] [end]** +:Usage: **> list-items [start] [end]** search ------ Search items containing string. -:Usage: **# search <string>** +:Usage: **> search <string>** queue ----- Add item to playlist queue. -:Usage: **# queue <item>** +:Usage: **> queue <item>** show-item --------- Show item information. -:Usage: **# show-item <item>** +:Usage: **> show-item <item>** RESOURCES =========
client/bluetoothctl-scan.rst +10 -10
@@ -26,7 +26,7 @@ uuids Set/Get UUIDs filter. -:Usage: **# uuids [all/uuid1 uuid2 ...]** +:Usage: **> uuids [all/uuid1 uuid2 ...]** rssi ----
@@ -40,8 +40,8 @@ The value is in dBm. If one or more discovery filters have been set, the RSSI delta-threshold imposed by starting discovery by default will not be applied. -:Usage: **# rssi [rssi]** -:Example: **# rssi -60** +:Usage: **> rssi [rssi]** +:Example: **> rssi -60** pathloss --------
@@ -54,8 +54,8 @@ The value is in dB. If one or more discovery filters have been set, the RSSI delta-threshold imposed by starting discovery by default will not be applied. -:Usage: **# pathloss [pathloss]** -:Example: **# pathloss 4** +:Usage: **> pathloss [pathloss]** +:Example: **> pathloss 4** transport ---------
@@ -78,7 +78,7 @@ an org.bluez.Error.Failed error will be returned. If "auto" transport is requested, the scan will use LE, BREDR, or both, depending on what's currently enabled on the controller. -:Usage: **# transport [auto/bredr/le]** +:Usage: **> transport [auto/bredr/le]** duplicate-data --------------
@@ -90,7 +90,7 @@ Disables duplicate detection of advertisement data. When enabled, PropertiesChanged signals will be generated for ManufacturerData and ServiceData every time they are discovered. -:Usage: **# duplicate-data [on/off]** +:Usage: **> duplicate-data [on/off]** discoverable ------------
@@ -102,7 +102,7 @@ Makes the adapter discoverable while discovering. If the adapter is already discoverable, setting this filter won't have any effect. -:Usage: **# discoverable [on/off]** +:Usage: **> discoverable [on/off]** pattern -------
@@ -119,7 +119,7 @@ When set, it disregards device discoverable flags. set any pattern, as it works as a logical OR. Also, setting an empty string "" pattern will match any device found. -:Usage: **# pattern [value]** +:Usage: **> pattern [value]** clear
@@ -127,7 +127,7 @@ clear Clears discovery filter. -:Usage: **# clear [uuids/rssi/pathloss/transport/duplicate-data/discoverable/pattern]** +:Usage: **> clear [uuids/rssi/pathloss/transport/duplicate-data/discoverable/pattern]** RESOURCES =========
client/bluetoothctl-transport.rst +9 -9
@@ -26,21 +26,21 @@ list List available transports. -:Usage: **# list** +:Usage: **> list** show ---- Show transport information. -:Usage: **# show [transport]** +:Usage: **> show [transport]** acquire ------- Acquire transport. -:Usage: **# acquire <transport> [transport1...]** +:Usage: **> acquire <transport> [transport1...]** Note:
@@ -53,7 +53,7 @@ select Select transport. For transports created on a Broadcast Sink device only. This moves the transport to the "broadcasting" state, pending acquire. -:Usage: **# select <transport> [transport1...]** +:Usage: **> select <transport> [transport1...]** Note: If running the setup with an audio server that has LE Audio support (such as PipeWire), it will
@@ -67,7 +67,7 @@ the transport to the "idle" state, pending release by the audio server. If the t was acquired by bluetoothctl it can be released straight away, without having to be unselected. -:Usage: **# unselect <transport> [transport1...]** +:Usage: **> unselect <transport> [transport1...]** Note: If running the setup with an audio server that has LE Audio support (such as PipeWire), it will
@@ -78,7 +78,7 @@ release Release transport. -:Usage: **# release <transport> [transport1...]** +:Usage: **> release <transport> [transport1...]** Note:
@@ -89,21 +89,21 @@ send Send contents of a file. -:Usage: **# send <transport> <filename>** +:Usage: **> send <transport> <filename>** receive ------- Get/Set file to receive. -:Usage: **# receive <transport> [filename]** +:Usage: **> receive <transport> [filename]** volume ------ Get/Set transport volume. -:Usage: **# volume <transport> [value]** +:Usage: **> volume <transport> [value]** RESOURCES =========
client/bluetoothctl.rst +24 -24
191 lines not on this page · raw message
Signature · 1 line
2.47.1
Luiz Augusto von Dentz
maintainerPATCH v2 3/5 share/hci: Introduce bt_hci_send_data
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This introduces bt_hci_send_data which can be used to send ACL, SCO or ISO data packets to the underline HCI socket.
--- src/shared/hci.c | 112 +++++++++++++++++++++++++++++++++++++++++++---- src/shared/hci.h | 3 ++ 2 files changed, 106 insertions(+), 9 deletions(-)
src/shared/hci.c +103 -9
@@ -17,6 +17,11 @@#include <string.h> #include <sys/socket.h> #include <sys/uio.h> +#include <sys/un.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> #include "monitor/bt.h" #include "src/shared/mainloop.h"
@@ -53,6 +58,7 @@ struct bt_hci {struct queue *cmd_queue;struct queue *rsp_queue;struct queue *evt_list; +struct queue *data_queue; };struct cmd {
@@ -73,6 +79,13 @@ struct evt {void *user_data; }; +struct data { +uint8_t type; +uint16_t handle; +void *data; +uint8_t size; +}; +static void cmd_free (void *data) {struct cmd *cmd = data;
@@ -94,6 +107,14 @@ static void evt_free(void *data)free (evt); } +static void data_free (void *data) +{ +struct data *d = data; + +free (d->data); +free (d); +} +static void send_command (struct bt_hci *hci,uint16_t opcode,void *data,uint8_t size) {
@@ -126,17 +147,44 @@ static void send_command(struct bt_hci *hci, uint16_t opcode, hci->num_cmds--; } +static void send_data (struct bt_hci *hci,uint8_t type,uint16_t handle, +void *data,uint16_t size) +{ +struct iovec iov[3 ]; +struct bt_hci_acl_hdr hdr; + + hdr.handle =cpu_to_le16 (handle); + hdr.dlen =cpu_to_le16 (size); + + iov[0 ].iov_base = &type; + iov[0 ].iov_len =1 ; + iov[1 ].iov_base = &hdr; + iov[1 ].iov_len =sizeof (hdr); + iov[2 ].iov_base = data; + iov[2 ].iov_len = size; + +io_send (hci->io, iov,3 ); +} +static bool io_write_callback (struct io *io,void *user_data) {struct bt_hci *hci = user_data;struct cmd *cmd; +struct data *data; - cmd =queue_pop_head (hci->cmd_queue); -if (cmd) { -send_command (hci, cmd->opcode, cmd->data, cmd->size); -queue_push_tail (hci->rsp_queue, cmd); +if (hci->num_cmds) { + cmd =queue_pop_head (hci->cmd_queue); +if (cmd) { +send_command (hci, cmd->opcode, cmd->data, cmd->size); +queue_push_tail (hci->rsp_queue, cmd); + } } + data =queue_pop_head (hci->data_queue); +if (data) +send_data (hci, data->type, data->handle, + data->data, data->size); + hci->writer_active = false;return false;
@@ -147,10 +195,7 @@ static void wakeup_writer(struct bt_hci *hci)if (hci->writer_active)return ; -if (hci->num_cmds <1 ) -return ; - -if (queue_isempty (hci->cmd_queue)) +if (queue_isempty (hci->cmd_queue) &&queue_isempty (hci->data_queue))return ;if (!io_set_write_handler (hci->io, io_write_callback, hci,NULL ))
@@ -300,11 +345,13 @@ static struct bt_hci *create_hci(int fd) hci->cmd_queue =queue_new (); hci->rsp_queue =queue_new (); hci->evt_list =queue_new (); + hci->data_queue =queue_new ();if (!io_set_read_handler (hci->io, io_read_callback, hci,NULL )) {queue_destroy (hci->evt_list,NULL );queue_destroy (hci->rsp_queue,NULL );queue_destroy (hci->cmd_queue,NULL ); +queue_destroy (hci->data_queue,NULL );io_destroy (hci->io);free (hci);return NULL ;
@@ -353,8 +400,11 @@ struct bt_hci *bt_hci_new_user_channel(uint16_t index)int fd; fd =create_socket (index,HCI_CHANNEL_USER ); -if (fd <0 ) +if (fd <0 ) { +printf ("Unable to create user channel socket: %s(%d)\n" , +strerror (errno), -errno);return NULL ; + } hci =create_hci (fd);if (!hci) {
@@ -423,6 +473,7 @@ void bt_hci_unref(struct bt_hci *hci)queue_destroy (hci->evt_list, evt_free);queue_destroy (hci->cmd_queue, cmd_free);queue_destroy (hci->rsp_queue, cmd_free); +queue_destroy (hci->data_queue, data_free);io_destroy (hci->io);
@@ -523,6 +574,7 @@ bool bt_hci_flush(struct bt_hci *hci)queue_remove_all (hci->cmd_queue,NULL ,NULL , cmd_free);queue_remove_all (hci->rsp_queue,NULL ,NULL , cmd_free); +queue_remove_all (hci->data_queue,NULL ,NULL , data_free);return true; }
@@ -556,6 +608,48 @@ unsigned int bt_hci_register(struct bt_hci *hci, uint8_t event,return evt->id; } +bool bt_hci_send_data (struct bt_hci *hci,uint8_t type,uint16_t handle, +const void *data,uint8_t size) +{ +struct data *d; + +if (!hci) +return false; + +/* Check if type really reflects to a data packet */ +switch (type) { +case BT_H4_ACL_PKT : +case BT_H4_SCO_PKT : +case BT_H4_EVT_PKT : +break ; +default : +return false; + } + + d = new0(struct data, 1); + d->type = type; + d->handle = handle; + d->size = size; + +if (d->size >0 ) { + d->data =util_memdup (data, d->size); +if (!d->data) { +free (d); +return false; + } + } + +if (!queue_push_tail (hci->data_queue, d)) { +free (d->data); +free (d); +return false; + } + +wakeup_writer (hci); + +return true; +} +static bool match_evt_id (const void *a,const void *b) {const struct evt *evt = a;
src/shared/hci.h +3 -0
@@ -34,6 +34,9 @@ unsigned int bt_hci_send(struct bt_hci *hci, uint16_t opcode,bool bt_hci_cancel (struct bt_hci *hci,unsigned int id);bool bt_hci_flush (struct bt_hci *hci); +bool bt_hci_send_data (struct bt_hci *hci,uint8_t type,uint16_t handle, +const void *data,uint8_t size); +unsigned int bt_hci_register (struct bt_hci *hci,uint8_t event,bt_hci_callback_func_t callback,void *user_data,bt_hci_destroy_func_t destroy);
Signature · 1 line
2.47.1
Luiz Augusto von Dentz
maintainerPATCH v2 4/5 client: Add HCI submenu
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds HCI submenu:
Menu hci:
Available commands:
-------------------
open <index> <chan=raw,user> Open HCI channel cmd <opcode> [parameters...] Send HCI data send <type=acl,sco,iso> <handle> [data...] Send HCI data register <event> Register HCI event handler unregister <event> Unregister HCI event handler close Close HCI channel
Examples:
In order to open a user channel the controller needs to be power off first:
bluetooth# power off
bluetooth# hci.open 0 user
HCI index 0 user channel opened
Then commands can be sent hci.cmd, so the following is sending HCI reset:
bluetooth# hci.cmd 0x0c03
HCI Command complete:
00
For sending data packets to specific handle hci.send can be used:
bluetooth# hci.send acl 0x0000
--- Makefile.tools | 3 +- client/hci.c | 333 +++++++++++++++++++++++++++++++++++++++++++++++++ client/hci.h | 12 ++ client/main.c | 3 + 4 files changed, 350 insertions(+), 1 deletion(-) create mode 100644 client/hci.c create mode 100644 client/hci.h
Makefile.tools +2 -1
@@ -14,7 +14,8 @@ client_bluetoothctl_SOURCES = client/main.c \ client/admin.h client/admin.c \ client/player.h client/player.c \ client/mgmt.h client/mgmt.c \ - client/assistant.h client/assistant.c + client/assistant.h client/assistant.c \ + client/hci.h client/hci.c client_bluetoothctl_LDADD = lib/libbluetooth-internal.la \ gdbus/libgdbus-internal.la src/libshared-glib.la \ $(GLIB_LIBS) $(DBUS_LIBS) -lreadline
client/hci.c new file +333 -0
333 lines not on this page · raw message
client/hci.h new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* +* BlueZ - Bluetooth protocol stack for Linux +* +* Copyright (C) 2024 Intel Corporation +* +* +*/ + +void hci_add_submenu (void ); +void hci_remove_submenu (void );
client/main.c +3 -0
@@ -37,6 +37,7 @@#include "player.h" #include "mgmt.h" #include "assistant.h" +#include "hci.h" /* String display constants */ #define COLORED_NEW COLOR_GREEN "NEW" COLOR_OFF
@@ -3207,6 +3208,7 @@ int main(int argc, char *argv[])player_add_submenu ();mgmt_add_submenu ();assistant_add_submenu (); +hci_add_submenu (); client =g_dbus_client_new (dbus_conn,"org.bluez" ,"/org/bluez" );
@@ -3229,6 +3231,7 @@ int main(int argc, char *argv[])player_remove_submenu ();mgmt_remove_submenu ();assistant_remove_submenu (); +hci_remove_submenu ();g_dbus_client_unref (client);
Signature · 1 line
2.47.1
Luiz Augusto von Dentz
maintainerPATCH v2 5/5 client: Add bluetoothctl-hci.1 man page
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds bluetoothctl-hci.rst which is then converted to bluetoothctl-hci.1 using rst2man.
--- Makefile.tools | 5 ++- client/bluetoothctl-hci.rst | 86 +++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 client/bluetoothctl-hci.rst
Makefile.tools +3 -2
@@ -354,7 +354,7 @@ man_MANS += tools/rctest.1 tools/l2ping.1 tools/btattach.1 tools/isotest.1 \ client/bluetoothctl-advertise.1 client/bluetoothctl-endpoint.1 \ client/bluetoothctl-gatt.1 client/bluetoothctl-player.1 \ client/bluetoothctl-scan.1 client/bluetoothctl-transport.1 \ - client/bluetoothctl-assistant.1 + client/bluetoothctl-assistant.1 client/bluetoothctl-hci.1 endif
@@ -487,7 +487,8 @@ manual_pages += tools/hciattach.1 tools/hciconfig.1 \ client/bluetoothctl-player.1 \ client/bluetoothctl-scan.1 \ client/bluetoothctl-transport.1 \ - client/bluetoothctl-assistant.1 + client/bluetoothctl-assistant.1 \ + client/bluetoothctl-hci.1 if HID2HCI udevdir = $(UDEV_DIR)
client/bluetoothctl-hci.rst new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
2.47.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=916922
---Test result---
Test Summary:
CheckPatch PENDING 0.36 seconds GitLint PENDING 0.37 seconds BuildEll PASS 24.51 seconds BluezMake PASS 1618.75 seconds MakeCheck PASS 14.19 seconds MakeDistcheck PASS 159.14 seconds CheckValgrind PASS 212.20 seconds CheckSmatch WARNING 272.75 seconds bluezmakeextell PASS 98.82 seconds IncrementalBuild PENDING 0.48 seconds ScanBuild PASS 846.42 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:tools/meshctl.c:324:33: warning: non-ANSI function declaration of function 'forget_mesh_devices'
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 5 lines · On Wed, 11 Dec 2024 14:22:06 -0500 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This replaces the use of '#' with '>' as prompt end marker since the former is used to describe comments on the script which might be confused with prompt.
Quoted 10 lines
--- client/main.c | 6 +++--- client/mgmt.c | 6 +++--- tools/bluetooth-player.c | 2 +- tools/btpclientctl.c | 2 +- tools/mesh-cfgclient.c | 2 +- tools/mesh-gatt/util.c | 2 +- tools/mesh/util.c | 2 +- tools/meshctl.c | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-)
Here is the summary with links:
- [BlueZ,v2,1/5] tools: Use '>' as prompt end marker
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5f0ec38851e1 - [BlueZ,v2,2/5] bluetoothctl: Update documentation to use '>' as prompt end marker https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=d1eb37042d9d - [BlueZ,v2,3/5] share/hci: Introduce bt_hci_send_data https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=560dcd2ea3d2 - [BlueZ,v2,4/5] client: Add HCI submenu https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5527c88bc717 - [BlueZ,v2,5/5] client: Add bluetoothctl-hci.1 man page https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6905331e2cd8
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html