summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorGravatar Hector Martin2009-04-28 19:01:12 +0200
committerGravatar Hector Martin2009-04-28 19:01:12 +0200
commit53fb582e7729d5b7ed40ff04d912fcf5add7ce1c (patch)
tree8dd1f4d5426421a3a84a9d5df43f2fba48d12143 /main.c
parentc2d46d901822c54a0677318522db62f30b8d5f04 (diff)
downloadusbmuxd-53fb582e7729d5b7ed40ff04d912fcf5add7ce1c.tar.gz
usbmuxd-53fb582e7729d5b7ed40ff04d912fcf5add7ce1c.tar.bz2
USB TX/RX, device framework, version packets
Diffstat (limited to 'main.c')
-rw-r--r--main.c15
1 files changed, 9 insertions, 6 deletions
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;