linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands
@ 2024-06-19 12:04 Yauhen Kharuzhy
  2024-06-19 12:04 ` [PATCH BlueZ v2 2/2] mcp: Implement Next Track and Previous Track commands Yauhen Kharuzhy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yauhen Kharuzhy @ 2024-06-19 12:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Yauhen Kharuzhy

Add bt_mcp_{next,previous}_track functions to shared MCP client
profile code. This allows user to have basic control of the media player
in addition to simple play/pause/stop actions.
---
 src/shared/mcp.c | 20 ++++++++++++++++++++
 src/shared/mcp.h |  2 ++
 2 files changed, 22 insertions(+)

diff --git a/src/shared/mcp.c b/src/shared/mcp.c
index b3726ebae..71fc2d151 100644
--- a/src/shared/mcp.c
+++ b/src/shared/mcp.c
@@ -628,6 +628,26 @@ unsigned int bt_mcp_stop(struct bt_mcp *mcp)
 	return mcp_send(mcp, BT_MCS_CMD_STOP);
 }
 
+unsigned int bt_mcp_next_track(struct bt_mcp *mcp)
+{
+	if (!(mcp->session.cp_op_supported & BT_MCS_CMD_NEXT_TRACK_SUPPORTED))
+		return -ENOTSUP;
+
+	DBG(mcp, "mcp %p", mcp);
+
+	return mcp_send(mcp, BT_MCS_CMD_NEXT_TRACK);
+}
+
+unsigned int bt_mcp_previous_track(struct bt_mcp *mcp)
+{
+	if (!(mcp->session.cp_op_supported & BT_MCS_CMD_PREV_TRACK_SUPPORTED))
+		return -ENOTSUP;
+
+	DBG(mcp, "mcp %p", mcp);
+
+	return mcp_send(mcp, BT_MCS_CMD_PREV_TRACK);
+}
+
 static void mcp_mp_set_player_name(struct bt_mcp *mcp, const uint8_t *value,
 					uint16_t length)
 {
diff --git a/src/shared/mcp.h b/src/shared/mcp.h
index a2cd6fc45..ee57ed4bf 100644
--- a/src/shared/mcp.h
+++ b/src/shared/mcp.h
@@ -59,3 +59,5 @@ void *bt_mcp_get_user_data(struct bt_mcp *mcp);
 unsigned int bt_mcp_play(struct bt_mcp *mcp);
 unsigned int bt_mcp_pause(struct bt_mcp *mcp);
 unsigned int bt_mcp_stop(struct bt_mcp *mcp);
+unsigned int bt_mcp_next_track(struct bt_mcp *mcp);
+unsigned int bt_mcp_previous_track(struct bt_mcp *mcp);
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ v2 2/2] mcp: Implement Next Track and Previous Track commands
  2024-06-19 12:04 [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands Yauhen Kharuzhy
@ 2024-06-19 12:04 ` Yauhen Kharuzhy
  2024-06-19 14:10 ` [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands patchwork-bot+bluetooth
  2024-06-19 14:23 ` [BlueZ,v2,1/2] " bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: Yauhen Kharuzhy @ 2024-06-19 12:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Yauhen Kharuzhy

Add implementation of Next/Previous Track commands to the audio/mcp profile.

It is used by the Bluetooth media control widget in KDE, for example.
---
 profiles/audio/mcp.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/profiles/audio/mcp.c b/profiles/audio/mcp.c
index b410b3d2a..8d1b7588e 100644
--- a/profiles/audio/mcp.c
+++ b/profiles/audio/mcp.c
@@ -224,13 +224,27 @@ static int ct_stop(struct media_player *mp, void *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 = {
 	.set_setting	= NULL,
 	.play		= &ct_play,
 	.pause		= &ct_pause,
 	.stop		= &ct_stop,
-	.next		= NULL,
-	.previous	= NULL,
+	.next		= &ct_next,
+	.previous	= &ct_previous,
 	.fast_forward	= NULL,
 	.rewind		= NULL,
 	.press		= NULL,
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands
  2024-06-19 12:04 [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands Yauhen Kharuzhy
  2024-06-19 12:04 ` [PATCH BlueZ v2 2/2] mcp: Implement Next Track and Previous Track commands Yauhen Kharuzhy
@ 2024-06-19 14:10 ` patchwork-bot+bluetooth
  2024-06-19 14:23 ` [BlueZ,v2,1/2] " bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2024-06-19 14:10 UTC (permalink / raw)
  To: Yauhen Kharuzhy; +Cc: linux-bluetooth

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Wed, 19 Jun 2024 15:04:32 +0300 you wrote:
> Add bt_mcp_{next,previous}_track functions to shared MCP client
> profile code. This allows user to have basic control of the media player
> in addition to simple play/pause/stop actions.
> ---
>  src/shared/mcp.c | 20 ++++++++++++++++++++
>  src/shared/mcp.h |  2 ++
>  2 files changed, 22 insertions(+)

Here is the summary with links:
  - [BlueZ,v2,1/2] shared/mcp: Implement next/previous track commands
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=a91471400f97
  - [BlueZ,v2,2/2] mcp: Implement Next Track and Previous Track commands
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=811e48d340d8

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [BlueZ,v2,1/2] shared/mcp: Implement next/previous track commands
  2024-06-19 12:04 [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands Yauhen Kharuzhy
  2024-06-19 12:04 ` [PATCH BlueZ v2 2/2] mcp: Implement Next Track and Previous Track commands Yauhen Kharuzhy
  2024-06-19 14:10 ` [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands patchwork-bot+bluetooth
@ 2024-06-19 14:23 ` bluez.test.bot
  2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2024-06-19 14:23 UTC (permalink / raw)
  To: linux-bluetooth, yauhen.kharuzhy

[-- Attachment #1: Type: text/plain, Size: 1912 bytes --]

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

---Test result---

Test Summary:
CheckPatch                    FAIL      1.15 seconds
GitLint                       PASS      0.80 seconds
BuildEll                      PASS      24.92 seconds
BluezMake                     PASS      1708.96 seconds
MakeCheck                     PASS      13.42 seconds
MakeDistcheck                 PASS      181.15 seconds
CheckValgrind                 PASS      255.98 seconds
CheckSmatch                   PASS      366.72 seconds
bluezmakeextell               PASS      124.83 seconds
IncrementalBuild              PASS      3141.47 seconds
ScanBuild                     PASS      1103.64 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v2,2/2] mcp: Implement Next Track and Previous Track commands
WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#92: 
Add implementation of Next/Previous Track commands to the audio/mcp profile.

/github/workspace/src/src/13703755.patch total: 0 errors, 1 warnings, 29 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/13703755.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.




---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-19 14:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19 12:04 [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands Yauhen Kharuzhy
2024-06-19 12:04 ` [PATCH BlueZ v2 2/2] mcp: Implement Next Track and Previous Track commands Yauhen Kharuzhy
2024-06-19 14:10 ` [PATCH BlueZ v2 1/2] shared/mcp: Implement next/previous track commands patchwork-bot+bluetooth
2024-06-19 14:23 ` [BlueZ,v2,1/2] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).