mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Fix premature acquire attempts
A transport should be considered connected only after the connection procedure is complete, as expressed in audio_state_to_transport_state(). module-bluetooth-device should be loaded only after at least one transport is not only created (during configuration), but also connected. This fixes the issue of premature acquire attempts sometimes experienced when a headset is connected (issue not present in v3.0 though).
This commit is contained in:
		
							parent
							
								
									2c666e3e16
								
							
						
					
					
						commit
						5d4b7c4a89
					
				
					 2 changed files with 5 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1888,7 +1888,7 @@ static int setup_transport(struct userdata *u) {
 | 
			
		|||
 | 
			
		||||
    /* check if profile has a transport */
 | 
			
		||||
    t = u->device->transports[u->profile];
 | 
			
		||||
    if (t == NULL) {
 | 
			
		||||
    if (!t || t->state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED) {
 | 
			
		||||
        pa_log_warn("Profile has no transport");
 | 
			
		||||
        return -1;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -2085,7 +2085,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) {
 | 
			
		|||
    if (*d != PROFILE_OFF) {
 | 
			
		||||
        const pa_bluetooth_device *device = u->device;
 | 
			
		||||
 | 
			
		||||
        if (!device->transports[*d]) {
 | 
			
		||||
        if (!device->transports[*d] || device->transports[*d]->state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED) {
 | 
			
		||||
            pa_log_warn("Profile not connected, refused to switch profile to %s", new_profile->name);
 | 
			
		||||
            return -PA_ERR_IO;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -2348,7 +2348,8 @@ static int add_card(struct userdata *u) {
 | 
			
		|||
 | 
			
		||||
    d = PA_CARD_PROFILE_DATA(u->card->active_profile);
 | 
			
		||||
 | 
			
		||||
    if (*d != PROFILE_OFF && !device->transports[*d]) {
 | 
			
		||||
    if (*d != PROFILE_OFF && (!device->transports[*d] ||
 | 
			
		||||
                              device->transports[*d]->state == PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED)) {
 | 
			
		||||
        pa_log_warn("Default profile not connected, selecting off profile");
 | 
			
		||||
        u->card->active_profile = pa_hashmap_get(u->card->profiles, "off");
 | 
			
		||||
        u->card->save_profile = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue