return false;
}
+static bool is_supported_stream_role_for_usb(const char *role) {
+ pa_assert(role);
+
+ if (pa_streq(STREAM_ROLE_MEDIA, role))
+ return true;
+
+ pa_log_error("not supported role for usb(%s)", role);
+
+ return false;
+}
+
+static bool skip_usb_device(const char *stream_role, pa_tz_device *device) {
+ char *specified_stream_role;
+
+ pa_assert(stream_role);
+ pa_assert(device);
+
+ if (!pa_streq(pa_tz_device_get_type(device), DEVICE_TYPE_USB_AUDIO))
+ return false;
+
+ if (!(specified_stream_role = pa_tz_device_get_specified_stream_role(device)))
+ return false;
+
+ if (is_supported_stream_role_for_usb(specified_stream_role) &&
+ pa_streq(stream_role, specified_stream_role))
+ return false;
+
+ pa_log_info("skip this usb device, stream role(%s), specified stream role(%s)", stream_role, specified_stream_role);
+
+ return true;
+}
+
static inline bool is_cached_device_connected(const char* device_type, stream_type_t stream_type) {
if (cached_connected_devices[convert_device_type_str(device_type)][CONVERT_TO_DEVICE_DIRECTION(stream_type)-1] > 0)
return true;
pa_log_info(" ** found a matched device: type[%-16s], direction[0x%x]", dm_device_type, dm_device_direction);
if (skip_bt_sco_device(u, data->stream_role, dm_device_type))
continue;
+ if (skip_usb_device(data->stream_role, device))
+ continue;
if (data->stream_type == STREAM_SINK_INPUT) {
if (data->route_type == STREAM_ROUTE_TYPE_AUTO_ALL && u->module_combine_sink) {
if (pa_streq(device_type, dm_device_type) && IS_AVAILABLE_DIRECTION(data->stream_type, dm_device_direction)) {
if (skip_bt_sco_device(u, data->stream_role, dm_device_type))
continue;
+ if (skip_usb_device(data->stream_role, device))
+ continue;
if (!latest_device || (latest_creation_time <= creation_time)) {
latest_device = device;
dm_device_type, dm_device_direction, dm_device_id);
if (pa_streq(device_type, dm_device_type) && IS_AVAILABLE_DIRECTION(data->stream_type, dm_device_direction)) {
pa_log_debug(" ** found a matched device: type[%-16s], direction[0x%x]", dm_device_type, dm_device_direction);
+ if (skip_usb_device(data->stream_role, device))
+ continue;
use_internal_codec = pa_tz_device_is_use_internal_codec(device);
if (use_internal_codec) {
/* if it needs to skip it, keep going to next device for proper UCM setting */
pa_log_debug(" -- type[%-16s], direction[0x%x], id[%u], creation_time[%llu]",
dm_device_type, dm_device_direction, dm_device_id, creation_time);
if (pa_streq(device_type, dm_device_type) && IS_AVAILABLE_DIRECTION(data->stream_type, dm_device_direction)) {
+ if (skip_usb_device(data->stream_role, device))
+ continue;
use_internal_codec = pa_tz_device_is_use_internal_codec(device);
if (use_internal_codec) {
/* if it needs to skip it, keep going to next device for proper UCM setting */