Skip to content
A self-contained minimal library for interacting with Linux hot-plug events
C Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci
README.md minor version bump May 27, 2017
circle.yml
libue.h

README.md

libue Build Status

Zero dependency minimal library for interacting with Linux hot-plug events.

Installation

Just drop the header file into your C project.

Usage

#include "libue.h"

int main() {
    struct uevent_listener listener;
    struct uevent uev;
    int re;

    re = ue_init_listener(&listener);
    if (re < 0) {
        fprintf(stderr, "Failed to initilize libue listener, err: %d\n", re);
        return -1;
    }

    /* blocking call */
    while ((re = ue_wait_for_event(&listener, &uev)) == 0) {
        switch (uev.action) {
        case UEVENT_ACTION_ADD:
            printf("Device %s added.", uev.devpath);
            break;
        case UEVENT_ACTION_REMOVE:
            printf("Device %s removed.", uev.devpath);
            break;
        }
    }
}
You can’t perform that action at this time.