mirror of
https://github.com/preble/libpinproc
synced 2026-02-24 18:25:23 +01:00
add more error strings
This commit is contained in:
@@ -816,8 +816,10 @@ PRResult PRDevice::SwitchGetStates( PREventType * switchStates, uint16_t numSwit
|
|||||||
{
|
{
|
||||||
PRSleep (10); // 10 milliseconds should be plenty of time.
|
PRSleep (10); // 10 milliseconds should be plenty of time.
|
||||||
if (SortReturningData() != kPRSuccess)
|
if (SortReturningData() != kPRSuccess)
|
||||||
|
{
|
||||||
return kPRFailure;
|
return kPRFailure;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure all of the requested words are available before processing them.
|
// Make sure all of the requested words are available before processing them.
|
||||||
// Too many words is just as bad as not enough words.
|
// Too many words is just as bad as not enough words.
|
||||||
@@ -851,7 +853,11 @@ PRResult PRDevice::SwitchGetStates( PREventType * switchStates, uint16_t numSwit
|
|||||||
}
|
}
|
||||||
return kPRSuccess;
|
return kPRSuccess;
|
||||||
}
|
}
|
||||||
else return kPRFailure;
|
else
|
||||||
|
{
|
||||||
|
PRSetLastErrorText("Switch response length does not match.");
|
||||||
|
return kPRFailure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t PRDevice::DMDUpdateConfig(PRDMDConfig *dmdConfig)
|
int32_t PRDevice::DMDUpdateConfig(PRDMDConfig *dmdConfig)
|
||||||
@@ -1093,6 +1099,7 @@ PRResult PRDevice::VerifyChipID()
|
|||||||
DEBUG(PRLog(kPRLogError, "Error in VerifyID(): Dumping buffer\n"));
|
DEBUG(PRLog(kPRLogError, "Error in VerifyID(): Dumping buffer\n"));
|
||||||
for (i = 0; i < bufferWords; i++)
|
for (i = 0; i < bufferWords; i++)
|
||||||
DEBUG(PRLog(kPRLogError, "buffer[%d]: 0x%x\n", i, buffer[i]));
|
DEBUG(PRLog(kPRLogError, "buffer[%d]: 0x%x\n", i, buffer[i]));
|
||||||
|
PRSetLastErrorText("Chip ID does not match.");
|
||||||
rc = kPRFailure;
|
rc = kPRFailure;
|
||||||
}
|
}
|
||||||
else rc = kPRSuccess;
|
else rc = kPRSuccess;
|
||||||
@@ -1111,6 +1118,7 @@ PRResult PRDevice::VerifyChipID()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DEBUG(PRLog(kPRLogError, "Error reading Chip IP and Version. Read %d words instead of 5. The first 2 were: 0x%x and 0x%x.\n", requestedDataQueue.size(), buffer[0], buffer[1]));
|
DEBUG(PRLog(kPRLogError, "Error reading Chip IP and Version. Read %d words instead of 5. The first 2 were: 0x%x and 0x%x.\n", requestedDataQueue.size(), buffer[0], buffer[1]));
|
||||||
|
PRSetLastErrorText("Error reading Chip IP and Version. Read %d words instead of 5. The first 2 were: 0x%x and 0x%x.", requestedDataQueue.size(), buffer[0], buffer[1]);
|
||||||
rc = kPRFailure;
|
rc = kPRFailure;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1118,6 +1126,7 @@ PRResult PRDevice::VerifyChipID()
|
|||||||
{
|
{
|
||||||
// Return failure without logging; calling function must log.
|
// Return failure without logging; calling function must log.
|
||||||
DEBUG(PRLog(kPRLogError, "Verify Chip ID took too long to receive data\n"));
|
DEBUG(PRLog(kPRLogError, "Verify Chip ID took too long to receive data\n"));
|
||||||
|
PRSetLastErrorText("Verify Chip ID took too long to receive data");
|
||||||
rc = kPRFailure;
|
rc = kPRFailure;
|
||||||
}
|
}
|
||||||
return (rc);
|
return (rc);
|
||||||
@@ -1253,7 +1262,11 @@ PRResult PRDevice::ReadDataRaw(uint32_t moduleSelect, uint32_t startingAddr, int
|
|||||||
}
|
}
|
||||||
return kPRSuccess;
|
return kPRSuccess;
|
||||||
}
|
}
|
||||||
else return kPRFailure;
|
else
|
||||||
|
{
|
||||||
|
PRSetLastErrorText("Response length did not match.");
|
||||||
|
return kPRFailure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1282,6 +1295,7 @@ int32_t PRDevice::ReadData(uint32_t *buffer, int32_t num_words)
|
|||||||
rc = num_words;
|
rc = num_words;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
PRSetLastErrorText("Read length did not match.");
|
||||||
rc = 0;
|
rc = 0;
|
||||||
}
|
}
|
||||||
DEBUG(PRLog(kPRLogVerbose, "Read num bytes: %d\n", rc));
|
DEBUG(PRLog(kPRLogVerbose, "Read num bytes: %d\n", rc));
|
||||||
|
|||||||
@@ -389,6 +389,7 @@ PRResult PRHardwareOpen()
|
|||||||
ftStatus = FT_ListDevices(pcBufLD, &iNumDevs, FT_LIST_ALL | FT_OPEN_BY_SERIAL_NUMBER);
|
ftStatus = FT_ListDevices(pcBufLD, &iNumDevs, FT_LIST_ALL | FT_OPEN_BY_SERIAL_NUMBER);
|
||||||
|
|
||||||
if(ftStatus != FT_OK) {
|
if(ftStatus != FT_OK) {
|
||||||
|
PRSetLastErrorText("FT_ListDevices(%d)\n", ftStatus);
|
||||||
DEBUG(PRLog(kPRLogInfo,"Error: FT_ListDevices(%d)\n", ftStatus));
|
DEBUG(PRLog(kPRLogInfo,"Error: FT_ListDevices(%d)\n", ftStatus));
|
||||||
return kPRFailure;
|
return kPRFailure;
|
||||||
}
|
}
|
||||||
@@ -410,6 +411,7 @@ PRResult PRHardwareOpen()
|
|||||||
also rmmod usbserial
|
also rmmod usbserial
|
||||||
*/
|
*/
|
||||||
DEBUG(PRLog(kPRLogInfo,"Error FT_OpenEx(%d), device\n", ftStatus, i));
|
DEBUG(PRLog(kPRLogInfo,"Error FT_OpenEx(%d), device\n", ftStatus, i));
|
||||||
|
PRSetLastErrorText("Error FT_OpenEx(%d), device\n", ftStatus, i);
|
||||||
return kPRFailure;
|
return kPRFailure;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +431,11 @@ PRResult PRHardwareOpen()
|
|||||||
DEBUG(PRLog(kPRLogInfo,"FTDI Device Opened\n"));
|
DEBUG(PRLog(kPRLogInfo,"FTDI Device Opened\n"));
|
||||||
return kPRSuccess;
|
return kPRSuccess;
|
||||||
}
|
}
|
||||||
else return kPRFailure;
|
else
|
||||||
|
{
|
||||||
|
PRSetLastErrorText("No FTDI device found.");
|
||||||
|
return kPRFailure;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PRHardwareClose()
|
void PRHardwareClose()
|
||||||
|
|||||||
Reference in New Issue
Block a user