Browse Source

Introduce operation mode

master
Damien Goutte-Gattat 10 years ago
parent
commit
b21c4d03a0
  1. 17
      src/asysex.c

17
src/asysex.c

@ -27,6 +27,9 @@
#include <sysex.h>
#define ASYSEX_MODE_QUERY 0x00
#define ASYSEX_MODE_INQUIRY 0x01
/* Globals. */
static midi_io_t *midi = NULL;
@ -109,7 +112,7 @@ int
main(int argc, char **argv)
{
char c, *port;
int inquiry;
int mode;
struct option options[] = {
{ "help", 0, NULL, 'h' },
@ -124,7 +127,7 @@ main(int argc, char **argv)
atexit(cleanup);
port = "hw:1,0,0";
inquiry = 0;
mode = ASYSEX_MODE_QUERY;
while ( (c = getopt_long(argc, argv, "hvp:I", options, NULL)) != -1 ) {
switch ( c ) {
@ -145,7 +148,7 @@ main(int argc, char **argv)
break;
case 'I':
inquiry = 1;
mode = ASYSEX_MODE_INQUIRY;
break;
}
}
@ -153,9 +156,13 @@ main(int argc, char **argv)
if ( ! (midi = midi_open(port)) )
errx(EXIT_FAILURE, "cannot open MIDI port %s", port);
if ( inquiry ) {
switch ( mode ) {
case ASYSEX_MODE_QUERY:
break;
case ASYSEX_MODE_INQUIRY:
identify_device(midi);
return EXIT_SUCCESS;
break;
}
return EXIT_SUCCESS;

Loading…
Cancel
Save