bool writeEeprom(const QString &filename, ProgressWidget *progress) { if (IS_ARM(GetCurrentFirmware()->getBoard())) { QString path = findMassstoragePath("EEPROM.BIN"); if (path.isEmpty()) { // On previous OpenTX we called the EEPROM file "TARANIS.BIN" :( path = findMassstoragePath("TARANIS.BIN"); } if (path.isEmpty()) { // Mike's bootloader calls the EEPROM file "ERSKY9X.BIN" :( path = findMassstoragePath("ERSKY9X.BIN"); } if (!path.isEmpty()) { CopyProcess copyProcess(filename, path, progress); return copyProcess.run(); } } if (!IS_TARANIS(GetCurrentFirmware()->getBoard())) { FlashProcess flashProcess(getRadioInterfaceCmd(), getWriteEEpromCmd(filename), progress); return flashProcess.run(); } if (IS_ARM(GetCurrentFirmware()->getBoard())) { RadioNotFoundDialog dialog; dialog.exec(); } return false; }
bool readFirmware(const QString &filename, ProgressWidget *progress) { bool result = false; QFile file(filename); if (file.exists() && !file.remove()) { QMessageBox::warning(NULL, QObject::tr("Error"), QObject::tr("Could not delete temporary file: %1").arg(filename)); return false; } if (IS_ARM(GetCurrentFirmware()->getBoard())) { QString path = findMassstoragePath("FIRMWARE.BIN"); if (!path.isEmpty()) { qDebug() << "readFirmware: reading" << path << "into" << filename; CopyProcess copyProcess(path, filename, progress); result = copyProcess.run(); } } if (result == false) { qDebug() << "readFirmware: reading" << filename << "with" << getRadioInterfaceCmd() << getReadFirmwareArgs(filename); FlashProcess flashProcess(getRadioInterfaceCmd(), getReadFirmwareArgs(filename), progress); result = flashProcess.run(); } if (!QFileInfo(filename).exists()) { result = false; } return result; }
bool writeFirmware(const QString &filename, ProgressWidget *progress) { if (IS_ARM(GetCurrentFirmware()->getBoard())) { QString path = findMassstoragePath("FIRMWARE.BIN"); if (!path.isEmpty()) { qDebug() << "writeFirmware: writing" << path << "from" << filename; CopyProcess copyProcess(filename, path, progress); return copyProcess.run(); } } qDebug() << "writeFirmware: writing" << filename << "with" << getRadioInterfaceCmd() << getWriteFirmwareArgs(filename); FlashProcess flashProcess(getRadioInterfaceCmd(), getWriteFirmwareArgs(filename), progress); return flashProcess.run(); }
bool readEeprom(const QString &filename, ProgressWidget *progress) { bool result = false; QFile file(filename); if (file.exists() && !file.remove()) { QMessageBox::warning(NULL, QObject::tr("Error"), QObject::tr("Could not delete temporary file: %1").arg(filename)); return false; } if (IS_ARM(GetCurrentFirmware()->getBoard())) { QString path = findMassstoragePath("EEPROM.BIN"); if (path.isEmpty()) { // On previous OpenTX we called the EEPROM file "TARANIS.BIN" :( path = findMassstoragePath("TARANIS.BIN"); } if (path.isEmpty()) { // Mike's bootloader calls the EEPROM file "ERSKY9X.BIN" :( path = findMassstoragePath("ERSKY9X.BIN"); } if (!path.isEmpty()) { CopyProcess copyProcess(path, filename, progress); result = copyProcess.run(); } } if (result == false && !IS_TARANIS(GetCurrentFirmware()->getBoard())) { FlashProcess flashProcess(getRadioInterfaceCmd(), getReadEEpromCmd(filename), progress); result = flashProcess.run(); } if (result == false && IS_ARM(GetCurrentFirmware()->getBoard())) { RadioNotFoundDialog dialog; dialog.exec(); } if (!QFileInfo(filename).exists()) { result = false; } return result; }
Memory * insert(Process * prcIn, Memory * memoryList,int loc, int age) { int i; int j; j = 0; for(i=loc; i< (prcIn->memoryReq + loc); i++) { if(memoryList->memoryArr[i] == NULL) { prcIn->age = age; prcIn->version = j; memoryList->memoryArr[i] = copyProcess(prcIn); j++; //printf("\nallocating memory to slot %d",i); } else { printf("\nError allocating memory!"); } //printf("\n%d",i); //getchar(); prcIn->version = 0; } return(memoryList); }
TVerdict RRamPluginLoadTest::DoTestStepL() { TVerdict result = EPass; #ifndef __WINSCW__ TBuf<KMaxFileName*2> dllNames(KOriginalDllOnZ); TBuf<KMaxFileName*2> rscNames(KOriginalRscFileOnZ); dllNames.Append(KSeparator); dllNames.Append(KMovedDllOnC); rscNames.Append(KSeparator); rscNames.Append(KMovedRscFileOnC); TBufC<KMaxProcessNameLength> copyProcess(KProcessFileManCopyFile); // launch copyfile.exe to copy plugin from z: to c: TRAPD(ret, LaunchProcessL(copyProcess, dllNames)); if(ret == KErrNone) { INFO_PRINTF1(_L("Succesfully copied dll")); } else { INFO_PRINTF2(_L("Copying dll failed with %d"), ret); result = EFail; return result; } TRAP(ret, LaunchProcessL(copyProcess, rscNames)); if(ret == KErrNone) { INFO_PRINTF1(_L("Succesfully copied rsc file")); } else { INFO_PRINTF2(_L("Copying rsc file failed with %d"), ret); result = EFail; return result; } User::After(KWaitThreeSeconds); // Wait for ECom to re-scan drives so it can pick up new plugin now on c: #endif _LIT(KRamPluginDisplayName, "Ram ECam Plugin"); TBufC<15> expectedName(KRamPluginDisplayName); TBool pluginFound = EFalse; TInt error = KErrNone; INFO_PRINTF1(_L("Listing available plugins using REComSession::ListImplementationsL()...")); TUid interfaceUid = {KUidOnboardCameraPlugin}; TEComResolverParams resolverParams; resolverParams.SetDataType(KECamPluginMatchString); RImplInfoPtrArray pluginArray; TRAP(error, REComSession::ListImplementationsL(interfaceUid, resolverParams, pluginArray)); if (error != KErrNone) { INFO_PRINTF2(_L("ListImplementationsL() failed - %d"), error); result = EFail; return result; } else { pluginArray.Sort(VersionLinearOrderFunction); for (TInt i = 0; i < pluginArray.Count(); ++i) { TBuf<2> drive; drive = pluginArray[i]->Drive().Name(); INFO_PRINTF3(_L("%S located on drive %S"), &(pluginArray[i]->DisplayName()), &(drive)); if((pluginArray[i]->DisplayName() == expectedName) && (pluginArray[i]->Drive() == 2)) { pluginFound = ETrue; } } pluginArray.Close(); if(!pluginFound) { INFO_PRINTF1(_L("REComSession::ListImplementationsL() could not find plugin in RAM")); } } INFO_PRINTF1(_L("Checking if CCamera::New2L() can successfully load plugin residing in RAM")); MCameraObserver2* observer2 = NULL; TRAP(error, CCamera* camera = CCamera::New2L(*observer2, 0, 0)); #ifdef _DEBUG if(error == KErrNone) { INFO_PRINTF1(_L("UDEB mode: Expected behaviour - successfully loaded plugin")); } else { INFO_PRINTF2(_L("UDEB mode: Unexpected behaviour - could not load plugin, error = %d"), error); result = EFail; } #else if (error == KErrNone) { INFO_PRINTF1(_L("UREL mode: Unexpected behaviour - successfully loaded plugin")); result = EFail; } else { INFO_PRINTF2(_L("UREL mode: Expected behaviour - could not load plugin, error = %d"), error); } #endif return result; }