From 53fb582e7729d5b7ed40ff04d912fcf5add7ce1c Mon Sep 17 00:00:00 2001 From: Hector Martin Date: Tue, 28 Apr 2009 19:01:12 +0200 Subject: USB TX/RX, device framework, version packets --- main.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index bc846cc..7bc8dbe 100644 --- a/main.c +++ b/main.c @@ -34,8 +34,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "log.h" #include "usb.h" +#include "device.h" -const char *socket_path = "/tmp/usbmuxd"; //TODO: CHANGEME +static const char *socket_path = "/tmp/usbmuxd"; //TODO: CHANGEME int create_socket(void) { struct sockaddr_un bind_addr; @@ -75,17 +76,17 @@ int main_loop(int listenfd) struct fdlist pollfds; while(1) { - usbmuxd_log(LL_SPEW, "main_loop iteration"); + usbmuxd_log(LL_FLOOD, "main_loop iteration"); to = usb_get_timeout(); - usbmuxd_log(LL_SPEW, "USB timeout is %d ms", to); + usbmuxd_log(LL_FLOOD, "USB timeout is %d ms", to); fdlist_create(&pollfds); fdlist_add(&pollfds, FD_LISTEN, listenfd, POLLIN); usb_get_fds(&pollfds); - usbmuxd_log(LL_SPEW, "fd count is %d", pollfds.count); + usbmuxd_log(LL_FLOOD, "fd count is %d", pollfds.count); cnt = poll(pollfds.fds, pollfds.count, to); - usbmuxd_log(LL_SPEW, "poll() returned %d", cnt); + usbmuxd_log(LL_FLOOD, "poll() returned %d", cnt); if(cnt == 0) { if(usb_process() < 0) { @@ -122,6 +123,7 @@ int main(int argc, char *argv[]) if(listenfd < 0) return 1; + device_init(); usbmuxd_log(LL_INFO, "Initializing USB"); if((res = usb_init()) < 0) return 2; @@ -135,8 +137,9 @@ int main(int argc, char *argv[]) usbmuxd_log(LL_NOTICE, "usbmux shutting down"); usb_shutdown(); + device_shutdown(); usbmuxd_log(LL_NOTICE, "Shutdown complete"); - + if(res < 0) return -res; return 0; -- cgit v1.1-32-gdbae