void TAvrAtmel::EnableAvr(){ bool auto_select = desired_avrcode == AUTO_SELECT; for (unsigned pidx=0; prg_part[pidx].code != AUTO_SELECT; pidx++){ if (!prg_part[pidx].supported && auto_select){continue;} if (auto_select){ desired_avrcode = prg_part[pidx].code; Info(2, "Trying with: %s\n", prg_part[pidx].description); } EnterProgrammingMode(); if (!auto_select || !(vendor_code==0 && part_family==1 && part_number==2)){ break; } LeaveProgrammingMode(); } // OverridePart("atmega163"); // XXXXX local hack for broken signature bytes Identify(); if (auto_select){ /* If avr was recongnized by the Identify(), try to find better match in the support list. */ unsigned better_pidx = 0; TByte better_avrcode = desired_avrcode; for (unsigned pidx=0; prg_part[pidx].code != AUTO_SELECT; pidx++){ if (!prg_part[pidx].supported){continue;} if (strstr(prg_part[pidx].description, GetPartName())){ better_avrcode = prg_part[better_pidx = pidx].code; } } if (better_avrcode != desired_avrcode){ Info(2, "Retrying with better match: %s\n", prg_part[better_pidx].description); desired_avrcode = better_avrcode; LeaveProgrammingMode(); EnterProgrammingMode(); Identify(); } } }
bool CSplitFile::open(OpenMode flags) { if(flags & ReadOnly) { for(int i = 0;; i++) { QString PartName = GetPartName(i); if(!QFile::exists(PartName)) break; QFile* pFile = new QFile(PartName, this); pFile->open(flags); m_FileParts.append(pFile); } } m_Index = 0; // we are open for business return QIODevice::open(flags); }