I'm going to use the port device class for generating the name for port nodes. --- src/modules/bluetooth/module-bluetooth-device.c | 2 ++ src/pulsecore/device-port.c | 8 ++++++++ src/pulsecore/device-port.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index aadc260..f7c6a57 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -2120,6 +2120,7 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) { pa_device_port_new_data_init(&port_data); pa_device_port_new_data_set_name(&port_data, u->output_port_name); pa_device_port_new_data_set_description(&port_data, output_description); + pa_device_port_new_data_set_device_class(&port_data, device_class); pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_OUTPUT); pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_OUTPUT)); pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0)); @@ -2129,6 +2130,7 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) { pa_device_port_new_data_init(&port_data); pa_device_port_new_data_set_name(&port_data, u->input_port_name); pa_device_port_new_data_set_description(&port_data, input_description); + pa_device_port_new_data_set_device_class(&port_data, device_class); pa_device_port_new_data_set_direction(&port_data, PA_DIRECTION_INPUT); pa_device_port_new_data_set_available(&port_data, get_port_availability(u, PA_DIRECTION_INPUT)); pa_assert_se(port = pa_device_port_new(u->core, &port_data, 0)); diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c index c5d49f3..d04c74b 100644 --- a/src/pulsecore/device-port.c +++ b/src/pulsecore/device-port.c @@ -30,6 +30,7 @@ pa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *d pa_assert(data); pa_zero(*data); + data->device_class = PA_DEVICE_CLASS_UNKNOWN; data->available = PA_AVAILABLE_UNKNOWN; return data; } @@ -48,6 +49,12 @@ void pa_device_port_new_data_set_description(pa_device_port_new_data *data, cons data->description = pa_xstrdup(description); } +void pa_device_port_new_data_set_device_class(pa_device_port_new_data *data, pa_device_class_t device_class) { + pa_assert(data); + + data->device_class = device_class; +} + void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available) { pa_assert(data); @@ -122,6 +129,7 @@ pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, si data->name = NULL; p->description = data->description; data->description = NULL; + p->device_class = data->device_class; p->core = c; p->card = NULL; p->priority = 0; diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h index b10d554..6c54696 100644 --- a/src/pulsecore/device-port.h +++ b/src/pulsecore/device-port.h @@ -33,6 +33,8 @@ typedef struct pa_device_port pa_device_port; #include <inttypes.h> #include <pulse/def.h> + +#include <pulsecore/device-class.h> #include <pulsecore/object.h> #include <pulsecore/hashmap.h> #include <pulsecore/core.h> @@ -45,6 +47,7 @@ struct pa_device_port { char *name; char *description; + pa_device_class_t device_class; unsigned priority; pa_available_t available; /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */ @@ -65,6 +68,7 @@ PA_DECLARE_PUBLIC_CLASS(pa_device_port); typedef struct pa_device_port_new_data { char *name; char *description; + pa_device_class_t device_class; pa_available_t available; pa_direction_t direction; } pa_device_port_new_data; @@ -72,6 +76,7 @@ typedef struct pa_device_port_new_data { pa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *data); void pa_device_port_new_data_set_name(pa_device_port_new_data *data, const char *name); void pa_device_port_new_data_set_description(pa_device_port_new_data *data, const char *description); +void pa_device_port_new_data_set_device_class(pa_device_port_new_data *data, pa_device_class_t device_class); void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available); void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_direction_t direction); void pa_device_port_new_data_done(pa_device_port_new_data *data); -- 1.8.1.2