Skip to content

API Errors and Diagnostics

dilshan edited this page Nov 22, 2026 · 1 revision

Errors and Diagnostics

Status codes (olru_status)

Code Value Meaning What to do
OLRU_OK 0 Success -
OLRU_ERR_ARG -1 Invalid argument (NULL, buffer too small...) fix the call
OLRU_ERR_NO_DEVICE -2 No sensor found, or it was unplugged re-plug, call olru_probe again
OLRU_ERR_ACCESS -3 Permission denied on the USB node install the udev rule or run as root
OLRU_ERR_IO -4 A USB transfer failed retry; check cable; see Troubleshooting
OLRU_ERR_TIMEOUT -5 A USB transfer or the finger wait timed out retry
OLRU_ERR_PROTOCOL -6 The sensor sent an unexpected reply often means the wrong device type; see Supported Devices
OLRU_ERR_NO_FINGER -7 No finger on the sensor not a failure - poll again
OLRU_ERR_DEVICE -8 The sensor reported an error read olru_device_code
OLRU_ERR_NOMEM -9 Out of memory -

Test for success with rc == OLRU_OK (or rc < 0 for any failure).

OLRU_ERR_NO_FINGER is negative too, so handle it before a generic rc < 0 check when polling.

olru_strerror

const char *olru_strerror(int status);

Returns a static, human readable string for an olru_status value (for example "no finger on sensor"). Never returns NULL; unknown values give "unknown error".

olru_device_code

uint8_t olru_device_code(const olru_device *dev);

Returns the raw confirmation code from the sensor's most recent reply. Meaningful mainly after OLRU_ERR_DEVICE (or OLRU_ERR_NO_FINGER). Returns 0 for a NULL handle.

olru_device_code_text

const char *olru_device_code_text(uint8_t code);

Returns static text for a sensor confirmation code.

Code Text
0x00 OK
0x01 Communication error
0x02 No finger
0x03 Image capture failed
0x04 Finger too dry / image too light
0x05 Finger too wet / image too blurred
0x06 Image too messy
0x07 Too few feature points
0x15 No valid image in sensor buffer
other Other sensor error(s)

Typical error handling

int rc = olru_capture_image(dev);
if (rc == OLRU_OK) {
    /* got a finger */
} else if (rc == OLRU_ERR_NO_FINGER) {
    /* keep polling */
} else if (rc == OLRU_ERR_DEVICE) {
    fprintf(stderr, "sensor: %s\n", olru_device_code_text(olru_device_code(dev)));
} else {
    fprintf(stderr, "error: %s\n", olru_strerror(rc));
}

Clone this wiki locally