summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/client.c4
-rw-r--r--src/device.c8
-rw-r--r--src/device.h4
-rw-r--r--src/main.c2
4 files changed, 9 insertions, 9 deletions
diff --git a/src/client.c b/src/client.c
index b2e3644..8f7d945 100644
--- a/src/client.c
+++ b/src/client.c
@@ -311,11 +311,11 @@ static int start_listen(struct mux_client *client)
311 int count, i; 311 int count, i;
312 312
313 client->state = CLIENT_LISTEN; 313 client->state = CLIENT_LISTEN;
314 count = device_get_count(); 314 count = device_get_count(0);
315 if(!count) 315 if(!count)
316 return 0; 316 return 0;
317 devs = malloc(sizeof(struct device_info) * count); 317 devs = malloc(sizeof(struct device_info) * count);
318 count = device_get_list(devs); 318 count = device_get_list(0, devs);
319 319
320 // going to need a larger buffer for many devices 320 // going to need a larger buffer for many devices
321 uint32_t needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE; 321 uint32_t needed_buffer = count * (sizeof(struct usbmuxd_device_record) + sizeof(struct usbmuxd_header)) + REPLY_BUF_SIZE;
diff --git a/src/device.c b/src/device.c
index 27e25d5..99e0153 100644
--- a/src/device.c
+++ b/src/device.c
@@ -693,21 +693,21 @@ void device_set_visible(int device_id)
693 } ENDFOREACH 693 } ENDFOREACH
694} 694}
695 695
696int device_get_count(void) 696int device_get_count(int include_hidden)
697{ 697{
698 int count = 0; 698 int count = 0;
699 FOREACH(struct mux_device *dev, &device_list) { 699 FOREACH(struct mux_device *dev, &device_list) {
700 if((dev->state == MUXDEV_ACTIVE) && dev->visible) 700 if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible))
701 count++; 701 count++;
702 } ENDFOREACH 702 } ENDFOREACH
703 return count; 703 return count;
704} 704}
705 705
706int device_get_list(struct device_info *p) 706int device_get_list(int include_hidden, struct device_info *p)
707{ 707{
708 int count = 0; 708 int count = 0;
709 FOREACH(struct mux_device *dev, &device_list) { 709 FOREACH(struct mux_device *dev, &device_list) {
710 if((dev->state == MUXDEV_ACTIVE) && dev->visible) { 710 if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible)) {
711 p->id = dev->id; 711 p->id = dev->id;
712 p->serial = usb_get_serial(dev->usbdev); 712 p->serial = usb_get_serial(dev->usbdev);
713 p->location = usb_get_location(dev->usbdev); 713 p->location = usb_get_location(dev->usbdev);
diff --git a/src/device.h b/src/device.h
index 4b1a581..d7c82ca 100644
--- a/src/device.h
+++ b/src/device.h
@@ -42,8 +42,8 @@ void device_abort_connect(int device_id, struct mux_client *client);
42 42
43void device_set_visible(int device_id); 43void device_set_visible(int device_id);
44 44
45int device_get_count(void); 45int device_get_count(int include_hidden);
46int device_get_list(struct device_info *p); 46int device_get_list(int include_hidden, struct device_info *p);
47 47
48int device_get_timeout(void); 48int device_get_timeout(void);
49void device_check_timeouts(void); 49void device_check_timeouts(void);
diff --git a/src/main.c b/src/main.c
index 1804c30..bb2eb2c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -108,7 +108,7 @@ static void handle_signal(int sig)
108 if(opt_udev) { 108 if(opt_udev) {
109 if (sig == SIGUSR1) { 109 if (sig == SIGUSR1) {
110 usbmuxd_log(LL_INFO, "Caught SIGUSR1, checking if we can terminate (no more devices attached)..."); 110 usbmuxd_log(LL_INFO, "Caught SIGUSR1, checking if we can terminate (no more devices attached)...");
111 if (device_get_count() > 0) { 111 if (device_get_count(1) > 0) {
112 // we can't quit, there are still devices attached. 112 // we can't quit, there are still devices attached.
113 usbmuxd_log(LL_NOTICE, "Refusing to terminate, there are still devices attached. Kill me with signal 15 (TERM) to force quit."); 113 usbmuxd_log(LL_NOTICE, "Refusing to terminate, there are still devices attached. Kill me with signal 15 (TERM) to force quit.");
114 } else { 114 } else {