File tree 1 file changed +11
-0
lines changed
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 17
17
#include "bluealsactl.h"
18
18
#include "shared/dbus-client-pcm.h"
19
19
20
+ static int ba_pcm_cmp (const void * a , const void * b ) {
21
+ const struct ba_pcm * pcm_a = a ;
22
+ const struct ba_pcm * pcm_b = b ;
23
+ if (pcm_a -> sequence == pcm_b -> sequence )
24
+ return strcmp (pcm_a -> pcm_path , pcm_b -> pcm_path );
25
+ return pcm_a -> sequence - pcm_b -> sequence ;
26
+ }
27
+
20
28
static void usage (const char * command ) {
21
29
printf ("List all BlueALSA PCM paths.\n\n" );
22
30
bactl_print_usage ("%s [OPTION]..." , command );
@@ -64,6 +72,9 @@ static int cmd_list_pcms_func(int argc, char *argv[]) {
64
72
return EXIT_FAILURE ;
65
73
}
66
74
75
+ /* Sort PCMs from the oldest to the newest (most recently added). */
76
+ qsort (pcms , pcms_count , sizeof (* pcms ), ba_pcm_cmp );
77
+
67
78
for (size_t i = 0 ; i < pcms_count ; i ++ ) {
68
79
printf ("%s\n" , pcms [i ].pcm_path );
69
80
if (config .verbose ) {
You can’t perform that action at this time.
0 commit comments