Index: firmware/usb.c =================================================================== --- firmware/usb.c (revision 15673) +++ firmware/usb.c (working copy) @@ -79,9 +79,11 @@ if(on) { DEBUGF("Entering USB slave mode\n"); +#ifndef HAVE_USBSTACK ata_soft_reset(); ata_init(); ata_enable(false); +#endif usb_enable(true); } else @@ -93,6 +95,7 @@ usb_enable(false); +#ifndef HAVE_USBSTACK rc = ata_init(); if(rc) { @@ -111,6 +114,7 @@ rc = disk_mount_all(); if (rc <= 0) /* no partition */ panicf("mount: %d",rc); +#endif } } @@ -149,6 +153,7 @@ else #endif { +#ifndef HAVE_USBSTACK /* Tell all threads that they have to back off the ATA. We subtract one for our own thread. */ num_acks_to_expect = @@ -156,6 +161,9 @@ waiting_for_ack = true; DEBUGF("USB inserted. Waiting for ack from %d threads...\n", num_acks_to_expect); +#endif + usb_slave_mode(true); + usb_state = USB_INSERTED; } break; @@ -196,17 +204,21 @@ some threads might not have acknowledged the insertion */ usb_slave_mode(false); +#ifndef HAVE_USBSTACK cpu_idle_mode(false); +#endif } usb_state = USB_EXTRACTED; +#ifndef HAVE_USBSTACK /* Tell all threads that we are back in business */ num_acks_to_expect = queue_broadcast(SYS_USB_DISCONNECTED, 0) - 1; waiting_for_ack = true; DEBUGF("USB extracted. Waiting for ack from %d threads...\n", num_acks_to_expect); +#endif break; case SYS_USB_DISCONNECTED_ACK: