mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	alsa: seq: double-check midi client version
Check midi client version after setting it, to see if it was really successfully set. Old kernels without UMP don't know about the midi version fields, so snd_seq_set_client_midi_version() appears to fail silently there.
This commit is contained in:
		
							parent
							
								
									e0938303e6
								
							
						
					
					
						commit
						6fe1c6d67b
					
				
					 1 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -44,9 +44,27 @@ static int seq_open(struct seq_state *state, struct seq_conn *conn, bool with_qu
 | 
			
		|||
 | 
			
		||||
#ifdef HAVE_ALSA_UMP
 | 
			
		||||
	res = snd_seq_set_client_midi_version(conn->hndl, SND_SEQ_CLIENT_UMP_MIDI_2_0);
 | 
			
		||||
	if (!res) {
 | 
			
		||||
		snd_seq_client_info_t *info = NULL;
 | 
			
		||||
 | 
			
		||||
		/* Double check client version */
 | 
			
		||||
		res = snd_seq_client_info_malloc(&info);
 | 
			
		||||
		if (!res)
 | 
			
		||||
			res = snd_seq_get_client_info(conn->hndl, info);
 | 
			
		||||
		if (!res) {
 | 
			
		||||
			res = snd_seq_client_info_get_midi_version(info);
 | 
			
		||||
			if (res == SND_SEQ_CLIENT_UMP_MIDI_2_0)
 | 
			
		||||
				res = 0;
 | 
			
		||||
			else
 | 
			
		||||
				res = -EIO;
 | 
			
		||||
		}
 | 
			
		||||
		if (info)
 | 
			
		||||
			snd_seq_client_info_free(info);
 | 
			
		||||
	}
 | 
			
		||||
#else
 | 
			
		||||
	res = -EOPNOTSUPP;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	if (res < 0) {
 | 
			
		||||
		spa_log_lev(state->log, (probe_ump ? SPA_LOG_LEVEL_INFO : SPA_LOG_LEVEL_ERROR),
 | 
			
		||||
				"%p: ALSA failed to enable UMP MIDI: %s", state, snd_strerror(res));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue