diff options
-rw-r--r-- | firmware/usb.c | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_storage.c | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/firmware/usb.c b/firmware/usb.c index 7c43a8ba90..3cd93d8be5 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -303,16 +303,20 @@ static void usb_thread(void) | |||
303 | #endif | 303 | #endif |
304 | 304 | ||
305 | usb_state = USB_EXTRACTED; | 305 | usb_state = USB_EXTRACTED; |
306 | #ifdef HAVE_USBSTACK | ||
306 | if(exclusive_ata_access) | 307 | if(exclusive_ata_access) |
307 | { | 308 | { |
308 | exclusive_ata_access = false; | 309 | exclusive_ata_access = false; |
310 | #endif | ||
309 | /* Tell all threads that we are back in business */ | 311 | /* Tell all threads that we are back in business */ |
310 | num_acks_to_expect = | 312 | num_acks_to_expect = |
311 | queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1; | 313 | queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1; |
312 | waiting_for_ack = true; | 314 | waiting_for_ack = true; |
313 | DEBUGF("USB extracted. Waiting for ack from %d threads...\n", | 315 | DEBUGF("USB extracted. Waiting for ack from %d threads...\n", |
314 | num_acks_to_expect); | 316 | num_acks_to_expect); |
317 | #ifdef HAVE_USBSTACK | ||
315 | } | 318 | } |
319 | #endif | ||
316 | break; | 320 | break; |
317 | 321 | ||
318 | case SYS_USB_DISCONNECTED_ACK: | 322 | case SYS_USB_DISCONNECTED_ACK: |
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c index 06d999d6de..6427bd8656 100644 --- a/firmware/usbstack/usb_storage.c +++ b/firmware/usbstack/usb_storage.c | |||
@@ -262,7 +262,7 @@ static enum { | |||
262 | SENDING_CSW | 262 | SENDING_CSW |
263 | } state = WAITING_FOR_COMMAND; | 263 | } state = WAITING_FOR_COMMAND; |
264 | 264 | ||
265 | static bool check_disk_present(int volume) | 265 | static bool check_disk_present(IF_MV(int volume)) |
266 | { | 266 | { |
267 | unsigned char sector[512]; | 267 | unsigned char sector[512]; |
268 | return ata_read_sectors(IF_MV2(volume,)0,1,sector) == 0; | 268 | return ata_read_sectors(IF_MV2(volume,)0,1,sector) == 0; |
@@ -290,7 +290,7 @@ static void try_release_ata(void) | |||
290 | void usb_storage_notify_hotswap(int volume,bool inserted) | 290 | void usb_storage_notify_hotswap(int volume,bool inserted) |
291 | { | 291 | { |
292 | logf("notify %d",inserted); | 292 | logf("notify %d",inserted); |
293 | if(inserted && check_disk_present(volume)) { | 293 | if(inserted && check_disk_present(IF_MV(volume))) { |
294 | ejected[volume] = false; | 294 | ejected[volume] = false; |
295 | } | 295 | } |
296 | else { | 296 | else { |
@@ -305,7 +305,7 @@ void usb_storage_reconnect(void) | |||
305 | { | 305 | { |
306 | int i; | 306 | int i; |
307 | for(i=0;i<NUM_VOLUMES;i++) | 307 | for(i=0;i<NUM_VOLUMES;i++) |
308 | ejected[i] = !check_disk_present(i); | 308 | ejected[i] = !check_disk_present(IF_MV(i)); |
309 | 309 | ||
310 | usb_request_exclusive_ata(); | 310 | usb_request_exclusive_ata(); |
311 | } | 311 | } |
@@ -315,7 +315,7 @@ void usb_storage_init(void) | |||
315 | { | 315 | { |
316 | int i; | 316 | int i; |
317 | for(i=0;i<NUM_VOLUMES;i++) { | 317 | for(i=0;i<NUM_VOLUMES;i++) { |
318 | ejected[i] = !check_disk_present(i); | 318 | ejected[i] = !check_disk_present(IF_MV(i)); |
319 | } | 319 | } |
320 | logf("usb_storage_init done"); | 320 | logf("usb_storage_init done"); |
321 | } | 321 | } |