mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-09 17:15:43 +01:00
aconnect: Drop superfluous ifdefs
Now that the latest alsa-lib 1.2.12 became mandatory, all ugly ifdefs can be dropped. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
d26b66f881
commit
c7b342db82
1 changed files with 0 additions and 31 deletions
|
@ -29,12 +29,7 @@
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
#ifdef SND_SEQ_PORT_CAP_INACTIVE
|
|
||||||
#define HANDLE_SHOW_ALL
|
|
||||||
static int show_all;
|
static int show_all;
|
||||||
#else
|
|
||||||
#define show_all 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...)
|
static void error_handler(const char *file, int line, const char *function, int err, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
@ -67,9 +62,7 @@ static void usage(void)
|
||||||
printf(_(" aconnect -i|-o [-options]\n"));
|
printf(_(" aconnect -i|-o [-options]\n"));
|
||||||
printf(_(" -i,--input list input (readable) ports\n"));
|
printf(_(" -i,--input list input (readable) ports\n"));
|
||||||
printf(_(" -o,--output list output (writable) ports\n"));
|
printf(_(" -o,--output list output (writable) ports\n"));
|
||||||
#ifdef HANDLE_SHOW_ALL
|
|
||||||
printf(_(" -a,--all show inactive ports, too\n"));
|
printf(_(" -a,--all show inactive ports, too\n"));
|
||||||
#endif
|
|
||||||
printf(_(" -l,--list list current connections of each port\n"));
|
printf(_(" -l,--list list current connections of each port\n"));
|
||||||
printf(_(" * Remove all exported connections\n"));
|
printf(_(" * Remove all exported connections\n"));
|
||||||
printf(_(" -x, --removeall\n"));
|
printf(_(" -x, --removeall\n"));
|
||||||
|
@ -84,15 +77,11 @@ static void usage(void)
|
||||||
|
|
||||||
#define perm_ok(cap,bits) (((cap) & (bits)) == (bits))
|
#define perm_ok(cap,bits) (((cap) & (bits)) == (bits))
|
||||||
|
|
||||||
#ifdef SND_SEQ_PORT_DIR_INPUT
|
|
||||||
static int check_direction(snd_seq_port_info_t *pinfo, int bit)
|
static int check_direction(snd_seq_port_info_t *pinfo, int bit)
|
||||||
{
|
{
|
||||||
int dir = snd_seq_port_info_get_direction(pinfo);
|
int dir = snd_seq_port_info_get_direction(pinfo);
|
||||||
return !dir || (dir & bit);
|
return !dir || (dir & bit);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define check_direction(x, y) 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int check_permission(snd_seq_port_info_t *pinfo, int perm)
|
static int check_permission(snd_seq_port_info_t *pinfo, int perm)
|
||||||
{
|
{
|
||||||
|
@ -174,20 +163,16 @@ static void do_search_port(snd_seq_t *seq, int perm, action_func_t do_action)
|
||||||
/* reset query info */
|
/* reset query info */
|
||||||
snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
|
snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));
|
||||||
snd_seq_port_info_set_port(pinfo, -1);
|
snd_seq_port_info_set_port(pinfo, -1);
|
||||||
#ifdef HANDLE_SHOW_ALL
|
|
||||||
if (show_all)
|
if (show_all)
|
||||||
snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_INACTIVE);
|
snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_INACTIVE);
|
||||||
#endif
|
|
||||||
count = 0;
|
count = 0;
|
||||||
while (snd_seq_query_next_port(seq, pinfo) >= 0) {
|
while (snd_seq_query_next_port(seq, pinfo) >= 0) {
|
||||||
if (check_permission(pinfo, perm)) {
|
if (check_permission(pinfo, perm)) {
|
||||||
do_action(seq, cinfo, pinfo, count);
|
do_action(seq, cinfo, pinfo, count);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
#ifdef HANDLE_SHOW_ALL
|
|
||||||
if (show_all)
|
if (show_all)
|
||||||
snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_INACTIVE);
|
snd_seq_port_info_set_capability(pinfo, SND_SEQ_PORT_CAP_INACTIVE);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,7 +190,6 @@ static void print_port(snd_seq_t *seq ATTRIBUTE_UNUSED,
|
||||||
snd_seq_client_info_get_name(cinfo),
|
snd_seq_client_info_get_name(cinfo),
|
||||||
(snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ?
|
(snd_seq_client_info_get_type(cinfo) == SND_SEQ_USER_CLIENT ?
|
||||||
_("user") : _("kernel")));
|
_("user") : _("kernel")));
|
||||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_MIDI_VERSION
|
|
||||||
switch (snd_seq_client_info_get_midi_version(cinfo)) {
|
switch (snd_seq_client_info_get_midi_version(cinfo)) {
|
||||||
case SND_SEQ_CLIENT_UMP_MIDI_1_0:
|
case SND_SEQ_CLIENT_UMP_MIDI_1_0:
|
||||||
printf(",UMP-MIDI1");
|
printf(",UMP-MIDI1");
|
||||||
|
@ -214,16 +198,11 @@ static void print_port(snd_seq_t *seq ATTRIBUTE_UNUSED,
|
||||||
printf(",UMP-MIDI2");
|
printf(",UMP-MIDI2");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_CARD
|
|
||||||
card = snd_seq_client_info_get_card(cinfo);
|
card = snd_seq_client_info_get_card(cinfo);
|
||||||
#endif
|
|
||||||
if (card != -1)
|
if (card != -1)
|
||||||
printf(",card=%d", card);
|
printf(",card=%d", card);
|
||||||
|
|
||||||
#ifdef HAVE_SEQ_CLIENT_INFO_GET_PID
|
|
||||||
pid = snd_seq_client_info_get_pid(cinfo);
|
pid = snd_seq_client_info_get_pid(cinfo);
|
||||||
#endif
|
|
||||||
if (pid != -1)
|
if (pid != -1)
|
||||||
printf(",pid=%d", pid);
|
printf(",pid=%d", pid);
|
||||||
printf("]\n");
|
printf("]\n");
|
||||||
|
@ -231,10 +210,8 @@ static void print_port(snd_seq_t *seq ATTRIBUTE_UNUSED,
|
||||||
printf(" %3d '%-16s'",
|
printf(" %3d '%-16s'",
|
||||||
snd_seq_port_info_get_port(pinfo),
|
snd_seq_port_info_get_port(pinfo),
|
||||||
snd_seq_port_info_get_name(pinfo));
|
snd_seq_port_info_get_name(pinfo));
|
||||||
#ifdef HANDLE_SHOW_ALL
|
|
||||||
if (snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_INACTIVE)
|
if (snd_seq_port_info_get_capability(pinfo) & SND_SEQ_PORT_CAP_INACTIVE)
|
||||||
printf(" [INACTIVE]");
|
printf(" [INACTIVE]");
|
||||||
#endif
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,11 +276,7 @@ enum {
|
||||||
SUBSCRIBE, UNSUBSCRIBE, LIST, REMOVE_ALL
|
SUBSCRIBE, UNSUBSCRIBE, LIST, REMOVE_ALL
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HANDLE_SHOW_ALL
|
|
||||||
#define ACONNECT_OPTS "dior:t:elxa"
|
#define ACONNECT_OPTS "dior:t:elxa"
|
||||||
#else
|
|
||||||
#define ACONNECT_OPTS "dior:t:elx"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const struct option long_option[] = {
|
static const struct option long_option[] = {
|
||||||
{"disconnect", 0, NULL, 'd'},
|
{"disconnect", 0, NULL, 'd'},
|
||||||
|
@ -314,9 +287,7 @@ static const struct option long_option[] = {
|
||||||
{"exclusive", 0, NULL, 'e'},
|
{"exclusive", 0, NULL, 'e'},
|
||||||
{"list", 0, NULL, 'l'},
|
{"list", 0, NULL, 'l'},
|
||||||
{"removeall", 0, NULL, 'x'},
|
{"removeall", 0, NULL, 'x'},
|
||||||
#ifdef HANDLE_SHOW_ALL
|
|
||||||
{"all", 0, NULL, 'a'},
|
{"all", 0, NULL, 'a'},
|
||||||
#endif
|
|
||||||
{NULL, 0, NULL, 0},
|
{NULL, 0, NULL, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -370,12 +341,10 @@ int main(int argc, char **argv)
|
||||||
case 'x':
|
case 'x':
|
||||||
command = REMOVE_ALL;
|
command = REMOVE_ALL;
|
||||||
break;
|
break;
|
||||||
#ifdef HANDLE_SHOW_ALL
|
|
||||||
case 'a':
|
case 'a':
|
||||||
command = LIST;
|
command = LIST;
|
||||||
show_all = 1;
|
show_all = 1;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
Loading…
Reference in a new issue