* [PATCH BlueZ v2 1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range
@ 2025-01-23 20:54 Luiz Augusto von Dentz
2025-01-23 20:54 ` [PATCH BlueZ v2 2/2] vcp: Fix using scaled values for volume Luiz Augusto von Dentz
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-01-23 20:54 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes the Volume property to follow the profile defined range.
---
doc/org.bluez.MediaTransport.rst | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/doc/org.bluez.MediaTransport.rst b/doc/org.bluez.MediaTransport.rst
index 78789bc8044a..a4894a413652 100644
--- a/doc/org.bluez.MediaTransport.rst
+++ b/doc/org.bluez.MediaTransport.rst
@@ -128,7 +128,8 @@ uint16 Volume [readwrite, optional]
Indicates volume level of the transport, this property is only writeable
when the transport was acquired by the sender.
- Possible Values: 0-127
+ Possible Values: 0-127 (A2DP)
+ 0-255 (BAP)
object Endpoint [readonly, optional, experimental]
``````````````````````````````````````````````````
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH BlueZ v2 2/2] vcp: Fix using scaled values for volume
2025-01-23 20:54 [PATCH BlueZ v2 1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range Luiz Augusto von Dentz
@ 2025-01-23 20:54 ` Luiz Augusto von Dentz
2025-01-23 22:07 ` [BlueZ,v2,1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range bluez.test.bot
2025-01-24 18:40 ` [PATCH BlueZ v2 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2025-01-23 20:54 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This makes the volume range 0-255 as per VCP spec rather than scaling it
to fit 0-127.
---
profiles/audio/transport.c | 18 +++++++++---------
profiles/audio/vcp.c | 23 +++++------------------
profiles/audio/vcp.h | 4 ++--
3 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index eff95a7c2655..5fd20910f745 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -126,8 +126,8 @@ struct media_transport_ops {
void (*set_state)(struct media_transport *transport,
transport_state_t state);
void *(*get_stream)(struct media_transport *transport);
- int8_t (*get_volume)(struct media_transport *transport);
- int (*set_volume)(struct media_transport *transport, int8_t level);
+ uint8_t (*get_volume)(struct media_transport *transport);
+ int (*set_volume)(struct media_transport *transport, uint8_t level);
int (*set_delay)(struct media_transport *transport, uint16_t delay);
void (*update_links)(const struct media_transport *transport);
GDestroyNotify destroy;
@@ -616,7 +616,7 @@ static void transport_a2dp_remove_owner(struct media_transport *transport,
a2dp->cancel_resume = FALSE;
}
-static int8_t transport_a2dp_get_volume(struct media_transport *transport)
+static uint8_t transport_a2dp_get_volume(struct media_transport *transport)
{
struct a2dp_transport *a2dp = transport->data;
return a2dp->volume;
@@ -624,7 +624,7 @@ static int8_t transport_a2dp_get_volume(struct media_transport *transport)
#ifdef HAVE_AVRCP
static int transport_a2dp_src_set_volume(struct media_transport *transport,
- int8_t level)
+ uint8_t level)
{
struct a2dp_transport *a2dp = transport->data;
@@ -635,7 +635,7 @@ static int transport_a2dp_src_set_volume(struct media_transport *transport,
}
static int transport_a2dp_snk_set_volume(struct media_transport *transport,
- int8_t level)
+ uint8_t level)
{
struct a2dp_transport *a2dp = transport->data;
bool notify;
@@ -2190,13 +2190,13 @@ static void bap_connecting(struct bt_bap_stream *stream, bool state, int fd,
bap_update_links(transport);
}
-static int8_t transport_bap_get_volume(struct media_transport *transport)
+static uint8_t transport_bap_get_volume(struct media_transport *transport)
{
return bt_audio_vcp_get_volume(transport->device);
}
static int transport_bap_set_volume(struct media_transport *transport,
- int8_t volume)
+ uint8_t volume)
{
return bt_audio_vcp_set_volume(transport->device, volume) ? 0 : -EIO;
}
@@ -2355,7 +2355,7 @@ static void transport_asha_cancel(struct media_transport *transport, guint id)
}
}
-static int8_t transport_asha_get_volume(struct media_transport *transport)
+static uint8_t transport_asha_get_volume(struct media_transport *transport)
{
struct bt_asha_device *asha_dev = transport->data;
int8_t volume;
@@ -2370,7 +2370,7 @@ static int8_t transport_asha_get_volume(struct media_transport *transport)
}
static int transport_asha_set_volume(struct media_transport *transport,
- int8_t volume)
+ uint8_t volume)
{
struct bt_asha_device *asha_dev = transport->data;
int scaled_volume;
diff --git a/profiles/audio/vcp.c b/profiles/audio/vcp.c
index 608496a003b6..423210b4af3b 100644
--- a/profiles/audio/vcp.c
+++ b/profiles/audio/vcp.c
@@ -103,25 +103,12 @@ static bool match_data(const void *data, const void *match_data)
return vdata->vcp == vcp;
}
-static int8_t scale_volume(uint8_t volume)
-{
- /* Convert 0-255 to 0-127. */
- return volume / 2;
-}
-
-static uint8_t unscale_volume(int8_t volume)
-{
- /* Convert 0-127 to 0-255. */
- return volume * 2;
-}
-
static void vcp_volume_changed(struct bt_vcp *vcp, uint8_t volume)
{
struct vcp_data *data = queue_find(sessions, match_data, vcp);
if (data)
- media_transport_update_device_volume(data->device,
- scale_volume(volume));
+ media_transport_update_device_volume(data->device, volume);
}
static void vcp_data_add(struct vcp_data *data)
@@ -179,22 +166,22 @@ static void vcp_data_remove(struct vcp_data *data)
}
}
-int8_t bt_audio_vcp_get_volume(struct btd_device *device)
+uint8_t bt_audio_vcp_get_volume(struct btd_device *device)
{
struct vcp_data *data = queue_find(sessions, match_device, device);
if (data)
- return scale_volume(bt_vcp_get_volume(data->vcp));
+ return bt_vcp_get_volume(data->vcp);
return 0;
}
-bool bt_audio_vcp_set_volume(struct btd_device *device, int8_t volume)
+bool bt_audio_vcp_set_volume(struct btd_device *device, uint8_t volume)
{
struct vcp_data *data = queue_find(sessions, match_device, device);
if (data)
- return bt_vcp_set_volume(data->vcp, unscale_volume(volume));
+ return bt_vcp_set_volume(data->vcp, volume);
return FALSE;
}
diff --git a/profiles/audio/vcp.h b/profiles/audio/vcp.h
index f313cd96a5fc..cf7935d1a4ea 100644
--- a/profiles/audio/vcp.h
+++ b/profiles/audio/vcp.h
@@ -8,5 +8,5 @@
*
*/
-int8_t bt_audio_vcp_get_volume(struct btd_device *device);
-bool bt_audio_vcp_set_volume(struct btd_device *device, int8_t volume);
+uint8_t bt_audio_vcp_get_volume(struct btd_device *device);
+bool bt_audio_vcp_set_volume(struct btd_device *device, uint8_t volume);
--
2.48.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [BlueZ,v2,1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range
2025-01-23 20:54 [PATCH BlueZ v2 1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range Luiz Augusto von Dentz
2025-01-23 20:54 ` [PATCH BlueZ v2 2/2] vcp: Fix using scaled values for volume Luiz Augusto von Dentz
@ 2025-01-23 22:07 ` bluez.test.bot
2025-01-24 18:40 ` [PATCH BlueZ v2 1/2] " patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2025-01-23 22:07 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
[-- Attachment #1: Type: text/plain, Size: 1260 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=927943
---Test result---
Test Summary:
CheckPatch PENDING 0.31 seconds
GitLint PENDING 0.26 seconds
BuildEll PASS 20.26 seconds
BluezMake PASS 1460.19 seconds
MakeCheck PASS 13.52 seconds
MakeDistcheck PASS 158.25 seconds
CheckValgrind PASS 213.51 seconds
CheckSmatch PASS 269.96 seconds
bluezmakeextell PASS 97.75 seconds
IncrementalBuild PENDING 0.35 seconds
ScanBuild PASS 867.48 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH BlueZ v2 1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range
2025-01-23 20:54 [PATCH BlueZ v2 1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range Luiz Augusto von Dentz
2025-01-23 20:54 ` [PATCH BlueZ v2 2/2] vcp: Fix using scaled values for volume Luiz Augusto von Dentz
2025-01-23 22:07 ` [BlueZ,v2,1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range bluez.test.bot
@ 2025-01-24 18:40 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2025-01-24 18:40 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hello:
This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 23 Jan 2025 15:54:10 -0500 you wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> This makes the Volume property to follow the profile defined range.
> ---
> doc/org.bluez.MediaTransport.rst | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Here is the summary with links:
- [BlueZ,v2,1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=9daadc32e807
- [BlueZ,v2,2/2] vcp: Fix using scaled values for volume
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=0aac6883b3a3
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
end of thread, other threads:[~2025-01-24 18:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-23 20:54 [PATCH BlueZ v2 1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range Luiz Augusto von Dentz
2025-01-23 20:54 ` [PATCH BlueZ v2 2/2] vcp: Fix using scaled values for volume Luiz Augusto von Dentz
2025-01-23 22:07 ` [BlueZ,v2,1/2] org.bluez.MediaTransport: Allow Volume property to follow profile range bluez.test.bot
2025-01-24 18:40 ` [PATCH BlueZ v2 1/2] " patchwork-bot+bluetooth
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.