[pulseaudio-discuss] [PATCH v3 10/11] udev: Store the seat id in device proplists

David Henningsson david.henningsson at canonical.com
Fri Dec 5 06:00:25 PST 2014



On 2014-12-04 19:44, Tanu Kaskinen wrote:
> When using PulseAudio in system mode, it may be interesting to know
> which seats the devices are assigned to. This will be used in the
> tunnel manager to filter out the devices that belong to other users.

I'd prefer if PA_PROP_UDEV_SEAT was called PA_PROP_DEVICE_SEAT, because 
the seat a device belongs to could be generically useful to e g volume 
control clients.

I'd also prefer if it was not filled in in case there was no such udev 
property, to rule out any possibility it gets filled in with the wrong 
value.

Seems reasonable otherwise.

> ---
>   src/modules/udev-util.c | 9 +++++++++
>   src/modules/udev-util.h | 2 ++
>   2 files changed, 11 insertions(+)
>
> diff --git a/src/modules/udev-util.c b/src/modules/udev-util.c
> index b0bb17d..f104c1d 100644
> --- a/src/modules/udev-util.c
> +++ b/src/modules/udev-util.c
> @@ -250,6 +250,15 @@ int pa_udev_get_info(int card_idx, pa_proplist *p) {
>           if ((v = udev_device_get_property_value(card, "SOUND_DESCRIPTION")) && *v)
>               pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, v);
>
> +    if (!pa_proplist_contains(p, PA_PROP_UDEV_SEAT)) {
> +        if ((udev_device_has_tag(card, "seat"))) {
> +            if ((v = udev_device_get_property_value(card, "ID_SEAT")) && *v)
> +                pa_proplist_sets(p, PA_PROP_UDEV_SEAT, v);
> +            else
> +                pa_proplist_sets(p, PA_PROP_UDEV_SEAT, "seat0");
> +        }
> +    }
> +
>       r = 0;
>
>   finish:
> diff --git a/src/modules/udev-util.h b/src/modules/udev-util.h
> index 251575b..70c5044 100644
> --- a/src/modules/udev-util.h
> +++ b/src/modules/udev-util.h
> @@ -24,6 +24,8 @@
>
>   #include <pulse/proplist.h>
>
> +#define PA_PROP_UDEV_SEAT "udev.seat"
> +
>   int pa_udev_get_info(int card_idx, pa_proplist *p);
>   char* pa_udev_get_property(int card_idx, const char *name);
>
>

-- 
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic


More information about the pulseaudio-discuss mailing list