Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Latest commit

 

History

History
44 lines (34 loc) · 1.38 KB

README.md

File metadata and controls

44 lines (34 loc) · 1.38 KB

ragequit

CircleCI

A bare metal header-only library to convert ACPI events into signals, without using acpid or any other dependencies (e.g. libnetlink or libmnl):

Power off button -> ACPI -> netlink -> ragequit -> callback

Currently supported device classes

  • button/power

Add support for your Thinkpad here.

Example

The following snippet is taken from the test's init process:

#define RAGEQUIT_IMPLEMENTATION
#include "ragequit.h"

static void power_off(void* opaque)
{
    struct ragequit_state* st = opaque;
    ragequit_deinitialize(st);

    printf("good bye...\n");

    (void)reboot(LINUX_REBOOT_CMD_POWER_OFF);
    perror("reboot(.._POWER_OFF)"), exit(1);
}

int main(void)
{
    printf("hello\n");

    struct ragequit_state st;
    ragequit_initialize(&st, power_off, &st);
    ragequit_run_event_loop(&st);
}