bluetooth: Set "computer" form-factor based on CoD

The Class of Device field has a value for "computer" in its major
portion. If the remote device behind a card is a computer, the
form-factor should be set accordingly.
This commit is contained in:
João Paulo Rechi Vita 2019-05-21 20:18:03 -07:00 committed by João Paulo Rechi Vita
parent ca9b723afa
commit dd81386f97

View file

@ -168,6 +168,7 @@ typedef enum pa_bluetooth_form_factor {
PA_BLUETOOTH_FORM_FACTOR_CAR,
PA_BLUETOOTH_FORM_FACTOR_HIFI,
PA_BLUETOOTH_FORM_FACTOR_PHONE,
PA_BLUETOOTH_FORM_FACTOR_COMPUTER,
} pa_bluetooth_form_factor_t;
/* Run from main thread */
@ -194,6 +195,8 @@ static pa_bluetooth_form_factor_t form_factor_from_class(uint32_t class_of_devic
minor = (class_of_device >> 2) & 0x3F;
switch (major) {
case 1:
return PA_BLUETOOTH_FORM_FACTOR_COMPUTER;
case 2:
return PA_BLUETOOTH_FORM_FACTOR_PHONE;
case 4:
@ -234,6 +237,8 @@ static const char *form_factor_to_string(pa_bluetooth_form_factor_t ff) {
return "hifi";
case PA_BLUETOOTH_FORM_FACTOR_PHONE:
return "phone";
case PA_BLUETOOTH_FORM_FACTOR_COMPUTER:
return "computer";
}
pa_assert_not_reached();
@ -1950,6 +1955,11 @@ static void create_card_ports(struct userdata *u, pa_hashmap *ports) {
input_type = output_type = PA_DEVICE_PORT_TYPE_PHONE;
break;
case PA_BLUETOOTH_FORM_FACTOR_COMPUTER:
name_prefix = "computer";
input_description = output_description = _("Computer");
break;
case PA_BLUETOOTH_FORM_FACTOR_UNKNOWN:
break;
}