libkyhwinfo(3)

libkyhwinfo3

获取键盘,鼠标,声卡,光驱,usb和电源硬件信息

Usage

#include <libkyhw.h>

extern struct HWInfo *kdk_hw_get_hwinfo(int type);

extern void kdk_hw_free_hw(struct HWInfo *list);

extern struct Power *kdk_hw_get_powerinfo();

extern void kdk_hw_free_power_info(struct Power *info);

Link with -lkyhwinfo.

Detailed Description

This library contains keyboard, mouse, sound card, optical drive, USB and power supply hardware information.

Data structures

Structure HWInfo contains information related to a keyboard, mouse, sound card, optical drive, USB hardware information:

struct HWInfo {

char model[ATTRSIZE];
char vendor[ATTRSIZE];
char device[ATTRSIZE];
char driver[ATTRSIZE];
char revision[ATTRSIZE];
char busid[ATTRSIZE];
char devicenum[ATTRSIZE];
char width[8];
char clock[8];
struct HWInfo *next;
};

There are other members not documented here, which are only meant for libkyhwinfo internal use.

Structure Power contains information related to a power supply information:

struct Power {

char daemon_version[32];
bool on_battery;
bool lid_is_closed;
bool lid_is_present;
char critical_action[32];
struct power_device *devices;
};

There are other members not documented here, which are only meant for libkyhwinfo internal use.

Structure power_device contains information related to a power supply specific information:

struct power_device {

char name[256];
char native_path[32];
bool power_supply;
char updated[64];
bool has_history;
bool has_statistics;
bool is_persent;
bool is_rechargeable;
char state[32];
char warning_level[32];
double energy;
double energy_empty;
double energy_full;
double energy_full_design;
double energy_rate;
double voltage;
long time_to_empty;
long time_to_full;
double percentage;
double temperature;
double capacity;
char technology[32];
bool online;
char icon_name[64];
struct power_device *next;
};

There are other members not documented here, which are only meant for libkyhwinfo internal use.

Return value

The return value is generally specific to the individual function called.

Conforming to

These functions are as per the withdrawn POSIX.1e draft specification. The following functions are Linux extensions: kdk_hw_get_hwinfo(), kdk_hw_free_hw(), kdk_hw_get_powerinfo() and kdk_hw_free_power_info().

From libkysdk-system 3.0.1.4-1 in Arch Linux 2026-11-07. Parsed by carta from the page's man source.