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

Power off button listener (aka ACPI without dependencies)

License

Notifications You must be signed in to change notification settings

toknapp/ragequit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

Power off button listener (aka ACPI without dependencies)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published