Skip to content

Installation

dilshan edited this page Nov 22, 2026 · 2 revisions

Installation

Requirements

  • Linux, a C99 compiler (gcc/clang), make, kernel headers (linux/usbdevice_fs.h, normally from linux-libc-dev)
  • GTK 3 development files and pkg-config

On Debian/Ubuntu:

sudo apt install build-essential pkg-config libgtk-3-dev

libusb is not required.

Build

cd openlru-lib
make            # builds the library and the examples
make lib        # library only
make clean      # (optional) removes the build/ directory

Outputs are placed in build/:

File Purpose
build/libopenlru.a Static library
build/libopenlru.so Shared library
build/gtk_probe Sample application (list sensors, test the link)
build/gtk_capture Sample application (capture image and template)

If GTK is missing, make lib still work.

Install system-wide (optional)

sudo make install               # installs under /usr/local
sudo make install PREFIX=/usr   # or choose a prefix

This installs libopenlru.a, libopenlru.so and openlru.h.

Using the library in your project

Static linking, without installing:

gcc myapp.c -I/path/to/openlru-lib/include /path/to/openlru-lib/build/libopenlru.a -o myapp

If system-wide instalation is done:

gcc myapp.c -lopenlru -o myapp

In source: #include <openlru.h> (or "openlru.h").

Access without root (udev)

The sensor is accessed through /dev/bus/usb/.... To let normal users open it:

sudo cp udev/99-openlru.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules
sudo udevadm trigger

Then unplug and re-plug the sensor.

Environment variables

Variable Effect
OLRU_DENY_MSC If set, olru_probe() hides the mass-storage-type sensors (2009:7638, 2109:7638). Useful if the same ids are used by an ordinary USB drive on your system.

Clone this wiki locally