All of lore.kernel.org
 help / color / mirror / Atom feed
From: raghu447 <raghavendra.rao@collabora.com>
To: linux-bluetooth@vger.kernel.org
Cc: raghavendra <raghavendra.rao@collabora.com>
Subject: [BlueZ PATCH 2/3] profiles/audio: Support MCS track position writes
Date: Mon, 31 Aug 2026 11:41:43 +0530	[thread overview]
Message-ID: <20260831061144.7767-3-raghavendra.rao@collabora.com> (raw)
In-Reply-To: <20260831061144.7767-1-raghavendra.rao@collabora.com>

From: raghavendra <raghavendra.rao@collabora.com>

This is needed to Pass PTS GMCS/SR/SP/BV-02-C test.
---
 profiles/audio/mcp.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/mcp.c b/profiles/audio/mcp.c
index 4df388a22..fc9d2dc73 100644
--- a/profiles/audio/mcp.c
+++ b/profiles/audio/mcp.c
@@ -835,8 +835,24 @@ static uint16_t mcs_playing_order_supported(void *data)
 
 static bool mcs_set_track_position(void *data, int32_t value)
 {
-	/* TODO: add support to setting position in org.bluez.MediaPlayer */
-	return false;
+	struct mcs_instance *mcs = data;
+	struct player_link *p = mcs_get_active(mcs);
+	int64_t position = value;
+
+	if (!p)
+		return false;
+
+	if (value < 0) {
+		int32_t duration = mcs_track_duration(mcs);
+
+		if (duration == BT_MCS_DURATION_UNAVAILABLE)
+			return false;
+
+		position += duration;
+	}
+
+	return local_player_seek(p->lp, (position * 10 -
+				local_player_get_position(p->lp)) * 1000);
 }
 
 static bool mcs_set_playing_order(void *data, uint8_t value)

  parent reply	other threads:[~2026-08-31  6:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  6:11 [BlueZ PATCH 0/3] Add MCS fast seek and track position write raghu447
2026-08-31  6:11 ` [BlueZ PATCH 1/3] profiles/audio: Support MCS fast seeking raghu447
2026-09-02 15:31   ` Luiz Augusto von Dentz
2026-09-15 10:22   ` Add MCS fast seek and track position write bluez.test.bot
2026-08-31  6:11 ` raghu447 [this message]
2026-09-02 15:35   ` [BlueZ PATCH 2/3] profiles/audio: Support MCS track position writes Luiz Augusto von Dentz
2026-09-03  8:19     ` Bastien Nocera
2026-09-04 16:53       ` [PATCH 0/4] Add MCS fast seek and track position write support raghu447
2026-09-04 16:53         ` [PATCH 1/4] profiles/audio: Support MCS track position writes raghu447
2026-09-04 17:51           ` Add MCS fast seek and track position write support bluez.test.bot
2026-09-04 16:53         ` [PATCH 2/4] profiles/audio: Support MCS fast seeking raghu447
2026-09-04 16:53         ` [PATCH 3/4] shared/mcp: Notify unsupported RFU opcodes raghu447
2026-09-04 16:53         ` [PATCH 4/4] unit/test-mcp: Test unsupported RFU opcode raghu447
2026-09-04 20:20         ` [PATCH 0/4] Add MCS fast seek and track position write support patchwork-bot+bluetooth
2026-08-31  6:11 ` [BlueZ PATCH 3/3] shared/mcp: Notify unsupported RFU opcodes raghu447
2026-09-02 15:36   ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260831061144.7767-3-raghavendra.rao@collabora.com \
    --to=raghavendra.rao@collabora.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.