[pulseaudio-discuss] [PATCH 45/56] bluetooth: Create BlueZ 5 card ports

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Jul 22 08:41:11 PDT 2013


On Fri, 2013-07-12 at 15:07 -0300, jprvita at gmail.com wrote:
> +/* Run from main thread */
> +static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
> +    pa_device_port *port;
> +    pa_device_port_new_data port_data;
> +    const char *name_prefix, *input_description, *output_description;
> +
> +    pa_assert(u);
> +    pa_assert(ports);
> +    pa_assert(u->device);
> +
> +    switch (pa_bluetooth_form_factor_from_class(u->device->class_of_device)) {
> +        case PA_BLUETOOTH_FORM_FACTOR_HEADSET:
> +            name_prefix = "headset";
> +            input_description = output_description = _("Headset");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_HANDSFREE:
> +            name_prefix = "handsfree";
> +            input_description = output_description = _("Handsfree");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_MICROPHONE:
> +            name_prefix = "microphone";
> +            input_description = _("Microphone");
> +            output_description = _("Bluetooth Output");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_SPEAKER:
> +            name_prefix = "speaker";
> +            input_description = _("Bluetooth Input");
> +            output_description = _("Speaker");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_HEADPHONE:
> +            name_prefix = "headphone";
> +            input_description = _("Bluetooth Input");
> +            output_description = _("Headphone");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_PORTABLE:
> +            name_prefix = "portable";
> +            input_description = output_description = _("Portable");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_CAR:
> +            name_prefix = "car";
> +            input_description = output_description = _("Car");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_HIFI:
> +            name_prefix = "hifi";
> +            input_description = output_description = _("HiFi");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_PHONE:
> +            name_prefix = "phone";
> +            input_description = output_description = _("Phone");
> +            break;
> +
> +        case PA_BLUETOOTH_FORM_FACTOR_UNKNOWN:
> +        default:

Having a default section suppresses compiler warnings about not handling
every case. If the form factor enum is extended, this piece of code
should be changed too, so the compiler warning is good, and we shouldn't
have a default section here.

-- 
Tanu



More information about the pulseaudio-discuss mailing list