Skip to content

API Types and Constants

dilshan edited this page Nov 22, 2026 · 1 revision

Types and Constants

Constants

Name Value Meaning
OLRU_IMAGE_WIDTH 256 raw image width in pixels
OLRU_IMAGE_HEIGHT 288 raw image height in pixels
OLRU_IMAGE_SIZE 73728 raw image size in bytes (8 bit per pixel)
OLRU_BMP_SIZE 74806 size of the BMP produced by olru_image_to_bmp (54 + 1024 + 73728)
OLRU_TEMPLATE_SIZE 256 size of one feature template in bytes
OLRU_MAX_DEVICES 8 convenient array size for olru_probe

olru_status

Return value of every fallible function. Zero is success, negative is failure. Full descriptions are on Errors and Diagnostics.

Name Value
OLRU_OK 0
OLRU_ERR_ARG -1
OLRU_ERR_NO_DEVICE -2
OLRU_ERR_ACCESS -3
OLRU_ERR_IO -4
OLRU_ERR_TIMEOUT -5
OLRU_ERR_PROTOCOL -6
OLRU_ERR_NO_FINGER -7
OLRU_ERR_DEVICE -8
OLRU_ERR_NOMEM -9

olru_link_type

How the sensor's USB interface carries commands. You normally never need to look at this; the library picks the right one. See USB Protocol.

Name Meaning
OLRU_LINK_BULK vendor control request + plain bulk endpoints
OLRU_LINK_MSC bulk endpoints wrapped in mass-storage CBW/CSW blocks

olru_device_info

Describes one sensor found by olru_probe.

typedef struct {
    uint16_t       vid;          /* USB vendor id                        */
    uint16_t       pid;          /* USB product id                       */
    uint8_t        bus;          /* USB bus number                       */
    uint8_t        address;      /* device address on that bus           */
    olru_link_type link;         /* transport used by this model         */
    uint8_t        alt_opcodes;  /* 1 = model uses the alternate opcodes */
    const char    *name;         /* static, human readable model name    */
} olru_device_info;

bus and address match the numbers shown by lsusb (Bus 001 Device 003 → bus = 1, address = 3). They change when the sensor is re-plugged, so call olru_probe again after a reconnect.

olru_device

typedef struct olru_device olru_device;

Opaque handle returned by olru_open. Release it with olru_close.

Clone this wiki locally