mcp: support multiple MCP and implement local GMCS
Subsystems (2)
cover mcp: support multiple MCP and implement local GMCS
v2:
- fix compilation issues
- remove unnecessary code in get_media_cp_op_supported
***
For Media Control Client, add support for multiple GMCS / MCS services on the server. Revise the API accordingly.
For Media Control Server, make it a non-stub implementation (OTS still missing), and add an API the profile can use.
Add tests.
This changes the design of the previous MCP code, so it's mostly a rewrite.
The shared/mcp: commit doesn't fix the API in profiles/audio, that's done in the later mcp: commit, as it's a rewrite of the API.
TODO (for later): OTP/OTS parts -- requires design for OTP/OTS implementation first
TODO (for later): MPRIS integration to GMCS server -- this needs some redesign in media.c as it's hardcoded to AVRCP there.
Pauli Virtanen (7):
shared/mcp: support multiple MCP, and add non-stub MCS server
test-mcp: add tests for MCP / MCS
mcp: adapt to new MCP API to support multiple remote MCS services
avctp: move uinput utilities to uinput-util.c
uinput-util: fix compiler complaint about strncpy usage
mcp: add local GMCS service that emits uinput media keys shared/gatt-client: fix notify_data leak in notify_data_write_ccc
.gitignore | 1 + Makefile.am | 6 + Makefile.plugins | 4 +- lib/bluetooth/uuid.h | 27 +- profiles/audio/avctp.c | 119 +- profiles/audio/mcp.c | 802 ++++++--- profiles/audio/uinput-util.c | 146 ++ profiles/audio/uinput-util.h | 23 + src/shared/gatt-client.c | 3 + src/shared/mcp.c | 3216 ++++++++++++++++++++-------------- src/shared/mcp.h | 186 +- src/shared/mcs.h | 51 +- unit/test-mcp.c | 1807 +++++++++++++++++++ 13 files changed, 4650 insertions(+), 1741 deletions(-) create mode 100644 profiles/audio/uinput-util.c create mode 100644 profiles/audio/uinput-util.h create mode 100644 unit/test-mcp.c
Signature · 1 line
2.51.1
PATCH 1/7 shared/mcp: support multiple MCP, and add non-stub MCS server
For Media Control Client, add support for multiple GMCS / MCS services on the server. Revise the API accordingly.
For Media Control Server, make it a complete implementation (OTS still missing), and add an API the profile can use.
This is mostly a complete rewrite.
--- lib/bluetooth/uuid.h | 27 +- src/shared/mcp.c | 3216 ++++++++++++++++++++++++------------------ src/shared/mcp.h | 186 ++- src/shared/mcs.h | 51 +- 4 files changed, 2086 insertions(+), 1394 deletions(-)
lib/bluetooth/uuid.h +14 -13
@@ -198,20 +198,21 @@ extern "C" {#define AICS_AUDIO_INPUT_CP_CHRC_UUID 0X2B7B#define AICS_INPUT_DESCR_CHAR_UUID 0X2B7C +#define MCS_UUID 0x1848#define GMCS_UUID 0x1849 -#define MEDIA_PLAYER_NAME_CHRC_UUID 0x2b93 -#define MEDIA_TRACK_CHNGD_CHRC_UUID 0x2b96 -#define MEDIA_TRACK_TITLE_CHRC_UUID 0x2b97 -#define MEDIA_TRACK_DURATION_CHRC_UUID 0x2b98 -#define MEDIA_TRACK_POSTION_CHRC_UUID 0x2b99 -#define MEDIA_PLAYBACK_SPEED_CHRC_UUID 0x2b9a -#define MEDIA_SEEKING_SPEED_CHRC_UUID 0x2b9b -#define MEDIA_PLAYING_ORDER_CHRC_UUID 0x2ba1 -#define MEDIA_PLAY_ORDER_SUPPRTD_CHRC_UUID 0x2ba2 -#define MEDIA_STATE_CHRC_UUID 0x2ba3 -#define MEDIA_CP_CHRC_UUID 0x2ba4 -#define MEDIA_CP_OP_SUPPORTED_CHRC_UUID 0x2ba5 -#define MEDIA_CONTENT_CONTROL_ID_CHRC_UUID 0x2bba +#define MCS_MEDIA_PLAYER_NAME_CHRC_UUID 0x2b93 +#define MCS_TRACK_CHANGED_CHRC_UUID 0x2b96 +#define MCS_TRACK_TITLE_CHRC_UUID 0x2b97 +#define MCS_TRACK_DURATION_CHRC_UUID 0x2b98 +#define MCS_TRACK_POSITION_CHRC_UUID 0x2b99 +#define MCS_PLAYBACK_SPEED_CHRC_UUID 0x2b9a +#define MCS_SEEKING_SPEED_CHRC_UUID 0x2b9b +#define MCS_PLAYING_ORDER_CHRC_UUID 0x2ba1 +#define MCS_PLAYING_ORDER_SUPPORTED_CHRC_UUID 0x2ba2 +#define MCS_MEDIA_STATE_CHRC_UUID 0x2ba3 +#define MCS_MEDIA_CP_CHRC_UUID 0x2ba4 +#define MCS_MEDIA_CP_OP_SUPPORTED_CHRC_UUID 0x2ba5 +#define MCS_CCID_CHRC_UUID 0x2bba/* Telephony and Media Audio Service */ #define TMAS_UUID_STR "00001855-0000-1000-8000-00805f9b34fb"
src/shared/mcp.c +1879 -1337
2,966 lines not on this page · raw message
src/shared/mcp.h +146 -40
186 lines not on this page · raw message
src/shared/mcs.h +47 -4
51 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.51.1
Part of the diff is not shown here. View the raw message.
PATCH 2/7 test-mcp: add tests for MCP / MCS
In reply to Pauli VirtanenAdd tests for the Media Control Client / Server implementation.
This contains basic GGIT and state transition tests. Not all state transition tests are here, as they'd largely test the upper layer of the profile which is not tested now.
--- .gitignore | 1 + Makefile.am | 6 + unit/test-mcp.c | 1807 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1814 insertions(+) create mode 100644 unit/test-mcp.c
.gitignore +1 -0
@@ -120,6 +120,7 @@ unit/test-bass unit/test-battery unit/test-tmap unit/test-gmap +unit/test-mcp unit/test-profile tools/mgmt-tester tools/smp-tester
Makefile.am +6 -0
@@ -727,6 +727,12 @@ unit_test_gmap_SOURCES = unit/test-gmap.c $(btio_sources) unit_test_gmap_LDADD = src/libshared-glib.la \ lib/libbluetooth-internal.la $(GLIB_LIBS) +unit_tests += unit/test-mcp + +unit_test_mcp_SOURCES = unit/test-mcp.c $(btio_sources) +unit_test_mcp_LDADD = src/libshared-glib.la \ + lib/libbluetooth-internal.la $(GLIB_LIBS) + unit_tests += unit/test-battery unit_test_battery_SOURCES = unit/test-battery.c
unit/test-mcp.c new file +1807 -0
1,807 lines not on this page · raw message
Signature · 1 line
2.51.1
PATCH 3/7 mcp: adapt to new MCP API to support multiple remote MCS services
In reply to Pauli VirtanenRewrite to use the new shared/mcp API, adding support for multiple MCS services on the remote side.
--- profiles/audio/mcp.c | 647 +++++++++++++++++++++++++++---------------- 1 file changed, 407 insertions(+), 240 deletions(-)
profiles/audio/mcp.c +407 -240
@@ -22,6 +22,7 @@#include <sys/stat.h> #include <fcntl.h> #include <errno.h> +#include <math.h> #include <glib.h>
@@ -51,50 +52,54 @@#include "src/service.h" #include "src/log.h" #include "src/error.h" +#include "player.h" -#define GMCS_UUID_STR "00001849-0000-1000-8000-00805f9b34fb" +#define MCS_UUID_STR "00001848-0000-1000-8000-00805f9b34fb" +#define GMCS_UUID_STR "00001849-0000-1000-8000-00805f9b34fb" -struct mcp_data { -struct btd_device *device; -struct btd_service *service; + +/* +* Remote player +*/ + +struct remote_player {struct bt_mcp *mcp; -unsigned int state_id; - +uint8_t ccid;struct media_player *mp; +uint8_t playing_order; }; -static void mcp_debug (const char *str,void *user_data) -{ -DBG_IDX (0xffff ,"%s" , str); -} -static char *name2utf8 (const uint8_t *name,uint16_t len) { -char utf8_name[HCI_MAX_NAME_LENGTH +2 ]; +char *utf8_name; - len =MIN (len,sizeof (utf8_name) -1 ); + utf8_name =malloc (len +1 ); +if (!utf8_name) +return NULL ; -memset (utf8_name,0 ,sizeof (utf8_name)); -strncpy (utf8_name, (char *) name, len); +if (len) +memcpy (utf8_name, name, len); + + utf8_name[len] =0 ;strtoutf8 (utf8_name, len);/* Remove leading and trailing whitespace characters */ g_strstrip (utf8_name); -return g_strdup (utf8_name); +return utf8_name; }static const char *mcp_status_val_to_string (uint8_t status) {switch (status) { -case BT_MCS_STATUS_PLAYING : +case BT_MCS_STATE_PLAYING :return "playing" ; -case BT_MCS_STATUS_PAUSED : +case BT_MCS_STATE_PAUSED :return "paused" ; -case BT_MCS_STATUS_INACTIVE : +case BT_MCS_STATE_INACTIVE :return "stopped" ; -case BT_MCS_STATUS_SEEKING : +case BT_MCS_STATE_SEEKING :/* TODO: find a way for fwd/rvs seeking, probably by storing * control point operation sent before */
@@ -104,307 +109,469 @@ static const char *mcp_status_val_to_string(uint8_t status) } } -static struct mcp_data *mcp_data_new (struct btd_device *device) -{ -struct mcp_data *data; - - data = new0(struct mcp_data, 1); - data->device = device; - -return data; -} - -static void cb_player_name (struct bt_mcp *mcp,const uint8_t *value, -uint16_t length) +static void remote_media_player_name (void *data,const uint8_t *value, +uint16_t length) { +struct remote_player *remote = data;char *name; -struct media_player *mp =bt_mcp_get_user_data (mcp); name =name2utf8 (value, length); +if (!name) +return ; +DBG ("Media Player Name %s" , (const char *)name); -media_player_set_name (mp, name); +media_player_set_name (remote->mp, name); -g_free (name); +free (name); } -static void cb_track_changed (struct bt_mcp *mcp) +static void remote_track_changed (void *data) { +struct remote_player *remote = data; +DBG ("Track Changed" ); -/* Since track changed has happened -* track title notification is expected -*/ + +media_player_metadata_changed (remote->mp); } -static void cb_track_title (struct bt_mcp *mcp,const uint8_t *value, -uint16_t length) +static void remote_track_title (void *data,const uint8_t *value, +uint16_t length) { +struct remote_player *remote = data;char *name;uint16_t len; -struct media_player *mp =bt_mcp_get_user_data (mcp); name =name2utf8 (value, length); +if (!name) +return ; + len =strlen (name);DBG ("Track Title %s" , (const char *)name); -media_player_set_metadata (mp,NULL ,"Title" , name, len); -media_player_metadata_changed (mp); +media_player_set_metadata (remote->mp,NULL ,"Title" , name, len); +media_player_metadata_changed (remote->mp);g_free (name); } -static void cb_track_duration (struct bt_mcp *mcp,int32_t duration) +static void remote_track_duration (void *data,int32_t duration_centisec) { -struct media_player *mp =bt_mcp_get_user_data (mcp); -unsigned char buf[10 ]; +struct remote_player *remote = data; -/* MCP defines duration is int32 but api takes it as uint32 */ -snprintf ((char *)buf,10 ,"%d" , duration); -media_player_set_metadata (mp,NULL ,"Duration" , buf,sizeof (buf)); -media_player_metadata_changed (mp); -} - -static void cb_track_position (struct bt_mcp *mcp,int32_t duration) -{ -struct media_player *mp =bt_mcp_get_user_data (mcp); - -/* MCP defines duration is int32 but api takes it as uint32 */ -media_player_set_position (mp, duration); -} - -static void cb_media_state (struct bt_mcp *mcp,uint8_t status) -{ -struct media_player *mp =bt_mcp_get_user_data (mcp); - -media_player_set_status (mp,mcp_status_val_to_string (status)); -} - -static const struct bt_mcp_event_callback cbs = { - .player_name = cb_player_name, - .track_changed = cb_track_changed, - .track_title = cb_track_title, - .track_duration = cb_track_duration, - .track_position = cb_track_position, - .media_state = cb_media_state, -}; - -static int ct_play (struct media_player *mp,void *user_data) -{ -struct bt_mcp *mcp = user_data; - -return bt_mcp_play (mcp); -} - -static int ct_pause (struct media_player *mp,void *user_data) -{ -struct bt_mcp *mcp = user_data; - -return bt_mcp_pause (mcp); -} - -static int ct_stop (struct media_player *mp,void *user_data) -{ -struct bt_mcp *mcp = user_data; - -return bt_mcp_stop (mcp); -} - -static int ct_next (struct media_player *mp,void *user_data) -{ -struct bt_mcp *mcp = user_data; - -return bt_mcp_next_track (mcp); -} - -static int ct_previous (struct media_player *mp,void *user_data) -{ -struct bt_mcp *mcp = user_data; - -return bt_mcp_previous_track (mcp); -} - -static const struct media_player_callback ct_cbs = { - .play = ct_play, - .pause = ct_pause, - .stop = ct_stop, - .next = ct_next, - .previous = ct_previous, -}; - -static int mcp_probe (struct btd_service *service) -{ -struct btd_device *device =btd_service_get_device (service); -struct btd_adapter *adapter =device_get_adapter (device); -struct btd_gatt_database *database =btd_adapter_get_database (adapter); -struct mcp_data *data =btd_service_get_user_data (service); -char addr[18 ]; - -ba2str (device_get_address (device), addr); -DBG ("%s" , addr); - -/* Ignore, if we were probed for this device already */ -if (data) { -error ("Profile probed twice for the same device!" ); -return -EINVAL ; - } - - data =mcp_data_new (device); - data->service = service; - - data->mcp =bt_mcp_new (btd_gatt_database_get_db (database), -btd_device_get_gatt_db (device)); - -bt_mcp_set_debug (data->mcp, mcp_debug,NULL ,NULL ); -btd_service_set_user_data (service, data); - -return 0 ; -} - -static void mcp_data_free (struct mcp_data *data) -{ -DBG ("" ); - -if (data->service) { -btd_service_set_user_data (data->service,NULL ); -bt_mcp_set_user_data (data->mcp,NULL ); - } - -if (data->mp) { -media_player_destroy (data->mp); - data->mp =NULL ; - } - -bt_mcp_unref (data->mcp); -free (data); -} - -static void mcp_data_remove (struct mcp_data *data) -{ -DBG ("data %p" , data); - -mcp_data_free (data); -} - -static void mcp_remove (struct btd_service *service) -{ -struct btd_device *device =btd_service_get_device (service); -struct mcp_data *data; -char addr[18 ]; - -ba2str (device_get_address (device), addr); -DBG ("%s" , addr); - - data =btd_service_get_user_data (service); -if (!data) { -error ("MCP service not handled by profile" ); +if (duration_centisec ==BT_MCS_POSITION_UNAVAILABLE ) { +media_player_set_duration (remote->mp,0 );return ; } -mcp_data_remove (data); +if (duration_centisec <0 ) + duration_centisec =0 ; + +media_player_set_duration (remote->mp, duration_centisec *10 ); +} + +static void remote_track_position (void *data,int32_t position_centisec) +{ +struct remote_player *remote = data; + +if (position_centisec ==BT_MCS_POSITION_UNAVAILABLE ) { +media_player_set_position (remote->mp,0 ); +return ; + } + +if (position_centisec <0 ) + position_centisec =0 ; + +media_player_set_position (remote->mp, position_centisec *10 ); +} + +static void remote_playback_speed (void *data,int8_t value) +{ +/* TODO */ +} + +static void remote_seeking_speed (void *data,int8_t speed) +{ +/* TODO */ +} + +static const struct { +uint16_t basic; +uint16_t repeat; +bool shuffle; +bool single; +} playing_orders[] = { + {BT_MCS_ORDER_SINGLE_ONCE ,BT_MCS_ORDER_SINGLE_REPEAT , + .single = true }, + {BT_MCS_ORDER_IN_ORDER_ONCE ,BT_MCS_ORDER_IN_ORDER_REPEAT }, + {BT_MCS_ORDER_OLDEST_ONCE ,BT_MCS_ORDER_OLDEST_REPEAT }, + {BT_MCS_ORDER_NEWEST_ONCE ,BT_MCS_ORDER_NEWEST_REPEAT }, + {BT_MCS_ORDER_SHUFFLE_ONCE ,BT_MCS_ORDER_SHUFFLE_REPEAT , + .shuffle = true }, +}; + +static void remote_playing_order (void *data,uint8_t order) +{ +struct remote_player *remote = data; +const char *repeat ="off" ; +unsigned int i; +bool shuffle; + + remote->playing_order = order; + +for (i =0 ; i <ARRAY_SIZE (playing_orders); ++i) { + shuffle = playing_orders[i].shuffle; +if (order == playing_orders[i].basic) { +break ; + }else if (order == playing_orders[i].repeat) { + repeat = playing_orders[i].single ?"singletrack" : +"alltracks" ; +break ; + } + } +if (i ==ARRAY_SIZE (playing_orders)) +return ; + +media_player_set_setting (remote->mp,"Repeat" , repeat); +media_player_set_setting (remote->mp,"Shuffle" , shuffle ?"on" :"off" ); +} + +static void remote_media_state (void *data,uint8_t status) +{ +struct remote_player *remote = data; + +media_player_set_status (remote->mp,mcp_status_val_to_string (status)); +} + +static void remote_destroy (void *data) +{ +struct remote_player *remote = data; + +media_player_destroy (remote->mp); +free (data); +} + +static const struct bt_mcp_listener_callback remote_cb = { + .media_player_name = remote_media_player_name, + .track_changed = remote_track_changed, + .track_title = remote_track_title, + .track_duration = remote_track_duration, + .track_position = remote_track_position, + .playback_speed = remote_playback_speed, + .seeking_speed = remote_seeking_speed, + .playing_order = remote_playing_order, + .media_state = remote_media_state, + .destroy = remote_destroy, +}; + +static int remote_mp_play (struct media_player *mp,void *user_data) +{ +struct remote_player *remote = user_data; + +return bt_mcp_play (remote->mcp, remote->ccid); +} + +static int remote_mp_pause (struct media_player *mp,void *user_data) +{ +struct remote_player *remote = user_data; + +return bt_mcp_pause (remote->mcp, remote->ccid); +} + +static int remote_mp_stop (struct media_player *mp,void *user_data) +{ +struct remote_player *remote = user_data; + +return bt_mcp_stop (remote->mcp, remote->ccid); +} + +static int remote_mp_next (struct media_player *mp,void *user_data) +{ +struct remote_player *remote = user_data; + +return bt_mcp_next_track (remote->mcp, remote->ccid); +} + +static int remote_mp_previous (struct media_player *mp,void *user_data) +{ +struct remote_player *remote = user_data; + +return bt_mcp_previous_track (remote->mcp, remote->ccid); +} + +static bool remote_mp_set_setting (struct media_player *mp,const char *key, +const char *value,void *user_data) +{ +struct remote_player *remote = user_data; +unsigned int i; + +if (strcmp (key,"Repeat" ) ==0 ) { +bool repeat = (strcmp (value,"alltracks" ) ==0 ); +uint8_t order = remote->playing_order; + +/* Some sensible mapping, 1-to-1 not possible */ +for (i =0 ; i <ARRAY_SIZE (playing_orders); ++i) { +if (order == playing_orders[i].basic) { +if (repeat) + order = playing_orders[i].repeat; +break ; + }else if (order == playing_orders[i].repeat) { +if (!repeat) + order = playing_orders[i].basic; +break ; + } + } + +if (strcmp (value,"singletrack" ) ==0 ) + order =BT_MCS_ORDER_SINGLE_REPEAT ; + +DBG ("Set Repeat %s -> 0x%02x" , value, order); + +if (order == remote->playing_order) +return true; +return bt_mcp_set_playing_order (remote->mcp, remote->ccid, + order); + } + +if (strcmp (key,"Shuffle" ) ==0 ) { +bool shuffle = (strcmp (value,"off" ) !=0 ); +uint8_t order = remote->playing_order; + +/* Some sensible mapping, 1-to-1 not possible */ +switch (order) { +case BT_MCS_ORDER_SHUFFLE_ONCE : +if (!shuffle) + order =BT_MCS_ORDER_IN_ORDER_ONCE ; +break ; +case BT_MCS_ORDER_SHUFFLE_REPEAT : +if (!shuffle) + order =BT_MCS_ORDER_IN_ORDER_REPEAT ; +break ; +case BT_MCS_ORDER_SINGLE_ONCE : +case BT_MCS_ORDER_IN_ORDER_ONCE : +case BT_MCS_ORDER_OLDEST_ONCE : +case BT_MCS_ORDER_NEWEST_ONCE : +if (shuffle) + order =BT_MCS_ORDER_SHUFFLE_ONCE ; +break ; +case BT_MCS_ORDER_SINGLE_REPEAT : +case BT_MCS_ORDER_IN_ORDER_REPEAT : +case BT_MCS_ORDER_OLDEST_REPEAT : +case BT_MCS_ORDER_NEWEST_REPEAT : +if (shuffle) + order =BT_MCS_ORDER_SHUFFLE_REPEAT ; +break ; + } + +DBG ("Set Shuffle %s -> 0x%02x" , value, order); + +if (order == remote->playing_order) +return true; +return bt_mcp_set_playing_order (remote->mcp, remote->ccid, + order); + } + +return false; +} + +static const struct media_player_callback remote_mp_cb = { + .play = remote_mp_play, + .pause = remote_mp_pause, + .stop = remote_mp_stop, + .next = remote_mp_next, + .previous = remote_mp_previous, + .set_setting = remote_mp_set_setting, +}; + +static void mcp_ccid (void *data,uint8_t ccid,bool gmcs) +{ +struct btd_service *service = data; +struct btd_device *device =btd_service_get_device (service); +struct bt_mcp *mcp =btd_service_get_user_data (service); +struct remote_player *remote; +struct media_player *mp; + + mp =media_player_controller_create (device_get_path (device), + gmcs ?"mcp_gmcs" :"mcp_mcs" , ccid); +if (!mp) { +DBG ("Unable to create Media Player" ); +return ; + } + + remote = new0(struct remote_player, 1); + remote->mcp = mcp; + remote->ccid = ccid; + remote->mp = mp; + +media_player_set_callbacks (remote->mp, &remote_mp_cb, remote); + +if (!bt_mcp_add_listener (mcp, ccid, &remote_cb, remote)) { +DBG ("Unable to register Media Player with MCP" ); +media_player_destroy (mp); +free (remote); +return ; + } +} + +static void mcp_debug (void *data,const char *str) +{ +DBG_IDX (0xffff ,"%s" , str); +} + +static void mcp_ready (void *data) +{ +struct btd_service *service = data; + +btd_service_connecting_complete (service,0 ); +} + +static const struct bt_mcp_callback mcp_cb = { + .ccid = mcp_ccid, + .debug = mcp_debug, + .ready = mcp_ready, +}; + + +/* +* Profile +*/ + +static struct btd_profile mcp_gmcs_profile; + +static int add_service (struct btd_service *service) +{ +struct btd_device *device =btd_service_get_device (service); +struct bt_gatt_client *client =btd_device_get_gatt_client (device); +struct bt_mcp *mcp =btd_service_get_user_data (service); +bool gmcs; + +if (mcp) +return -EALREADY ; + + gmcs =btd_service_get_profile (service) == &mcp_gmcs_profile; + + mcp =bt_mcp_attach (client, gmcs, &mcp_cb, service); +if (!mcp) { +DBG ("Unable to attach MCP" ); +return -EINVAL ; + } + +btd_service_set_user_data (service, mcp); +return 0 ; +} + +static void remove_service (struct btd_service *service) +{ +struct bt_mcp *mcp =btd_service_get_user_data (service); + +btd_service_set_user_data (service,NULL ); +bt_mcp_detach (mcp); }static int mcp_accept (struct btd_service *service) {struct btd_device *device =btd_service_get_device (service); -struct bt_gatt_client *client =btd_device_get_gatt_client (device); -struct mcp_data *data =btd_service_get_user_data (service);char addr[18 ];ba2str (device_get_address (device), addr);DBG ("%s" , addr); -bt_mcp_attach (data->mcp, client); - - data->mp =media_player_controller_create (device_get_path (device), -"mcp" ,0 ); -if (data->mp ==NULL ) { -DBG ("Unable to create Media Player" ); -return -EINVAL ; - } - -media_player_set_callbacks (data->mp, &ct_cbs, data->mcp); - -bt_mcp_set_user_data (data->mcp, data->mp); -bt_mcp_set_event_callbacks (data->mcp, &cbs, data->mp); -btd_service_connecting_complete (service,0 ); - -return 0 ; +return add_service (service); }static int mcp_connect (struct btd_service *service) { -struct btd_device *device =btd_service_get_device (service); -char addr[18 ]; - -ba2str (device_get_address (device), addr); -DBG ("%s" , addr); -return 0 ; }static int mcp_disconnect (struct btd_service *service) {struct btd_device *device =btd_service_get_device (service); -struct mcp_data *data =btd_service_get_user_data (service);char addr[18 ];ba2str (device_get_address (device), addr);DBG ("%s" , addr); -if (data->mp) { -media_player_destroy (data->mp); - data->mp =NULL ; - } - -bt_mcp_detach (data->mcp); - +remove_service (service);btd_service_disconnecting_complete (service,0 ); -return 0 ; } -static int media_control_server_probe (struct btd_profile *p, -struct btd_adapter *adapter) +static int mcp_probe (struct btd_service *service) { -struct btd_gatt_database *database =btd_adapter_get_database (adapter); - -bt_mcp_register (btd_gatt_database_get_db (database)); -return 0 ; } -static void media_control_server_remove (struct btd_profile *p, -struct btd_adapter *adapter) +static void mcp_remove (struct btd_service *service) { - +remove_service (service); } -static struct btd_profile mcp_profile = { - .name ="mcp" , +static int gmcs_probe (struct btd_profile *p,struct btd_adapter *adapter) +{ +return 0 ; +} + +static void gmcs_remove (struct btd_profile *p,struct btd_adapter *adapter) +{ +} + +static struct btd_profile mcp_gmcs_profile = { + .name ="mcp-gmcs" , .priority =BTD_PROFILE_PRIORITY_MEDIUM , - .bearer =BTD_PROFILE_BEARER_LE , - .remote_uuid =GMCS_UUID_STR , - .device_probe = mcp_probe, - .device_remove = mcp_remove, + .bearer =BTD_PROFILE_BEARER_LE , + .remote_uuid =GMCS_UUID_STR , + .device_probe = mcp_probe, + .device_remove = mcp_remove, .accept = mcp_accept, .connect = mcp_connect, .disconnect = mcp_disconnect, - .adapter_probe = media_control_server_probe, - .adapter_remove = media_control_server_remove, + .adapter_probe = gmcs_probe, + .adapter_remove = gmcs_remove, - .experimental = true, + .experimental = true, +}; + +static struct btd_profile mcp_mcs_profile = { + .name ="mcp-mcs" , + .priority =BTD_PROFILE_PRIORITY_MEDIUM , + .bearer =BTD_PROFILE_BEARER_LE , + .remote_uuid =MCS_UUID_STR , + .device_probe = mcp_probe, + .device_remove = mcp_remove, + .accept = mcp_accept, + .connect = mcp_connect, + .disconnect = mcp_disconnect, + + .adapter_probe =NULL , + .adapter_remove =NULL , + + .experimental = true, };static int mcp_init (void ) { -return btd_profile_register (&mcp_profile); +int err; + + err =btd_profile_register (&mcp_gmcs_profile); +if (err) +return err; + + err =btd_profile_register (&mcp_mcs_profile); +if (err) { +btd_profile_unregister (&mcp_gmcs_profile); +return err; + } + +return err; }static void mcp_exit (void ) { -btd_profile_unregister (&mcp_profile); +btd_profile_unregister (&mcp_gmcs_profile); +btd_profile_unregister (&mcp_mcs_profile); } BLUETOOTH_PLUGIN_DEFINE(mcp, VERSION, BLUETOOTH_PLUGIN_PRIORITY_DEFAULT,
Signature · 1 line
2.51.1
PATCH 4/7 avctp: move uinput utilities to uinput-util.c
In reply to Pauli VirtanenMove basic uinput utilities to a separate file, so they can be reused for MCS.
--- Makefile.plugins | 4 +- profiles/audio/avctp.c | 119 +++-------------------------- profiles/audio/uinput-util.c | 144 +++++++++++++++++++++++++++++++++++ profiles/audio/uinput-util.h | 23 ++++++ 4 files changed, 179 insertions(+), 111 deletions(-) create mode 100644 profiles/audio/uinput-util.c create mode 100644 profiles/audio/uinput-util.h
Makefile.plugins +3 -1
@@ -44,7 +44,9 @@ if AVRCP builtin_modules += avrcp builtin_sources += profiles/audio/control.h profiles/audio/control.c \ profiles/audio/avctp.h profiles/audio/avctp.c \ - profiles/audio/avrcp.h profiles/audio/avrcp.c + profiles/audio/avrcp.h profiles/audio/avrcp.c \ + profiles/audio/uinput-util.h \ + profiles/audio/uinput-util.c endif if NETWORK
profiles/audio/avctp.c +9 -110
173 lines not on this page · raw message
profiles/audio/uinput-util.c new file +144 -0
144 lines not on this page · raw message
profiles/audio/uinput-util.h new file +23 -0
@@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* +* BlueZ - Bluetooth protocol stack for Linux +* +* Copyright (C) 2006-2010 Nokia Corporation +* Copyright (C) 2004-2010 Marcel Holtmann <[email protected]> +* Copyright (C) 2011 Texas Instruments, Inc. +* +* +*/ + +struct uinput_key_map { +const char *name; +unsigned int code; +uint16_t uinput; +}; + +int uinput_create (struct btd_adapter *adapter,struct btd_device *device, +const char *name,const char *suffix, +const struct uinput_key_map *key_map); + +void uinput_send_key (int fd,uint16_t key,int pressed);
Signature · 1 line
2.51.1
PATCH 5/7 uinput-util: fix compiler complaint about strncpy usage
In reply to Pauli VirtanenFixes:
profiles/audio/uinput-util.c: In function 'uinput_create':profiles/audio/uinput-util.c:97:25: error: '__builtin___strncpy_chk'
output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
97 | strncpy(dev.name + len, suffix, slen);
--- profiles/audio/uinput-util.c | 2 ++ 1 file changed, 2 insertions(+)
profiles/audio/uinput-util.c +2 -0
@@ -93,6 +93,8 @@ int uinput_create(struct btd_adapter *adapter, struct btd_device *device,if (len + slen <UINPUT_MAX_NAME_SIZE -1 ) {strcpy (dev.name + len, suffix); }else { +if (slen >=UINPUT_MAX_NAME_SIZE ) + slen =UINPUT_MAX_NAME_SIZE -1 ; len =UINPUT_MAX_NAME_SIZE - slen -1 ;strncpy (dev.name + len, suffix, slen); dev.name[UINPUT_MAX_NAME_SIZE -1 ] ='\0' ;
Signature · 1 line
2.51.1
PATCH 6/7 mcp: add local GMCS service that emits uinput media keys
In reply to Pauli VirtanenImplement simple GMCS service that is always inactive, and emits media key presses via uinput for Play/Pause/Stop/Next/Prev MCS commands.
In practice, this seems to be enough to support media control keys on headsets. Some headsets (Creative Zen Hybrid Pro) also refuse to connect if there is no GMCS service.
---
Notes:
Tested production devices:
- Creative Zen Hybrid Pro (doesn't even connect without GMCS)
- Samsung Galaxy Buds Pro2
profiles/audio/mcp.c | 163 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+)
profiles/audio/mcp.c +163 -0
@@ -23,6 +23,7 @@#include <fcntl.h> #include <errno.h> #include <math.h> +#include <linux/uinput.h> #include <glib.h>
@@ -54,6 +55,7 @@#include "src/error.h" #include "player.h" +#include "uinput-util.h" #define MCS_UUID_STR "00001848-0000-1000-8000-00805f9b34fb"#define GMCS_UUID_STR "00001849-0000-1000-8000-00805f9b34fb"
@@ -433,6 +435,145 @@ static const struct bt_mcp_callback mcp_cb = { }; +/* +* Local player +*/ + +struct gmcs ; + +struct local_player { +struct bt_mcs *mcs; +struct media_player *mp; +struct gmcs *gmcs; +}; + +struct gmcs { +int uinput; +struct btd_adapter *adapter; +struct bt_mcs *mcs; +struct queue *players; +}; + +static const struct uinput_key_map key_map[] = { + {"Play" ,BT_MCS_CMD_PLAY ,KEY_PLAYCD }, + {"Stop" ,BT_MCS_CMD_STOP ,KEY_STOPCD }, + {"Pause" ,BT_MCS_CMD_PAUSE ,KEY_PAUSECD }, + {"Next Track" ,BT_MCS_CMD_NEXT_TRACK ,KEY_NEXTSONG }, + {"Prev Track" ,BT_MCS_CMD_PREV_TRACK ,KEY_PREVIOUSSONG }, + {NULL } +}; + +static struct queue *servers; + +static bool gmcs_command (struct gmcs *gmcs,uint8_t cmd) +{ +unsigned int i; + +/* Emulate media key press */ +if (gmcs->uinput <0 ) +return false; + +for (i =0 ; i <ARRAY_SIZE (key_map); ++i) { +if (key_map[i].code == cmd) { +DBG ("GMCS press %s" , key_map[i].name); +uinput_send_key (gmcs->uinput, key_map[i].uinput,1 ); +uinput_send_key (gmcs->uinput, key_map[i].uinput,0 ); +break ; + } + } + +/* We are always inactive, so command does not cause state changes and +* does not succeed, even though we do generate the key presses. +* This should be OK vs. MCP v1.0.1 p. 26 +*/ +return false; +} + +static bool gmcs_play (void *data) +{ +return gmcs_command (data,BT_MCS_CMD_PLAY ); +} + +static bool gmcs_pause (void *data) +{ +return gmcs_command (data,BT_MCS_CMD_PAUSE ); +} + +static bool gmcs_stop (void *data) +{ +return gmcs_command (data,BT_MCS_CMD_STOP ); +} + +static bool gmcs_next_track (void *data) +{ +return gmcs_command (data,BT_MCS_CMD_NEXT_TRACK ); +} + +static bool gmcs_previous_track (void *data) +{ +return gmcs_command (data,BT_MCS_CMD_PREV_TRACK ); +} + +static void gmcs_media_player_name (void *data,struct iovec *buf,size_t size) +{ +struct gmcs *gmcs = data; +int len; + + len =snprintf ((void *)buf->iov_base, size,"%s" , +btd_adapter_get_name (gmcs->adapter)); +if (len <0 ) + len =0 ; +else if ((size_t )len > size) + len = size; +util_iov_push (buf, len); +} + +static void gmcs_destroy (void *data) +{ +struct gmcs *gmcs = data; + +DBG_IDX (0xffff ,"destroy %p" , data); + +queue_remove (servers, gmcs); + +if (gmcs->uinput >=0 ) +close (gmcs->uinput); + +free (gmcs); +} + +static void gmcs_debug (void *data,const char *str) +{ +DBG_IDX (0xffff ,"%s" , str); +} + +static const struct bt_mcs_callback gmcs_cb = { + .media_player_name = gmcs_media_player_name, + .play = gmcs_play, + .pause = gmcs_pause, + .stop = gmcs_stop, + .next_track = gmcs_next_track, + .previous_track = gmcs_previous_track, + .debug = gmcs_debug, + .destroy = gmcs_destroy, +}; + +static struct gmcs *gmcs_new (struct btd_adapter *adapter) +{ +struct gmcs *gmcs; +const char *name =btd_adapter_get_name (adapter); + + gmcs = new0(struct gmcs, 1); + gmcs->adapter = adapter; + gmcs->uinput =uinput_create (adapter,NULL , name," (MCS)" , key_map); +if (gmcs->uinput <0 ) +error ("MCS: failed to init uinput for %s" , name); + +DBG_IDX (0xffff ,"new %p" , gmcs); + +return gmcs; +} +/* * Profile */
@@ -510,11 +651,33 @@ static void mcp_remove(struct btd_service *service)static int gmcs_probe (struct btd_profile *p,struct btd_adapter *adapter) { +struct btd_gatt_database *database =btd_adapter_get_database (adapter); +struct gatt_db *db =btd_gatt_database_get_db (database); +struct gmcs *gmcs; + + gmcs =gmcs_new (adapter); +if (!gmcs) +return -EINVAL ; + + gmcs->mcs =bt_mcs_register (db, true, &gmcs_cb, gmcs); +if (!gmcs->mcs) { +gmcs_destroy (gmcs); +return -EINVAL ; + } + +if (!servers) + servers =queue_new (); +queue_push_tail (servers, gmcs); +return 0 ; }static void gmcs_remove (struct btd_profile *p,struct btd_adapter *adapter) { +struct btd_gatt_database *database =btd_adapter_get_database (adapter); +struct gatt_db *db =btd_gatt_database_get_db (database); + +bt_mcs_unregister_all (db); }static struct btd_profile mcp_gmcs_profile = {
Signature · 1 line
2.51.1
PATCH 7/7 shared/gatt-client: fix notify_data leak in notify_data_write_ccc
In reply to Pauli VirtanenCalling bt_gatt_client_unregister_notify() when ATT has disconnected leaks the reference to notify_data: in notify_data_write_ccc() the bt_gatt_client_write_value() fails, the destroy is never called, and notify_data_ref() is leaked.
Fix by balancing unref notify_data on write failure.
Log (unit/test-mcp):
Direct leak of 5760 byte(s) in 90 object(s) allocated from:
#0 0x7fd7e2ce6f2b in malloc
#1 0x0000004227e5 in util_malloc src/shared/util.c:46
#2 0x00000044a81c in register_notify src/shared/gatt-client.c:1782
#3 0x000000458367 in bt_gatt_client_register_notify src/shared/gatt-client.c:3685
#4 0x00000049f9f5 in foreach_mcs_char src/shared/mcp.c:1834
---
src/shared/gatt-client.c | 3 +++
1 file changed, 3 insertions(+)src/shared/gatt-client.c +3 -0
@@ -1691,6 +1691,9 @@ static bool notify_data_write_ccc(struct notify_data *notify_data, bool enable, callback,notify_data_ref (notify_data), notify_data_unref); +if (!att_id) +notify_data_unref (notify_data); + notify_data->chrc->ccc_write_id = notify_data->att_id = att_id;return !!att_id;
Signature · 1 line
2.51.1
Luiz Augusto von Dentz
maintainerHi Pauli,
Quoted 15 lines · Pauli Virtanen
v2:
- fix compilation issues
- remove unnecessary code inget_media_cp_op_supported***
For Media Control Client, add support for multiple GMCS / MCS services on the server. Revise the API accordingly.
For Media Control Server, make it a non-stub implementation (OTS still missing), and add an API the profile can use.
Add tests.
Quoted 8 lines
This changes the design of the previous MCP code, so it's mostly a rewrite.
The shared/mcp: commit doesn't fix the API in profiles/audio, that's done in the later mcp: commit, as it's a rewrite of the API.
TODO (for later): OTP/OTS parts -- requires design for OTP/OTS implementation first
We will probably need something similar to g_obex (e.g. bt_otp) to allow us to handle transfers for MCP.
Quoted 2 lines
TODO (for later): MPRIS integration to GMCS server -- this needs some redesign in
media.cas it's hardcoded to AVRCP there.
We will probably need to decouple the struct media_player from struct avrcp_player.
Quoted 31 lines
Pauli Virtanen (7):
shared/mcp: support multiple MCP, and add non-stub MCS server
test-mcp: add tests for MCP / MCS
mcp: adapt to new MCP API to support multiple remote MCS services
avctp: move uinput utilities touinput-util.c
uinput-util: fix compiler complaint about strncpy usage
mcp: add local GMCS service that emits uinput media keys shared/gatt-client: fixnotify_dataleak innotify_data_write_ccc.gitignore | 1 + Makefile.am | 6 + Makefile.plugins | 4 +- lib/bluetooth/uuid.h | 27 +- profiles/audio/avctp.c | 119 +- profiles/audio/mcp.c | 802 ++++++--- profiles/audio/uinput-util.c | 146 ++ profiles/audio/uinput-util.h | 23 + src/shared/gatt-client.c | 3 + src/shared/mcp.c | 3216 ++++++++++++++++++++-------------- src/shared/mcp.h | 186 +- src/shared/mcs.h | 51 +- unit/test-mcp.c | 1807 +++++++++++++++++++ 13 files changed, 4650 insertions(+), 1741 deletions(-) create mode 100644 profiles/audio/uinput-util.c create mode 100644 profiles/audio/uinput-util.h create mode 100644 unit/test-mcp.c--
2.51.1
Signature · 1 line
Luiz Augusto von Dentz
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=1032038
---Test result---
Test Summary:
CheckPatch PENDING 0.43 seconds GitLint PENDING 0.44 seconds BuildEll PASS 20.34 seconds BluezMake FAIL 574.22 seconds MakeCheck FAIL 189.49 seconds MakeDistcheck FAIL 79.94 seconds CheckValgrind FAIL 169.72 seconds CheckSmatch FAIL 255.93 seconds bluezmakeextell FAIL 151.77 seconds IncrementalBuild PENDING 0.48 seconds ScanBuild FAIL 294.13 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12984:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12984 | int main(int argc, char *argv[])
| ^~~~
unit/test-avdtp.c: In function ‘main’:
unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~
profiles/audio/uinput-util.c: In function ‘uinput_create’:
profiles/audio/uinput-util.c:69:12: error: ‘errno’ undeclared (first use in this function)
69 | err = -errno;
| ^~~~~
profiles/audio/uinput-util.c:32:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
31 | #include "uinput-util.h"
+++ |+#include <errno.h>
32 |
profiles/audio/uinput-util.c:69:12: note: each undeclared identifier is reported only once for each function it appears in
69 | err = -errno;
| ^~~~~make[1]: *** [Makefile:8831: profiles/audio/bluetoothd-uinput-util.o] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4214: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:
profiles/audio/uinput-util.c: In function ‘uinput_create’:profiles/audio/uinput-util.c:69:12: error: ‘errno’ undeclared (first use in this function)
69 | err = -errno;
| ^~~~~
profiles/audio/uinput-util.c:32:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
31 | #include "uinput-util.h"
+++ |+#include <errno.h>
32 |
profiles/audio/uinput-util.c:69:12: note: each undeclared identifier is reported only once for each function it appears in
69 | err = -errno;
| ^~~~~make[1]: *** [Makefile:8831: profiles/audio/bluetoothd-uinput-util.o] Error 1
make: *** [Makefile:10923: check] Error 2
##############################
Test: MakeDistcheck - FAIL
Desc: Run Bluez Make Distcheck
Output:
../../profiles/audio/mcp.c: In function ‘gmcs_destroy’:../../profiles/audio/mcp.c:540:3: warning: implicit declaration of function ‘close’; did you mean ‘clone’? [-Wimplicit-function-declaration]
540 | close(gmcs->uinput);
| ^~~~~
| clone
../../profiles/audio/uinput-util.c: In function ‘uinput_create’:
../../profiles/audio/uinput-util.c:69:12: error: ‘errno’ undeclared (first use in this function)
69 | err = -errno;
| ^~~~~
../../profiles/audio/uinput-util.c:32:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
31 | #include "uinput-util.h"
+++ |+#include <errno.h>
32 |
../../profiles/audio/uinput-util.c:69:12: note: each undeclared identifier is reported only once for each function it appears in
69 | err = -errno;
| ^~~~~make[2]: *** [Makefile:8831: profiles/audio/bluetoothd-uinput-util.o] Error 1 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [Makefile:4214: all] Error 2
make: *** [Makefile:10844: distcheck] Error 1
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12984:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12984 | int main(int argc, char *argv[])
| ^~~~
profiles/audio/uinput-util.c: In function ‘uinput_create’:
profiles/audio/uinput-util.c:69:12: error: ‘errno’ undeclared (first use in this function)
69 | err = -errno;
| ^~~~~
profiles/audio/uinput-util.c:32:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
31 | #include "uinput-util.h"
+++ |+#include <errno.h>
32 |
profiles/audio/uinput-util.c:69:12: note: each undeclared identifier is reported only once for each function it appears in
69 | err = -errno;
| ^~~~~make[1]: *** [Makefile:8831: profiles/audio/bluetoothd-uinput-util.o] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:10923: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:
src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:312:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:768:31: warning: Variable length array is used. src/shared/gatt-helpers.c:830:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used. src/shared/gatt-server.c:278:25: warning: Variable length array is used. src/shared/gatt-server.c:618:25: warning: Variable length array is used. src/shared/gatt-server.c:716:25: warning: Variable length array is used. src/shared/bap.c:312:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%'tools/sco-tester.c: note: in included file:./lib/bluetooth/bluetooth.h:232:15: warning: array of flexible structures ./lib/bluetooth/bluetooth.h:237:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%'tools/seq2bseq.c:57:26: warning: Variable length array is used.tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' unit/avctp.c:505:34: warning: Variable length array is used.unit/avctp.c:556:34: warning: Variable length array is used.unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. unit/avrcp-lib.c:1085:34: warning: Variable length array is used. unit/avrcp-lib.c:1583:34: warning: Variable length array is used. unit/avrcp-lib.c:1612:34: warning: Variable length array is used. unit/avrcp-lib.c:1638:34: warning: Variable length array is used. profiles/audio/uinput-util.c: In function ‘uinput_create’:profiles/audio/uinput-util.c:69:12: error: ‘errno’ undeclared (first use in this function)
69 | err = -errno;
| ^~~~~
profiles/audio/uinput-util.c:32:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
31 | #include "uinput-util.h"
+++ |+#include <errno.h>
32 |
profiles/audio/uinput-util.c:69:12: note: each undeclared identifier is reported only once for each function it appears in
69 | err = -errno;
| ^~~~~make[1]: *** [Makefile:8831: profiles/audio/bluetoothd-uinput-util.o] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4214: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:
profiles/audio/uinput-util.c: In function ‘uinput_create’:profiles/audio/uinput-util.c:69:12: error: ‘errno’ undeclared (first use in this function)
69 | err = -errno;
| ^~~~~
profiles/audio/uinput-util.c:32:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
31 | #include "uinput-util.h"
+++ |+#include <errno.h>
32 |
profiles/audio/uinput-util.c:69:12: note: each undeclared identifier is reported only once for each function it appears in
69 | err = -errno;
| ^~~~~make[1]: *** [Makefile:8831: profiles/audio/bluetoothd-uinput-util.o] Error 1 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4214: all] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
##############################
Test: ScanBuild - FAIL
Desc: Run Scan Build
Output:
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
gatt_db_unregister(op->client->db, op->db_id);
^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
discovery_op_complete(op, false, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed
discover_all(op);
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1697:56: warning: Use of memory after it is freed
notify_data->chrc->ccc_write_id = notify_data->att_id = att_id;
~~~~~~~~~~~~~~~~~~~ ^
src/shared/gatt-client.c:2150:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2158:8: warning: Use of memory after it is freed
discovery_op_ref(op),
^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3183:2: warning: Use of memory after it is freed
complete_write_long_op(req, success, 0, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3205:2: warning: Use of memory after it is freed
request_unref(req);
^~~~~~~~~~~~~~~~~~
13 warnings generated.
src/shared/bap.c:1529:8: warning: Use of memory after it is freed
bap = bt_bap_ref_safe(bap);
^~~~~~~~~~~~~~~~~~~~
src/shared/bap.c:2323:20: warning: Use of memory after it is freed
return queue_find(stream->bap->streams, NULL, stream);
^~~~~~~~~~~~~~~~~~~~
2 warnings generated.
src/shared/gatt-client.c:451:21: warning: Use of memory after it is freed
gatt_db_unregister(op->client->db, op->db_id);
^~~~~~~~~~
src/shared/gatt-client.c:696:2: warning: Use of memory after it is freed
discovery_op_complete(op, false, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:996:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1102:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1296:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1361:2: warning: Use of memory after it is freed
discovery_op_complete(op, success, att_ecode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1636:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1641:2: warning: Use of memory after it is freed
discover_all(op);
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:1697:56: warning: Use of memory after it is freed
notify_data->chrc->ccc_write_id = notify_data->att_id = att_id;
~~~~~~~~~~~~~~~~~~~ ^
src/shared/gatt-client.c:2150:6: warning: Use of memory after it is freed
if (read_db_hash(op)) {
^~~~~~~~~~~~~~~~
src/shared/gatt-client.c:2158:8: warning: Use of memory after it is freed
discovery_op_ref(op),
^~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3183:2: warning: Use of memory after it is freed
complete_write_long_op(req, success, 0, false);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/shared/gatt-client.c:3205:2: warning: Use of memory after it is freed
request_unref(req);
^~~~~~~~~~~~~~~~~~
13 warnings generated.
tools/hciattach.c:817:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 10)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:865:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:887:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 10)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:909:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:930:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 4)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/hciattach.c:974:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n'
if ((n = read_hci_event(fd, resp, 6)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
src/shared/bap.c:1529:8: warning: Use of memory after it is freed
bap = bt_bap_ref_safe(bap);
^~~~~~~~~~~~~~~~~~~~
src/shared/bap.c:2323:20: warning: Use of memory after it is freed
return queue_find(stream->bap->streams, NULL, stream);
^~~~~~~~~~~~~~~~~~~~
2 warnings generated.
src/oui.c:50:2: warning: Value stored to 'hwdb' is never read
hwdb = udev_hwdb_unref(hwdb);
^ ~~~~~~~~~~~~~~~~~~~~~
src/oui.c:53:2: warning: Value stored to 'udev' is never read
udev = udev_unref(udev);
^ ~~~~~~~~~~~~~~~~
2 warnings generated.
tools/rfcomm.c:234:3: warning: Value stored to 'i' is never read
i = execvp(cmdargv[0], cmdargv);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:234:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
i = execvp(cmdargv[0], cmdargv);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:354:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/rfcomm.c:497:14: warning: Assigned value is garbage or undefined
req.channel = raddr.rc_channel;
^ ~~~~~~~~~~~~~~~~
tools/rfcomm.c:515:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd'
if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) {
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
tools/hcidump.c:180:9: warning: Potential leak of memory pointed to by 'dp'
if (fds[i].fd == sock)
^~~
tools/hcidump.c:248:17: warning: Assigned value is garbage or undefined
dh->ts_sec = htobl(frm.ts.tv_sec);
^ ~~~~~~~~~~~~~~~~~~~~
tools/hcidump.c:326:9: warning: 1st function call argument is an uninitialized value
if (be32toh(dp.flags) & 0x02) {
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:341:20: warning: 1st function call argument is an uninitialized value
frm.data_len = be32toh(dp.len);
^~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:346:14: warning: 1st function call argument is an uninitialized value
opcode = be32toh(dp.flags) & 0xffff;
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:384:17: warning: Assigned value is garbage or undefined
frm.data_len = btohs(dh.len);
^ ~~~~~~~~~~~~~
tools/hcidump.c:394:11: warning: Assigned value is garbage or undefined
frm.len = frm.data_len;
^ ~~~~~~~~~~~~
tools/hcidump.c:398:9: warning: 1st function call argument is an uninitialized value
ts = be64toh(ph.ts);
^~~~~~~~~~~~~~
/usr/include/endian.h:51:22: note: expanded from macro 'be64toh'
# define be64toh(x) __bswap_64 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:403:13: warning: 1st function call argument is an uninitialized value
frm.in = be32toh(dp.flags) & 0x01;
^~~~~~~~~~~~~~~~~
/usr/include/endian.h:46:22: note: expanded from macro 'be32toh'
# define be32toh(x) __bswap_32 (x)
^~~~~~~~~~~~~~
tools/hcidump.c:408:11: warning: Assigned value is garbage or undefined
frm.in = dh.in;
^ ~~~~~
tools/hcidump.c:437:7: warning: Null pointer passed to 1st parameter expecting 'nonnull'
fd = open(file, open_flags, 0644);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 warnings generated.
tools/ciptool.c:351:7: warning: 5th function call argument is an uninitialized value
sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:306:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
src/sdp-xml.c:344:11: warning: Assigned value is garbage or undefined
buf[1] = data[i + 1];
^ ~~~~~~~~~~~
3 warnings generated.
tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int'
uint32_t *value_int = malloc(sizeof(int));
~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~
tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value
free(allocArray[i]);
^~~~~~~~~~~~~~~~~~~
tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name'
return add_service(0, &si);
^~~~~~~~~~~~~~~~~~~~~~~~~~
tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc'
return -1;
^~~~~~~~~
4 warnings generated.
tools/avtest.c:243:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:253:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:262:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~tools/avtest.c:276:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:283:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:290:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:297:5: warning: Value stored to 'len' is never read
len = write(sk, buf,
^ ~~~~~~~~~~~~~~tools/avtest.c:309:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:313:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:322:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:326:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:335:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:342:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:364:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:368:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:377:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:381:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:394:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 4);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:398:5: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:405:4: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:415:4: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:580:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:588:3: warning: Value stored to 'len' is never read
len = write(sk, buf, invalid ? 2 : 3);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:602:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 4 + media_transport_size);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/avtest.c:615:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:625:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:637:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:652:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:664:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:673:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 3);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:680:3: warning: Value stored to 'len' is never read
len = write(sk, buf, 2);
^ ~~~~~~~~~~~~~~~~~
tools/avtest.c:716:2: warning: Value stored to 'len' is never read
len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed));
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 warnings generated.
tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull'
tcp_port = atoi(optarg);
^~~~~~~~~~~~
tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull'
if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3))
^~~~~~~~~~~~~~
2 warnings generated.
tools/create-image.c:76:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:84:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:92:3: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
tools/create-image.c:105:2: warning: Value stored to 'fd' is never read
fd = -1;
^ ~~
4 warnings generated.
tools/check-selftest.c:42:3: warning: Value stored to 'ptr' is never read
ptr = fgets(result, sizeof(result), fp);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/btgatt-client.c:1824:2: warning: Value stored to 'argv' is never read
argv += optind;
^ ~~~~~~
1 warning generated.
tools/btgatt-server.c:1212:2: warning: Value stored to 'argv' is never read
argv -= optind;
^ ~~~~~~
1 warning generated.
tools/gatt-service.c:294:2: warning: 2nd function call argument is an uninitialized value
chr_write(chr, value, len);
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
tools/obex-server-tool.c:133:13: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tools/obex-server-tool.c:192:13: warning: Null pointer passed to 1st parameter expecting 'nonnull'
data->fd = open(name, O_RDONLY | O_NOCTTY, 0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
tools/btpclientctl.c:402:3: warning: Value stored to 'bit' is never read
bit = 0;
^ ~
tools/btpclientctl.c:1655:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull'
memcpy(cp->data, ad_data, ad_len);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
src/sdp-client.c:353:14: warning: Access to field 'cb' results in a dereference of a null pointer
(*ctxt)->cb = cb;
~~~~~~~~~~~~^~~~
1 warning generated.
src/sdpd-request.c:211:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t'
pElem = malloc(sizeof(uint16_t));
^~~~~~ ~~~~~~~~~~~~~~~~
src/sdpd-request.c:239:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t'
pElem = malloc(sizeof(uint32_t));
^~~~~~ ~~~~~~~~~~~~~~~~
2 warnings generated.
src/gatt-database.c:1175:10: warning: Value stored to 'bits' during its initialization is never read
uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING,
^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
unit/avrcp-lib.c:1968:3: warning: 1st function call argument is an uninitialized value
g_free(text[i]);
^~~~~~~~~~~~~~~
1 warning generated.
unit/avdtp.c:756:25: warning: Use of memory after it is freed
session->prio_queue = g_slist_remove(session->prio_queue, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unit/avdtp.c:763:24: warning: Use of memory after it is freed
session->req_queue = g_slist_remove(session->req_queue, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
profiles/audio/avdtp.c:895:25: warning: Use of memory after it is freed
session->prio_queue = g_slist_remove(session->prio_queue, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
profiles/audio/avdtp.c:902:24: warning: Use of memory after it is freed
session->req_queue = g_slist_remove(session->req_queue, req);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
profiles/audio/a2dp.c:442:8: warning: Use of memory after it is freed
if (!cb->resume_cb)
^~~~~~~~~~~~~
profiles/audio/a2dp.c:3354:20: warning: Access to field 'starting' results in a dereference of a null pointer (loaded from variable 'stream')
stream->starting = TRUE;
~~~~~~ ^
profiles/audio/a2dp.c:3357:8: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream')
if (!stream->suspending && stream->suspend_timer) {
^~~~~~~~~~~~~~~~~~
profiles/audio/a2dp.c:3417:22: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream')
stream->suspending = TRUE;
~~~~~~ ^
4 warnings generated.
profiles/audio/uinput-util.c: In function ‘uinput_create’:
profiles/audio/uinput-util.c:69:12: error: ‘errno’ undeclared (first use in this function)
69 | err = -errno;
| ^~~~~
profiles/audio/uinput-util.c:32:1: note: ‘errno’ is defined in header ‘<errno.h>’; did you forget to ‘#include <errno.h>’?
31 | #include "uinput-util.h"
+++ |+#include <errno.h>
32 |
profiles/audio/uinput-util.c:69:12: note: each undeclared identifier is reported only once for each function it appears in
69 | err = -errno;
| ^~~~~
make[1]: *** [Makefile:8831: profiles/audio/bluetoothd-uinput-util.o] Error 1
make[1]: *** Waiting for unfinished jobs....
profiles/audio/avrcp.c:1961:2: warning: Value stored to 'operands' is never read
operands += sizeof(*pdu);
^ ~~~~~~~~~~~~1 warning generated.
make: *** [Makefile:4214: all] Error 2
---
Regards,
Linux Bluetooth