diff options
| author | 2026-10-07 17:09:50 +0200 | |
|---|---|---|
| committer | 2026-11-22 18:20:36 +0100 | |
| commit | 7bcdc4104da6db55af3275da3e0ec86996c0f6ab (patch) | |
| tree | ff29de2d9e07d077562af0a74496df8a34d43981 /src/device.c | |
| parent | 8fbdb7a82034c3c96c0b7547f54302e2a5978465 (diff) | |
| download | usbmuxd-7bcdc4104da6db55af3275da3e0ec86996c0f6ab.tar.gz usbmuxd-7bcdc4104da6db55af3275da3e0ec86996c0f6ab.tar.bz2 | |
preflight: serialize device visibility and notifications
Publish device visibility and the attached notification under
device_list_mutex, then acquire client_list_mutex in the same order as device
removal.
Do not notify clients if preflight completes after the device has disappeared.
Assisted-by: OpenAI Codex
Diffstat (limited to 'src/device.c')
| -rw-r--r-- | src/device.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c index ce73718..66d84db 100644 --- a/src/device.c +++ b/src/device.c @@ -888,12 +888,13 @@ void device_remove(struct usb_device *usbdev) usbmuxd_log(LL_WARNING, "Cannot find device entry while removing USB device %p on location 0x%x", usbdev, usb_get_location(usbdev)); } -void device_set_visible(int device_id) +void device_set_visible(struct device_info *info) { mutex_lock(&device_list_mutex); FOREACH(struct mux_device *dev, &device_list) { - if(dev->id == device_id) { + if(dev->id == info->id) { dev->visible = 1; + client_device_add(info); break; } } ENDFOREACH |
