summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Paul Sladen2009-03-29 19:07:39 +0200
committerGravatar Nikias Bassen2009-03-29 19:07:39 +0200
commitda537aae30386c8b3bdc5075b96971b5776a7176 (patch)
treea1f771c6920590684921ad8f7d5d1c9b6499686e
parent15ea7e8a03ab519115b19b4b84c2ead96bf6c88c (diff)
downloadusbmuxd-da537aae30386c8b3bdc5075b96971b5776a7176.tar.gz
usbmuxd-da537aae30386c8b3bdc5075b96971b5776a7176.tar.bz2
[PATCH] iproxy: print count and serial_number of device(s)
Signed-off-by: Nikias Bassen <nikias@gmx.li>
-rw-r--r--iproxy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/iproxy.c b/iproxy.c
index 199c51e..56e30ed 100644
--- a/iproxy.c
+++ b/iproxy.c
@@ -143,6 +143,7 @@ void *acceptor_thread(void *arg)
143 struct client_data *cdata; 143 struct client_data *cdata;
144 usbmuxd_scan_result *dev_list = NULL; 144 usbmuxd_scan_result *dev_list = NULL;
145 pthread_t ctos; 145 pthread_t ctos;
146 int count;
146 147
147 if (!arg) { 148 if (!arg) {
148 fprintf(stderr, "invalid client_data provided!\n"); 149 fprintf(stderr, "invalid client_data provided!\n");
@@ -151,19 +152,21 @@ void *acceptor_thread(void *arg)
151 152
152 cdata = (struct client_data*)arg; 153 cdata = (struct client_data*)arg;
153 154
154 if (usbmuxd_scan(&dev_list) < 0) { 155 if ((count = usbmuxd_scan(&dev_list)) < 0) {
155 printf("Connecting to usbmuxd failed, terminating.\n"); 156 printf("Connecting to usbmuxd failed, terminating.\n");
156 free(dev_list); 157 free(dev_list);
157 return NULL; 158 return NULL;
158 } 159 }
159 160
161 fprintf(stdout, "Number of available devices == %d\n", count);
162
160 if (dev_list == NULL || dev_list[0].handle == 0) { 163 if (dev_list == NULL || dev_list[0].handle == 0) {
161 printf("No connected device found, terminating.\n"); 164 printf("No connected device found, terminating.\n");
162 free(dev_list); 165 free(dev_list);
163 return NULL; 166 return NULL;
164 } 167 }
165 168
166 fprintf(stdout, "Requesting connecion to device handle == %d, port %d\n", dev_list[0].handle, device_port); 169 fprintf(stdout, "Requesting connecion to device handle == %d (serial: %s), port %d\n", dev_list[0].handle, dev_list[0].serial_number, device_port);
167 170
168 cdata->sfd = usbmuxd_connect(dev_list[0].handle, device_port); 171 cdata->sfd = usbmuxd_connect(dev_list[0].handle, device_port);
169 free(dev_list); 172 free(dev_list);