Skip to contentSkip to conversation

Add BIP for AVRCP covert art OBEX client

PATCH In review Frédéric Danis 3 participants 8 messages Sep 17, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover Add BIP for AVRCP covert art OBEX client

If AVRCP Target supports Cover Art download its SDP record contains an additional access protocol for OBEX with an LCAP PSM on which the OBEX client session should connect to, with the specific OBEX target header 7163DD54-4A7E-11E2-B47C-0050C2490048.

Once the OBEX session is connected, the AVRCP track metadata will contain an Image Handle which can be used to get the associated image using GetImageThumbnail or GetImage with one of the description property found with GetImageProperties.

This has been tested with iPhone 14, iPhone 15 Pro and Samsung S23.

v1 -> v2: Parse integer properties as integer instead of string

          Return GetImageProperties values as aa{sv} instead of aa{ss}
          Get properties for GetImage as a{sv} instead of a{ss}
          Set new properties and interface as experimental

v2 -> v3: Rename obexd/client/bip-avrcp.[ch] to obexd/client/bip.[ch]
Update the AVRCP Controller version in SDP to 1.6 Add commit to support for specific headers in obex transfer Fix memory leaks
v3 -> v4: Commits 1-4 has been merged
Change org.bluez.obex.BipAvrcp1 to org.bluez.obex.Image1 Change GetImageThumbnail to GetThumbnail
Change GetImageProperties to Properties
Change GetImage to Get
Add possible property values for the description dicts

Frédéric Danis (5):
obexd: Add BIP client for AVRCP cover art download
obexd: Add Properties to org.bluez.obex.Image
obexd: Add Get to org.bluez.obex.Image
avrcp: Update controller SDP record with cover art support
doc: Add description of org.bluez.obex.Image

 Makefile.am                   |   9 +-
 Makefile.obexd                |   2 +
 doc/org.bluez.obex.Client.rst |   1 +
 doc/org.bluez.obex.Image.rst  | 118 +++++
 obexd/client/bip-common.c     | 800 ++++++++++++++++++++++++++++++++++
 obexd/client/bip-common.h     |  24 +
 obexd/client/bip.c            | 440 +++++++++++++++++++
 obexd/client/bip.h            |  12 +
 obexd/client/manager.c        |   2 +
 profiles/audio/avrcp.c        |  12 +-
 10 files changed, 1412 insertions(+), 8 deletions(-)
 create mode 100644 doc/org.bluez.obex.Image.rst
 create mode 100644 obexd/client/bip-common.c
 create mode 100644 obexd/client/bip-common.h
 create mode 100644 obexd/client/bip.c
 create mode 100644 obexd/client/bip.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v4 1/5 obexd: Add BIP client for AVRCP cover art download

The cover art image handle is available in the metadata of the track when the OBEX BIP session is connected to the PSM port provided in AVRCP SDP record and available as org.bluez.MediaPlayer property.

This service allows to get the thumbnail.

---
 Makefile.obexd                |   1 +
 doc/org.bluez.obex.Client.rst |   1 +
 obexd/client/bip.c            | 171 ++++++++++++++++++++++++++++++++++
 obexd/client/bip.h            |  12 +++
 obexd/client/manager.c        |   2 +
 5 files changed, 187 insertions(+)
 create mode 100644 obexd/client/bip.c
 create mode 100644 obexd/client/bip.h
Makefile.obexd +1 -0
index 4cdce73af..866147dd1 100644
@@ -81,6 +81,7 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \
 			obexd/client/ftp.h obexd/client/ftp.c \
 			obexd/client/opp.h obexd/client/opp.c \
 			obexd/client/map.h obexd/client/map.c \
+			obexd/client/bip.h obexd/client/bip.c \
 			obexd/client/map-event.h obexd/client/map-event.c \
 			obexd/client/transfer.h obexd/client/transfer.c \
 			obexd/client/transport.h obexd/client/transport.c \
doc/org.bluez.obex.Client.rst +1 -0
index 5ae7cc5e8..f20dd5baa 100644
@@ -43,6 +43,7 @@ object CreateSession(string destination, dict args)
 		:"opp":
 		:"pbap":
 		:"sync":
+		:"bip-avrcp":
 
 	:string Source:
 
obexd/client/bip.c new file +171 -0

171 lines not on this page · raw message

obexd/client/bip.h new file +12 -0
new file mode 100644
index 000000000..18e3360f3
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *
+ *  OBEX Client
+ *
+ *  Copyright (C) 2024  Collabora Ltd.
+ *
+ *
+ */
+
+int bip_init(void);
+void bip_exit(void);
obexd/client/manager.c +2 -0
index 52c00fb0c..52f4d0179 100644
@@ -32,6 +32,7 @@
 #include "pbap.h"
 #include "sync.h"
 #include "map.h"
+#include "bip.h"
 #include "manager.h"
 
 #define CLIENT_INTERFACE	"org.bluez.obex.Client1"
@@ -258,6 +259,7 @@ static const struct obc_module {
 	{ "pbap", pbap_init, pbap_exit },
 	{ "sync", sync_init, sync_exit },
 	{ "map", map_init, map_exit },
+	{ "bip", bip_init, bip_exit },
 	{ }
 };
 
Signature · 1 line
2.34.1
#2 lore raw

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=890843

---Test result---

Test Summary:

CheckPatch                    FAIL      3.73 seconds
GitLint                       FAIL      1.90 seconds
BuildEll                      PASS      25.04 seconds
BluezMake                     PASS      1673.62 seconds
MakeCheck                     PASS      13.15 seconds
MakeDistcheck                 PASS      191.11 seconds
CheckValgrind                 PASS      266.53 seconds
CheckSmatch                   PASS      360.24 seconds
bluezmakeextell               PASS      121.89 seconds
IncrementalBuild              PASS      7709.01 seconds
ScanBuild                     WARNING   1033.83 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v4,2/5] obexd: Add Properties to org.bluez.obex.Image WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line) #78:
[2] https://github.com/enkait/Basic-Imaging-Profile-in-obexd/blob/gsoc_final/plugins/bip_util.c

/github/workspace/src/src/13805953.patch total: 0 errors, 1 warnings, 926 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13805953.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ,v4,2/5] obexd: Add Properties to org.bluez.obex.Image

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
10: B1 Line exceeds max length (95>80): "[2] https://github.com/enkait/Basic-Imaging-Profile-in-obexd/blob/gsoc_final/plugins/bip_util.c"
##############################
Test: ScanBuild - WARNING
Desc: Run Scan Build
Output:
profiles/audio/avrcp.c:1942:2: warning: Value stored to 'operands' is never read

        operands += sizeof(*pdu);
        ^           ~~~~~~~~~~~~

1 warning generated.

---
Regards,
Linux Bluetooth

#3 lore raw

PATCH v4 2/5 obexd: Add Properties to org.bluez.obex.Image

In reply to Frédéric Danis

This allows to get the different version of the image provided by the remote device to chose the one to use with Get.

This bip-common.[ch] files are based on previous work done by Jakub Adamek for GSoC 2011, see [1] and [2].

[1] https://www.bluez.org/gsoc-basic-image-profilebip/
[2] https://github.com/enkait/Basic-Imaging-Profile-in-obexd/blob/gsoc_final/plugins/bip_util.c

---
 Makefile.obexd            |   1 +
 obexd/client/bip-common.c | 781 ++++++++++++++++++++++++++++++++++++++
 obexd/client/bip-common.h |  19 +
 obexd/client/bip.c        | 101 +++++
 4 files changed, 902 insertions(+)
 create mode 100644 obexd/client/bip-common.c
 create mode 100644 obexd/client/bip-common.h
Makefile.obexd +1 -0
index 866147dd1..74dd977a0 100644
@@ -82,6 +82,7 @@ obexd_src_obexd_SOURCES = $(btio_sources) $(gobex_sources) \
 			obexd/client/opp.h obexd/client/opp.c \
 			obexd/client/map.h obexd/client/map.c \
 			obexd/client/bip.h obexd/client/bip.c \
+			obexd/client/bip-common.h obexd/client/bip-common.c \
 			obexd/client/map-event.h obexd/client/map-event.c \
 			obexd/client/transfer.h obexd/client/transfer.c \
 			obexd/client/transport.h obexd/client/transport.c \
obexd/client/bip-common.c new file +781 -0

781 lines not on this page · raw message

obexd/client/bip-common.h new file +19 -0
new file mode 100644
index 000000000..0fee54636
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *
+ *  OBEX Client
+ *
+ *  Copyright (C) 2024  Collabora Ltd.
+ *
+ *
+ */
+
+#include <glib.h>
+#include "gdbus/gdbus.h"
+
+struct prop_object;
+
+struct prop_object *parse_properties(char *data, unsigned int length,
+							int *err);
+gboolean verify_properties(struct prop_object *obj);
+void append_properties(DBusMessageIter *args, struct prop_object *obj);
obexd/client/bip.c +101 -0

119 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

PATCH v4 3/5 obexd: Add Get to org.bluez.obex.Image

In reply to Frédéric Danis

Retrieves the image corresponding to the handle and the description, as one of the descriptions retrieved by Properties, and store it in a local file.

If the "transform" property description exists it should be set to one of the value listed by Properties for this description.

---
 obexd/client/bip-common.c |  21 ++++-
 obexd/client/bip-common.h |   5 ++
 obexd/client/bip.c        | 168 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 193 insertions(+), 1 deletion(-)
obexd/client/bip-common.c +20 -1
index 9e96c81d8..613b52ceb 100644
@@ -49,7 +49,7 @@ static const gchar *convBIP2IM(const gchar *encoding)
 	return NULL;
 }
 
-static gboolean parse_pixel_range(const gchar *dim, unsigned int *lower_ret,
+gboolean parse_pixel_range(const gchar *dim, unsigned int *lower_ret,
 						unsigned int *upper_ret,
 						gboolean *fixed_ratio_ret)
 {
@@ -139,6 +139,18 @@ char *transforms[] = {
 	NULL
 };
 
+gboolean verify_encoding(const char *encoding)
+{
+	struct encconv_pair *et = encconv_table;
+
+	while (et->bip) {
+		if (g_strcmp0(encoding, et->bip) == 0)
+			return TRUE;
+		et++;
+	}
+	return FALSE;
+}
+
 static gboolean verify_transform(const char *transform)
 {
 	char **str = transforms;
@@ -151,6 +163,13 @@ static gboolean verify_transform(const char *transform)
 	return FALSE;
 }
 
+char *parse_transform(const char *transform)
+{
+	if (!verify_transform(transform))
+		return NULL;
+	return g_strdup(transform);
+}
+
 static char *parse_transform_list(const char *transform)
 {
 	char **args = NULL, **arg = NULL;
obexd/client/bip-common.h +5 -0
index 0fee54636..6e7aac375 100644
@@ -13,6 +13,11 @@
 
 struct prop_object;
 
+gboolean parse_pixel_range(const gchar *dim, unsigned int *lower_ret,
+						unsigned int *upper_ret,
+						gboolean *fixed_ratio_ret);
+gboolean verify_encoding(const char *encoding);
+char *parse_transform(const char *transform);
 struct prop_object *parse_properties(char *data, unsigned int length,
 							int *err);
 gboolean verify_properties(struct prop_object *obj);
obexd/client/bip.c +168 -0

185 lines not on this page · raw message

Signature · 1 line
2.34.1
#5 lore raw

PATCH v4 4/5 avrcp: Update controller SDP record with cover art support

In reply to Frédéric Danis
---
 profiles/audio/avrcp.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
profiles/audio/avrcp.c +7 -5
index fe24b5a92..c2c901a65 100644
@@ -413,12 +413,14 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
 	sdp_record_t *record;
 	sdp_data_t *psm[2], *version, *features;
 	uint16_t lp = AVCTP_CONTROL_PSM;
-	uint16_t avctp_ver = 0x0103;
+	uint16_t avctp_ver = 0x0106;
 	uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
-						AVRCP_FEATURE_CATEGORY_2 |
-						AVRCP_FEATURE_CATEGORY_3 |
-						AVRCP_FEATURE_CATEGORY_4 |
-						AVRCP_FEATURE_CT_GET_THUMBNAIL);
+					AVRCP_FEATURE_CATEGORY_2 |
+					AVRCP_FEATURE_CATEGORY_3 |
+					AVRCP_FEATURE_CATEGORY_4 |
+					AVRCP_FEATURE_CT_GET_IMAGE_PROP |
+					AVRCP_FEATURE_CT_GET_IMAGE |
+					AVRCP_FEATURE_CT_GET_THUMBNAIL);
 
 	record = sdp_record_alloc();
 	if (!record)
Signature · 1 line
2.34.1
#6 lore raw

PATCH v4 5/5 doc: Add description of org.bluez.obex.Image

In reply to Frédéric Danis

This new interface allows to get the image referenced in the audio metadata ImgHandle available in org.bluez.MediaPlayer track properties. The image handle is only available in track info if an OBEX session is connected to the ObexPort port provided in org.bluez.MediaPlayer properties.

---
 Makefile.am                  |   9 ++-
 doc/org.bluez.obex.Image.rst | 118 +++++++++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+), 3 deletions(-)
 create mode 100644 doc/org.bluez.obex.Image.rst
Makefile.am +6 -3
index 88044aa05..3eb0a5302 100644
@@ -382,7 +382,8 @@ man_MANS += doc/org.bluez.obex.Client.5 doc/org.bluez.obex.Session.5 \
 		doc/org.bluez.obex.PhonebookAccess.5 \
 		doc/org.bluez.obex.MessageAccess.5 \
 		doc/org.bluez.obex.Message.5 \
-		doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5
+		doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5 \
+		doc/org.bluez.obex.Image.5
 endif
 manual_pages += src/bluetoothd.8
 manual_pages += doc/l2cap.7 doc/rfcomm.7
@@ -415,7 +416,8 @@ manual_pages += doc/org.bluez.obex.Client.5 doc/org.bluez.obex.Session.5 \
 		doc/org.bluez.obex.PhonebookAccess.5 \
 		doc/org.bluez.obex.MessageAccess.5 \
 		doc/org.bluez.obex.Message.5 \
-		doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5
+		doc/org.bluez.obex.AgentManager.5 doc/org.bluez.obex.Agent.5 \
+		doc/org.bluez.obex.Image.5
 
 EXTRA_DIST += src/genbuiltin src/bluetooth.conf \
 			src/main.conf profiles/network/network.conf \
@@ -497,7 +499,8 @@ EXTRA_DIST += doc/org.bluez.obex.Client.rst doc/org.bluez.obex.Session.rst \
 		doc/org.bluez.obex.PhonebookAccess.rst \
 		doc/org.bluez.obex.MessageAccess.rst \
 		doc/org.bluez.obex.Message.rst \
-		doc/org.bluez.obex.AgentManager.rst doc/org.bluez.obex.Agent.rst
+		doc/org.bluez.obex.AgentManager.rst doc/org.bluez.obex.Agent.rst \
+		doc/org.bluez.obex.Image.rst
 
 EXTRA_DIST += doc/pics-opp.txt doc/pixit-opp.txt \
 		doc/pts-opp.txt
doc/org.bluez.obex.Image.rst new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.34.1
#7 lore raw
In reply to Frédéric Danis
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 11 lines · On Tue, 17 Sep 2024 09:42:12 +0200 you wrote:

If AVRCP Target supports Cover Art download its SDP record contains an additional access protocol for OBEX with an LCAP PSM on which the OBEX client session should connect to, with the specific OBEX target header 7163DD54-4A7E-11E2-B47C-0050C2490048.

Once the OBEX session is connected, the AVRCP track metadata will contain an Image Handle which can be used to get the associated image using GetImageThumbnail or GetImage with one of the description property found with GetImageProperties.

[...]

Here is the summary with links:
- [BlueZ,v4,1/5] obexd: Add BIP client for AVRCP cover art download

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=1a681aa0143e
  - [BlueZ,v4,2/5] obexd: Add Properties to org.bluez.obex.Image
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3ecf9b3398ac
  - [BlueZ,v4,3/5] obexd: Add Get to org.bluez.obex.Image
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=088594d5299a

- [BlueZ,v4,4/5] avrcp: Update controller SDP record with cover art support (no matching commit)
- [BlueZ,v4,5/5] doc: Add description of org.bluez.obex.Image (no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html