Index: sources/device/DeviceController.cpp =================================================================== diff -u -r3b402a2cfb9e673bf0bac3fcc8eeee75a0adc475 -r4ef7cb77805b64ac89966a9581cdc111520f21d1 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 3b402a2cfb9e673bf0bac3fcc8eeee75a0adc475) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 4ef7cb77805b64ac89966a9581cdc111520f21d1) @@ -978,11 +978,19 @@ void DeviceController::onAttributeRequest(const DeviceUSBMountRequestData &vData) { Q_UNUSED(vData) - // TODO - VY ideally we don't have this function, but macros used needs it declared + requestUSBMount(vData.isUnmountRequest, vData.usbDrive); } + +/*! + * \brief DeviceController::requestUSBMount + * \details Calls the Usb unmount/mount script + * \param vIsUnmount - indicate if the request is for mounting or unmounting + * \param vUSBDrive - the path to the USB drive + */ void DeviceController::requestUSBMount(bool vIsUnmount, const QString vUSBDrive) { _deviceUSBMountRequest._data.isUnmountRequest = vIsUnmount; + _deviceUSBMountRequest._data.usbDrive = vUSBDrive; // not necessary, but to be consistent // ----- check that script exists. QString script; @@ -1021,18 +1029,23 @@ if ( vStatus ) vExitCode = Device::DeviceError::eDevice_Scripts_Error_Status; else deviceInfo = _processUSBMount.readAll(); model.fromByteArray( deviceInfo, &vExitCode ); - // DEBUG: qDebug() << model._data.mMessage << deviceInfo; didAttributeResponse(model.data()); LOG_APPED_UI(model.data().mMessage); + // Re-evaluate the USB space available - need to call this here to avoid + // visual lag caused by waiting to call this function on the timer timeout + usbSpaceCheck(); + + QString usbDrive = _deviceUSBMountRequest._data.usbDrive; if(_deviceUSBMountRequest._data.isUnmountRequest) { _mounted = false; -// LOG_DEBUG(QString("USB drive %2 unmounted").arg(_deviceUSBMountRequest._data.usbDrive)); + LOG_DEBUG(QString("USB drive %2 unmounted").arg(usbDrive)); emit didUSBDriveUmount(); } else { + if(vStatus) { usbError(usbDrive); return; } // log error and exit _mounted = true; _removed = false; -// LOG_DEBUG(QString("USB flash drive %1 has been mounted on %2").arg(_deviceUSBMountRequest._data.usbDrive).arg(_deviceUSBMountRequest._data.usbMountPoint)); + LOG_DEBUG(QString("USB flash drive %1 has been mounted on %2").arg(usbDrive).arg(USB_Mount_Point)); emit didUSBDriveMount(); } }