From b627a0e2ed63377c828b1f324dd0120fee4e4cd3 Mon Sep 17 00:00:00 2001 From: Nanik Tolaram Date: Wed, 18 Feb 2015 22:53:37 +1100 Subject: Add more logging message and dead code * Add more logging message to aid in easier debugging * Remove unnecessary dead/commented code Change-Id: I9c7fe8f6b674cab41601001458010ab176b89776 Signed-off-by: Nanik Tolaram --- adb/file_sync_client.c | 9 --------- adb/sockets.c | 12 +++--------- adb/usb_linux.c | 8 ++++++-- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/adb/file_sync_client.c b/adb/file_sync_client.c index f93c876..f7828a6 100644 --- a/adb/file_sync_client.c +++ b/adb/file_sync_client.c @@ -529,17 +529,12 @@ remote_error: } else { memcpy(buffer, &id, 4); buffer[4] = 0; -// strcpy(buffer,"unknown reason"); } fprintf(stderr,"failed to copy '%s' to '%s': %s\n", rpath, lpath, buffer); return 0; } - - /* --- */ - - static void do_sync_ls_cb(unsigned mode, unsigned size, unsigned time, const char *name, void *cookie) { @@ -573,7 +568,6 @@ struct copyinfo unsigned int mode; unsigned int size; int flag; - //char data[0]; }; copyinfo *mkcopyinfo(const char *spath, const char *dpath, @@ -601,7 +595,6 @@ copyinfo *mkcopyinfo(const char *spath, const char *dpath, snprintf((char*) ci->src, ssize, isdir ? "%s%s/" : "%s%s", spath, name); snprintf((char*) ci->dst, dsize, isdir ? "%s%s/" : "%s%s", dpath, name); -// fprintf(stderr,"mkcopyinfo('%s','%s')\n", ci->src, ci->dst); return ci; } @@ -615,8 +608,6 @@ static int local_build_list(copyinfo **filelist, copyinfo *dirlist = 0; copyinfo *ci, *next; -// fprintf(stderr,"local_build_list('%s','%s')\n", lpath, rpath); - d = opendir(lpath); if(d == 0) { fprintf(stderr,"cannot open '%s': %s\n", lpath, strerror(errno)); diff --git a/adb/sockets.c b/adb/sockets.c index 6cdde97..1598c3c 100644 --- a/adb/sockets.c +++ b/adb/sockets.c @@ -45,8 +45,6 @@ int sendfailmsg(int fd, const char *reason) return writex(fd, reason, len); } -//extern int online; - static unsigned local_socket_next_id = 1; static asocket local_socket_list = { @@ -196,10 +194,9 @@ enqueue: static void local_socket_ready(asocket *s) { - /* far side is ready for data, pay attention to - readable events */ + /* far side is ready for data, pay attention to + readable events */ fdevent_add(&s->fde, FDE_READ); -// D("LS(%d): ready()\n", s->id); } static void local_socket_close(asocket *s) @@ -240,7 +237,7 @@ static void local_socket_destroy(asocket *s) static void local_socket_close_locked(asocket *s) { - D("entered. LS(%d) fd=%d\n", s->id, s->fd); + D("entered local_socket_close_locked. LS(%d) fd=%d\n", s->id, s->fd); if(s->peer) { D("LS(%d): closing peer. peer->id=%d peer->fd=%d\n", s->id, s->peer->id, s->peer->fd); @@ -403,7 +400,6 @@ static void local_socket_event_func(int fd, unsigned ev, void *_s) ** catching it here means we may skip the last few ** bytes of readable data. */ -// s->close(s); D("LS(%d): FDE_ERROR (fd=%d)\n", s->id, s->fd); return; @@ -422,8 +418,6 @@ asocket *create_local_socket(int fd) install_local_socket(s); fdevent_install(&s->fde, fd, local_socket_event_func, s); -/* fdevent_add(&s->fde, FDE_ERROR); */ - //fprintf(stderr, "Created local socket in create_local_socket \n"); D("LS(%d): created (fd=%d)\n", s->id, s->fd); return s; } diff --git a/adb/usb_linux.c b/adb/usb_linux.c index 7d13a5d..d242c8a 100644 --- a/adb/usb_linux.c +++ b/adb/usb_linux.c @@ -379,6 +379,7 @@ static int usb_bulk_read(usb_handle *h, void *data, int len) struct usbdevfs_urb *out = NULL; int res; + D("++ usb_bulk_read ++\n"); memset(urb, 0, sizeof(*urb)); urb->type = USBDEVFS_URB_TYPE_BULK; urb->endpoint = h->ep_in; @@ -441,6 +442,7 @@ static int usb_bulk_read(usb_handle *h, void *data, int len) } fail: adb_mutex_unlock(&h->lock); + D("-- usb_bulk_read --\n"); return res; } @@ -451,6 +453,7 @@ int usb_write(usb_handle *h, const void *_data, int len) int n; int need_zero = 0; + D("++ usb_write ++\n"); if(h->zero_mask) { /* if we need 0-markers and our transfer ** is an even multiple of the packet size, @@ -480,6 +483,7 @@ int usb_write(usb_handle *h, const void *_data, int len) return n; } + D("-- usb_write --\n"); return 0; } @@ -554,7 +558,7 @@ void usb_kick(usb_handle *h) int usb_close(usb_handle *h) { - D("[ usb close ... ]\n"); + D("++ usb close ++\n"); adb_mutex_lock(&usb_lock); h->next->prev = h->prev; h->prev->next = h->next; @@ -562,7 +566,7 @@ int usb_close(usb_handle *h) h->next = 0; adb_close(h->desc); - D("[ usb closed %p (fd = %d) ]\n", h, h->desc); + D("-- usb closed %p (fd = %d) --\n", h, h->desc); adb_mutex_unlock(&usb_lock); free(h); -- cgit v1.1