2 * Copyright (C) 2005-2008 by Pieter Palmers
4 * This file is part of FFADO
5 * FFADO = Free Firewire (pro-)audio drivers for linux
7 * FFADO is based upon FreeBoB.
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) version 3 of the License.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
33 #include "debugmodule/debugmodule.h"
35 #include "src/DeviceStringParser.h"
37 DECLARE_GLOBAL_DEBUG_MODULE
;
39 // Program documentation.
40 static char doc
[] = "FFADO -- Watchdog test\n\n";
42 // A description of the arguments we accept.
43 static char args_doc
[] = "";
51 // The options we understand.
52 static struct argp_option options
[] = {
53 {"verbose", 'v', "n", 0, "Verbose level" },
57 //-------------------------------------------------------------
59 // Parse a single option.
61 parse_opt( int key
, char* arg
, struct argp_state
* state
)
63 // Get the input argument from `argp_parse', which we
64 // know is a pointer to our arguments structure.
65 struct arguments
* arguments
= ( struct arguments
* ) state
->input
;
72 arguments
->verbose
= strtoll( arg
, &tail
, 0 );
74 fprintf( stderr
, "Could not parse 'verbose' argument\n" );
75 return ARGP_ERR_UNKNOWN
;
79 fprintf( stderr
, "Could not parse 'verbose' argument\n" );
80 return ARGP_ERR_UNKNOWN
;
85 return ARGP_ERR_UNKNOWN
;
91 static struct argp argp
= { options
, parse_opt
, args_doc
, doc
};
93 int main(int argc
, char *argv
[])
96 struct arguments arguments
;
99 arguments
.verbose
= DEBUG_LEVEL_VERY_VERBOSE
;
101 // Parse our arguments; every option seen by `parse_opt' will
102 // be reflected in `arguments'.
103 if ( argp_parse ( &argp
, argc
, argv
, 0, 0, &arguments
) ) {
104 fprintf( stderr
, "Could not parse command line\n" );
108 setDebugLevel(arguments
.verbose
);
110 DeviceStringParser p
= DeviceStringParser();
111 p
.setVerboseLevel(arguments
.verbose
);
113 p
.parseString("hw:0;hw:1");
114 p
.parseString("hw:0;hw:1;");
115 p
.parseString("hw:0,0;hw:1,1;");
116 p
.parseString("hw:1,1;hw:1,0");
117 p
.parseString("guid:0x123456789");