From 15c6a56eba1600ed23c29c6d769e49221fb000ce Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 21 Apr 2011 16:01:16 +0200 Subject: Fixing "Fixing Magic" for nvidia. --- data/lib/rhbzpage.js | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/data/lib/rhbzpage.js b/data/lib/rhbzpage.js index d8f5727..e0c5cec 100644 --- a/data/lib/rhbzpage.js +++ b/data/lib/rhbzpage.js @@ -2,7 +2,7 @@ // http://www.opensource.org/licenses/mit-license.php // Are we debugging? -var debugFlag = true; +var debugFlag = false; // For identification of graphics card var manuChipStrs = [ [ "ATI Radeon", "ATI", "1002" ], @@ -220,9 +220,10 @@ function addCheckXorgLogLink(attList) { * * @param PCIidArrObj object with two fields * id Array manufacturer-ID and product-ID (PCI IDs) - * chipsetLine RE + * chipsetLine whole line containing PCI ID. * @param driverStr String with the driver name * @return None + * */ function fillInWhiteBoard(PCIidArrObj) { var outStr = ""; @@ -231,7 +232,13 @@ function fillInWhiteBoard(PCIidArrObj) { var cardName = ""; var PCIid = (PCIidArrObj.id[0] + "," + PCIidArrObj.id[1]).toUpperCase(); + console.myDebug("PCIidArrObj = " + PCIidArrObj.toSource()); + console.myDebug("PCIid = " + PCIid); + + // Nvidia driver provides good code in the if (PCIidArrObj.id[0].toLowerCase() == "10de") { + // The following is wrong ... chipsetLine is String, not an array + console.myDebug("fillInWhiteBoard: chipsetLine = " + PCIidArrObj.chipsetLine); cardName = PCIidArrObj.chipsetLine[2].replace(/\s*nvidia\s*/ig,""). replace('"','','g'); } @@ -267,17 +274,34 @@ function fillInChipMagic(XlogID) { analyzeXorgLog(XlogID, "AnalyzeInterestingLine"); } +/** + * Creates a button to change summary by adding a graphic chip label + * + * @param Array with matching results of re.exec() + */ function chipsetMagic (interestingLineArr) { // parse Xorg.0.log + var chipsetLine = ""; + console.myDebug("interestingLineArr = " + interestingLineArr.toSource()); + console.myDebug("interestingLineArr[1] = " + interestingLineArr[1]); if (interestingLineArr.length >0) { var interestingArray = interestingLineArr[0]; if (interestingArray.length > 1) { var interestingPCIID = interestingArray[2].trim().split(":"); + // If we have Chipset line, we should parse it as well and + // add to the button + if (interestingLineArr.length > 1) { + chipsetLine = interestingLineArr[1]; + console.myDebug("chipsetLine = " + chipsetLine.toSource()); + } else { + chipsetLine = null; + console.myDebug("chipsetLine = " + chipsetLine); + } createNewButton("short_desc_nonedit_display", false, { "name": "Fill In", "chipMagic": { "id": interestingPCIID, - "chipsetLine": interestingLineArr[1] + "chipsetLine": chipsetLine }, }); } @@ -326,15 +350,23 @@ function findInterestingLine(wholeLog, backMsg) { return new RegExp(reone); }); } + console.myDebug("Current REs:"); + REarr.forEach(function (re) { + console.myDebug("re: " + re.source); + }); + var results = []; wholeLog.split("\n"). forEach(function(line) { REarr.forEach(function (re, reIdx) { if (re.test(line)) { + console.myDebug("Found match on line:\n" + line); + console.myDebug("Result: " + re.exec(line).toSource()); results.push(re.exec(line)); } }); }); + console.myDebug("results = " + results.toSource()); logAnalyzeLogic[backMsg].func(results); } -- cgit