/* * This file is part of fwm-sysdaemon * get_powerstat.h - retrieve power status information from kernel * * Copyright (c) 2021, 2022 firk (firk@cantconnect.ru) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. The origin of this software must not be misrepresented; you must * not claim that you wrote the original software. * 4. Altered versions in any form must be plainly marked as such, and * must not be misinterpreted as being the original software. * * This software is provided by the author and contributors `as is' * without any express or implied warranty. */ #ifndef INCLUDED_GET_POWERSTAT_H #define INCLUDED_GET_POWERSTAT_H typedef struct { ull total; ull charged; int charge_pctt; int is_charging; int is_ac_powered; int get_ac_err; int get_bat_err; /* [63]!=0 if name too long */ char batname[64]; } powerstat; extern int get_powerstat(powerstat * r, char const *batname, char const *acname); #endif