From cee4aab5a28d1f360cdf9ba15bacf0d338a78884 Mon Sep 17 00:00:00 2001 From: gstellenberg Date: Tue, 20 Oct 2009 23:41:21 -0500 Subject: [PATCH] Fixed logic comparing the requested machineType against the P-ROC's machine type. --- src/PRDevice.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/PRDevice.cpp b/src/PRDevice.cpp index 29dc886..06eebd7 100644 --- a/src/PRDevice.cpp +++ b/src/PRDevice.cpp @@ -61,12 +61,16 @@ PRDevice* PRDevice::Create(PRMachineType machineType) PRMachineType readMachineType = dev->GetReadMachineType(); + // Custom is always accepted if (machineType != kPRMachineCustom && + + // Don't accept if requested type is WPC/WPC95 but read machine is not. ( ((machineType == kPRMachineWPC) || (machineType == kPRMachineWPC95)) && (readMachineType != kPRMachineWPC && - readMachineType != kPRMachineWPC95)) || + readMachineType != kPRMachineWPC95) || + // Also don't accept if the requested is not WPC/WPC95 but the P-ROC is. (machineType != kPRMachineWPC && machineType != kPRMachineWPC95 && - readMachineType == kPRMachineWPC) ) + readMachineType == kPRMachineWPC) ) ) { dev->Close(); DEBUG(PRLog(kPRLogError, "Machine type 0x%x invalid for P-ROC board settings 0x%x.\n", machineType, readMachineType));