diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client.c | 4 | ||||
-rw-r--r-- | src/device.c | 8 | ||||
-rw-r--r-- | src/device.h | 4 | ||||
-rw-r--r-- | src/main.c | 2 |
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) int count, i; client->state = CLIENT_LISTEN; - count = device_get_count(); + count = device_get_count(0); if(!count) return 0; devs = malloc(sizeof(struct device_info) * count); - count = device_get_list(devs); + count = device_get_list(0, devs); // going to need a larger buffer for many devices 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) } ENDFOREACH } -int device_get_count(void) +int device_get_count(int include_hidden) { int count = 0; FOREACH(struct mux_device *dev, &device_list) { - if((dev->state == MUXDEV_ACTIVE) && dev->visible) + if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible)) count++; } ENDFOREACH return count; } -int device_get_list(struct device_info *p) +int device_get_list(int include_hidden, struct device_info *p) { int count = 0; FOREACH(struct mux_device *dev, &device_list) { - if((dev->state == MUXDEV_ACTIVE) && dev->visible) { + if((dev->state == MUXDEV_ACTIVE) && (include_hidden || dev->visible)) { p->id = dev->id; p->serial = usb_get_serial(dev->usbdev); 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); void device_set_visible(int device_id); -int device_get_count(void); -int device_get_list(struct device_info *p); +int device_get_count(int include_hidden); +int device_get_list(int include_hidden, struct device_info *p); int device_get_timeout(void); void device_check_timeouts(void); @@ -108,7 +108,7 @@ static void handle_signal(int sig) if(opt_udev) { if (sig == SIGUSR1) { usbmuxd_log(LL_INFO, "Caught SIGUSR1, checking if we can terminate (no more devices attached)..."); - if (device_get_count() > 0) { + if (device_get_count(1) > 0) { // we can't quit, there are still devices attached. usbmuxd_log(LL_NOTICE, "Refusing to terminate, there are still devices attached. Kill me with signal 15 (TERM) to force quit."); } else { |