mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	bluez5: backend-native: fix all rfcomm lookups to check profile
The rfcomm list may contain various AG & HF ones, so the profile must be checked everywhere they are looked up. Fix the rfcomm lookups everywhere to do it. Fixes Pipewire<->Pipewire HFP connections, and sending HFP HF commands to HSP or AG.
This commit is contained in:
		
							parent
							
								
									651cb7bd71
								
							
						
					
					
						commit
						05402284c1
					
				
					 1 changed files with 9 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -1803,8 +1803,10 @@ static void sco_listen_event(struct spa_source *source)
 | 
			
		|||
 | 
			
		||||
	/* Find transport for local and remote address */
 | 
			
		||||
	spa_list_for_each(rfcomm, &backend->rfcomm_list, link) {
 | 
			
		||||
		if (rfcomm->transport && spa_streq(rfcomm->transport->device->address, remote_address) &&
 | 
			
		||||
		    spa_streq(rfcomm->transport->device->adapter->address, local_address)) {
 | 
			
		||||
		if ((rfcomm->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY) &&
 | 
			
		||||
				rfcomm->transport &&
 | 
			
		||||
				spa_streq(rfcomm->device->address, remote_address) &&
 | 
			
		||||
				spa_streq(rfcomm->device->adapter->address, local_address)) {
 | 
			
		||||
			t = rfcomm->transport;
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			@ -1815,12 +1817,7 @@ static void sco_listen_event(struct spa_source *source)
 | 
			
		|||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* The Synchronous Connection shall always be established by the AG, i.e. the remote profile
 | 
			
		||||
	   should be a HSP AG or HFP AG profile */
 | 
			
		||||
	if ((t->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY) == 0) {
 | 
			
		||||
		spa_log_debug(backend->log, "transport %p: Rejecting incoming audio connection to an AG profile", t);
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	spa_assert(t->profile & SPA_BT_PROFILE_HEADSET_AUDIO_GATEWAY);
 | 
			
		||||
 | 
			
		||||
	if (t->fd >= 0) {
 | 
			
		||||
		spa_log_debug(backend->log, "transport %p: Rejecting, audio already connected", t);
 | 
			
		||||
| 
						 | 
				
			
			@ -2006,10 +2003,6 @@ static int backend_native_supports_codec(void *data, struct spa_bt_device *devic
 | 
			
		|||
	if (codec == HFP_AUDIO_CODEC_CVSD)
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	if (rfcomm->profile != SPA_BT_PROFILE_HFP_AG &&
 | 
			
		||||
			rfcomm->profile != SPA_BT_PROFILE_HFP_HF)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	if (!rfcomm->codec_negotiation_supported)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2665,7 +2658,7 @@ static void send_ciev_for_each_rfcomm(struct impl *backend, int indicator, int v
 | 
			
		|||
	struct rfcomm *rfcomm;
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(rfcomm, &backend->rfcomm_list, link) {
 | 
			
		||||
		if (rfcomm->slc_configured &&
 | 
			
		||||
		if (rfcomm->profile == SPA_BT_PROFILE_HFP_HF && rfcomm->slc_configured &&
 | 
			
		||||
		    ((indicator == CIND_CALL || indicator == CIND_CALLSETUP || indicator == CIND_CALLHELD) ||
 | 
			
		||||
			(rfcomm->cind_call_notify && (rfcomm->cind_enabled_indicators & (1 << indicator)))))
 | 
			
		||||
			rfcomm_send_reply(rfcomm, "+CIEV: %d,%d", indicator, value);
 | 
			
		||||
| 
						 | 
				
			
			@ -2694,7 +2687,7 @@ static void ring_timer_event(void *data, uint64_t expirations)
 | 
			
		|||
	spa_loop_utils_update_timer(backend->loop_utils, backend->ring_timer, &ts, NULL, false);
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(rfcomm, &backend->rfcomm_list, link) {
 | 
			
		||||
		if (rfcomm->slc_configured) {
 | 
			
		||||
		if (rfcomm->profile == SPA_BT_PROFILE_HFP_HF  && rfcomm->slc_configured) {
 | 
			
		||||
			rfcomm_send_reply(rfcomm, "RING");
 | 
			
		||||
			if (rfcomm->clip_notify && number)
 | 
			
		||||
				rfcomm_send_reply(rfcomm, "+CLIP: \"%s\",%u", number, type);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue