Hi Pierre,
On 8/30/2024 2:27 AM, Pierre-Louis Bossart wrote:
/* Selects the latest USB headset plugged in for offloading */
if (data->hs_jack && list_empty(&data->devices))
snd_jack_report(data->hs_jack->jack, SND_JACK_USB);
with the list_empty check, this looks like only the first connected headset will be handled, not the last?
Sorry, the comment is misplaced. It should be meant to explain:
/* Selects the latest USB headset plugged in for offloading */ list_add_tail(&sdev->list, &data->devices);
The above IF check is to say that we'll only notify the USB jack if there is an available USB audio device (capable of offloading) connected. I guess it might make sense to notify the snd jack on every USB audio device connection. Currently, it will notify on the first device identified (present) and the last device removed (not present).
Thanks
Wesley Cheng
list_add_tail(&sdev->list, &data->devices);
} else { list_del(&sdev->list);
if (data->hs_jack && list_empty(&data->devices))
snd_jack_report(data->hs_jack->jack, 0);
} mutex_unlock(&data->mutex);
return 0;
}