2012-06-26 23:29:48 -06:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdint.h>
|
2013-05-06 23:06:13 -06:00
|
|
|
#include <sys/select.h>
|
2013-05-27 22:11:48 -06:00
|
|
|
#include "alsa.h"
|
|
|
|
#include "usb.h"
|
2013-05-06 23:06:13 -06:00
|
|
|
#include "dump.h"
|
2012-06-26 23:29:48 -06:00
|
|
|
|
2013-05-27 22:11:48 -06:00
|
|
|
int
|
|
|
|
setup()
|
2013-05-06 23:06:13 -06:00
|
|
|
{
|
2013-05-27 22:11:48 -06:00
|
|
|
char name[100];
|
2013-05-06 23:06:13 -06:00
|
|
|
|
2013-05-27 22:11:48 -06:00
|
|
|
if (usb_setup(name, sizeof(name)) < 0) {
|
|
|
|
return -1;
|
2013-05-06 23:06:13 -06:00
|
|
|
}
|
|
|
|
|
2013-05-27 22:11:48 -06:00
|
|
|
if (alsa_setup(name) < 0) {
|
|
|
|
return -1;
|
2013-05-27 14:54:27 -06:00
|
|
|
}
|
2013-05-27 22:11:48 -06:00
|
|
|
|
|
|
|
return 0;
|
2013-05-13 22:53:35 -06:00
|
|
|
}
|
|
|
|
|
2012-06-26 23:29:48 -06:00
|
|
|
int
|
2013-05-27 22:11:48 -06:00
|
|
|
main(int argc, char *argv[])
|
2012-06-26 23:29:48 -06:00
|
|
|
{
|
2013-05-27 22:11:48 -06:00
|
|
|
if (setup() < 0) {
|
2013-04-12 11:18:58 -06:00
|
|
|
return 69;
|
|
|
|
}
|
2013-05-13 22:53:35 -06:00
|
|
|
|
2013-05-27 22:11:48 -06:00
|
|
|
for (;;) {
|
|
|
|
fd_set rfds;
|
|
|
|
fd_set wfds;
|
|
|
|
int nfds = 0;
|
|
|
|
int ret;
|
2013-05-13 22:53:35 -06:00
|
|
|
|
2013-05-27 22:11:48 -06:00
|
|
|
FD_ZERO(&rfds);
|
|
|
|
FD_ZERO(&wfds);
|
2013-04-15 23:38:15 -06:00
|
|
|
|
2013-05-27 22:11:48 -06:00
|
|
|
alsa_fd_setup(&nfds, &rfds, &wfds);
|
|
|
|
usb_fd_setup(&nfds, &rfds, &wfds);
|
|
|
|
|
|
|
|
ret = select(nfds + 1, &rfds, &wfds, NULL, NULL);
|
|
|
|
if (-1 == ret) {
|
|
|
|
DUMP();
|
|
|
|
}
|
2013-08-07 22:11:55 -06:00
|
|
|
|
|
|
|
alsa_check_fds(&rfds, &wfds);
|
|
|
|
usb_check_fds(&rfds, &wfds);
|
2012-06-26 23:29:48 -06:00
|
|
|
|
2013-08-07 22:11:55 -06:00
|
|
|
//DUMP();
|
2013-04-12 11:18:58 -06:00
|
|
|
}
|
2012-06-26 23:29:48 -06:00
|
|
|
|
2013-04-12 11:18:58 -06:00
|
|
|
return 0;
|
2012-06-26 23:29:48 -06:00
|
|
|
}
|