p linux

Error Codes

Generally, a return code greater than or equal to zero means success. A value less than zero means failure.

The error codes are defined in canstat.h.

CodeValueMeaning
canOK0 "Normal successful completion."
The driver is just fine, and really believes it carried out your command to everyone's satisfaction.
canERR_PARAM-1 "Error in parameter."
Error in one or more parameters; a parameter specified in the call was invalid, out of range, or so. This status code will also be returned when the call is not implemented.
canERR_NOMSG-2 "There were no messages to read."
A function tried to read a message, but there was no message to read.
canERR_NOTFOUND-3 "Specified device or channel not found."
There is no hardware available that matches the given search criteria. For example, you may have specified canWANT_EXTENDED but there's no controller capable of extended CAN. You may have specified a channel number that is out of the range for the hardware in question. You may have requested exclusive access to a channel, but the channel is already occupied.
canERR_NOMEM-4 "Out of memory."
A memory allocation failed.
canERR_NOCHANNELS-5 "No channels avaliable."
There is indeed hardware matching the criteria you specified, but there are no channels available, or the channel you specified is already occupied.
canERR_INTERRUPTED-5 "The call was interrrupted by a signal"
A signal e.g. the user pressed CTRL-C, interrupted a waiting canlib call.
canERR_TIMEOUT-7 "Timeout ocurred."
A function waited for something to happen (for example, the arrival of a message), but that something didn't happen.
canERR_NOTINITIALIZED-8 "The library is not initialized."
The driver is not initialized. canInitializeLibrary() was probably not called?
canERR_NOHANDLES-9 "Out of handles."
No handles are available inside canlib32. The application has too many handles open (i.e. has called canOpenChannel too many times, or there's a memory leak somewhere.) Note that we are not talking about Windows handles here, it's CANLIB's own internal handles.
canERR_INVHANDLE-10 "Handle is invalid."
The CANLIB handle you specified (if the API call includes a handle) is not valid.
canERR_DRIVER-12 CAN driver mode is not supported by the present hardware.
canERR_TXBUFOFL-13 "Transmit buffer overflow."
The transmit queue was full, so the message was dropped.
canERR_HARDWARE-15 "A hardware error has occurred."
Something probably related to the hardware happened. This could mean that the device does not respond (IRQ or address conflict?), or that the response was invalid or unexpected (faulty card?)
canERR_DYNALOAD-16 "A driver DLL can't be found or loaded."
(One of) the DLL(s) specified in the registry failed to load.
canERR_DYNALIB-17 "A DLL seems to have wrong version."
DLL version mismatch. (One of) the DLL(s) specified in the registry is - probably - too old, or - less likely - too new.
canERR_DYNAINIT-18 "Error when initializing a DLL."
Something failed when a device driver was being initialized. In other words, we can open the driver but it makes a lot of fuss about something we don't understand.
canERR_DRIVERLOAD-23 "Can't find or load kernel driver."
A device driver (kernel mode driver for NT, VxD for W95/98) failed to load; or the DLL could not open the device. Privilegies? Driver file missing?
canERR_DRIVERFAILED-24 DeviceIOControl failed; use Win32 GetLastError() to know what really happened.
canERR_REGISTRY-28 "Error (missing data) in the Registry."
A registry key is missing, invalid, malformed, has gone for lunch or what not. can_verify.exe might provide some insight.
canERR_LICENSE-29 The license is not valid.
canERR_INTERNAL-30 "Internal error in the driver."
Indicates an error condition in the driver or DLL which couldn't be properly handled. Please contact the friendly support at staff@kvaser.se.