* [PATCH - aconnect 1/1] Fix aconnect printing card and pid on older kernels
@ 2016-04-01 17:35 Adam Goode
2016-04-01 21:28 ` Martin Koegler
0 siblings, 1 reply; 2+ messages in thread
From: Adam Goode @ 2016-04-01 17:35 UTC (permalink / raw)
To: patch; +Cc: Adam Goode, alsa-devel, martin.koegler
alsa-lib is changed to return a distinct negative value if running on
an older kernel. -1 is only returned now if the kernel knows for sure
that there is no card or pid. On older kernels, alsa-lib will return
-ENOSYS.
Signed-off-by: Adam Goode <agoode@google.com>
diff --git a/seq/aconnect/aconnect.c b/seq/aconnect/aconnect.c
index 85a7770..bbc5bb3 100644
--- a/seq/aconnect/aconnect.c
+++ b/seq/aconnect/aconnect.c
@@ -177,13 +177,13 @@ static void print_port(snd_seq_t *seq, snd_seq_client_info_t *cinfo,
#ifdef HAVE_SEQ_CLIENT_INFO_GET_CARD
card = snd_seq_client_info_get_card(cinfo);
#endif
- if (card != -1)
+ if (card >= 0)
printf(",card=%d", card);
#ifdef HAVE_SEQ_CLIENT_INFO_GET_PID
pid = snd_seq_client_info_get_pid(cinfo);
#endif
- if (pid != -1)
+ if (pid >= 0)
printf(",pid=%d", pid);
printf("]\n");
}
--
2.8.0.rc3.226.g39d4020
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH - aconnect 1/1] Fix aconnect printing card and pid on older kernels
2016-04-01 17:35 [PATCH - aconnect 1/1] Fix aconnect printing card and pid on older kernels Adam Goode
@ 2016-04-01 21:28 ` Martin Koegler
0 siblings, 0 replies; 2+ messages in thread
From: Martin Koegler @ 2016-04-01 21:28 UTC (permalink / raw)
To: Adam Goode; +Cc: alsa-devel, patch, martin.koegler
On Fri, Apr 01, 2016 at 01:35:01PM -0400, Adam Goode wrote:
> alsa-lib is changed to return a distinct negative value if running on
> an older kernel. -1 is only returned now if the kernel knows for sure
> that there is no card or pid. On older kernels, alsa-lib will return
> -ENOSYS.
>
Shouldn't we also update the default values of card/pid to -ENOSYS to be more consistent:
int card = -1, pid = -1;
> @@ -177,13 +177,13 @@ static void print_port(snd_seq_t *seq, snd_seq_client_info_t *cinfo,
> #ifdef HAVE_SEQ_CLIENT_INFO_GET_CARD
> card = snd_seq_client_info_get_card(cinfo);
> #endif
> - if (card != -1)
> + if (card >= 0)
> printf(",card=%d", card);
aconnect from alsa-utils 1.1.1 will break with alsa-lib containing your patch.
The new API is propably not yet widely used, so I think that a ABI change can still be possible.
But in that case, alsa-lib/alsa-utils 1.1.1 need quickly be replaced by new releases, so that people
don't start using the old API.
Regards,
Martin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-01 21:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-01 17:35 [PATCH - aconnect 1/1] Fix aconnect printing card and pid on older kernels Adam Goode
2016-04-01 21:28 ` Martin Koegler
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.