--[[
Copyright (C) 2016 Nick Guletskii

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

This file contains definitions from sensors.h from the lm-sensors project, which
is licensed under the LGPL v2.1 license. However, under section 5 of the
LGPLv2.1, because this file only containes "numerical parameters, data structure
layouts and accessors, and small macros and small inline functions (ten lines or
less in length)", this file falls outside the scope of LGPL v2.1. In other
words, this file only contains the information required to dynamically link to
lm-sensors, which means that this is not a derivative work but a "work that uses
the Library"
]]

local ffi = require("ffi")

local status, sens = pcall(function() return ffi.load(CURRENT_PATH_CONFIG.libsensors) end)
if not status then
	return false
end


-- These constants are used in the flags field of sensors_subfeature
SENSORS_MODE_R =				1
SENSORS_MODE_W =				2
SENSORS_COMPUTE_MAPPING =		4

ffi.cdef[[
static const int INT_MAX = 2147483647;

typedef struct sensors_bus_id {
	short type;
	short nr;
} sensors_bus_id;

typedef struct sensors_chip_name {
	char *prefix;
	sensors_bus_id bus;
	int addr;
	char *path;
} sensors_chip_name;

int sensors_init(void *input);

void sensors_cleanup(void);

int sensors_parse_chip_name(const char *orig_name, sensors_chip_name *res);

void sensors_free_chip_name(sensors_chip_name *chip);

int sensors_snprintf_chip_name(char *str, size_t size,
			       const sensors_chip_name *chip);

const char *sensors_get_adapter_name(const sensors_bus_id *bus);

typedef struct sensors_feature sensors_feature;

char *sensors_get_label(const sensors_chip_name *name,
			const sensors_feature *feature);

int sensors_get_value(const sensors_chip_name *name, int subfeat_nr,
		      double *value);

int sensors_set_value(const sensors_chip_name *name, int subfeat_nr,
		      double value);

int sensors_do_chip_sets(const sensors_chip_name *name);

const sensors_chip_name *sensors_get_detected_chips(const sensors_chip_name
						    *match, int *nr);

typedef enum sensors_feature_type {
	SENSORS_FEATURE_IN		= 0x00,
	SENSORS_FEATURE_FAN		= 0x01,
	SENSORS_FEATURE_TEMP		= 0x02,
	SENSORS_FEATURE_POWER		= 0x03,
	SENSORS_FEATURE_ENERGY		= 0x04,
	SENSORS_FEATURE_CURR		= 0x05,
	SENSORS_FEATURE_HUMIDITY	= 0x06,
	SENSORS_FEATURE_MAX_MAIN,
	SENSORS_FEATURE_VID		= 0x10,
	SENSORS_FEATURE_INTRUSION	= 0x11,
	SENSORS_FEATURE_MAX_OTHER,
	SENSORS_FEATURE_BEEP_ENABLE	= 0x18,
	SENSORS_FEATURE_MAX,
	SENSORS_FEATURE_UNKNOWN		= INT_MAX,
} sensors_feature_type;

typedef enum sensors_subfeature_type {
	SENSORS_SUBFEATURE_IN_INPUT = SENSORS_FEATURE_IN << 8,
	SENSORS_SUBFEATURE_IN_MIN,
	SENSORS_SUBFEATURE_IN_MAX,
	SENSORS_SUBFEATURE_IN_LCRIT,
	SENSORS_SUBFEATURE_IN_CRIT,
	SENSORS_SUBFEATURE_IN_AVERAGE,
	SENSORS_SUBFEATURE_IN_LOWEST,
	SENSORS_SUBFEATURE_IN_HIGHEST,
	SENSORS_SUBFEATURE_IN_ALARM = (SENSORS_FEATURE_IN << 8) | 0x80,
	SENSORS_SUBFEATURE_IN_MIN_ALARM,
	SENSORS_SUBFEATURE_IN_MAX_ALARM,
	SENSORS_SUBFEATURE_IN_BEEP,
	SENSORS_SUBFEATURE_IN_LCRIT_ALARM,
	SENSORS_SUBFEATURE_IN_CRIT_ALARM,

	SENSORS_SUBFEATURE_FAN_INPUT = SENSORS_FEATURE_FAN << 8,
	SENSORS_SUBFEATURE_FAN_MIN,
	SENSORS_SUBFEATURE_FAN_MAX,
	SENSORS_SUBFEATURE_FAN_ALARM = (SENSORS_FEATURE_FAN << 8) | 0x80,
	SENSORS_SUBFEATURE_FAN_FAULT,
	SENSORS_SUBFEATURE_FAN_DIV,
	SENSORS_SUBFEATURE_FAN_BEEP,
	SENSORS_SUBFEATURE_FAN_PULSES,
	SENSORS_SUBFEATURE_FAN_MIN_ALARM,
	SENSORS_SUBFEATURE_FAN_MAX_ALARM,

	SENSORS_SUBFEATURE_TEMP_INPUT = SENSORS_FEATURE_TEMP << 8,
	SENSORS_SUBFEATURE_TEMP_MAX,
	SENSORS_SUBFEATURE_TEMP_MAX_HYST,
	SENSORS_SUBFEATURE_TEMP_MIN,
	SENSORS_SUBFEATURE_TEMP_CRIT,
	SENSORS_SUBFEATURE_TEMP_CRIT_HYST,
	SENSORS_SUBFEATURE_TEMP_LCRIT,
	SENSORS_SUBFEATURE_TEMP_EMERGENCY,
	SENSORS_SUBFEATURE_TEMP_EMERGENCY_HYST,
	SENSORS_SUBFEATURE_TEMP_LOWEST,
	SENSORS_SUBFEATURE_TEMP_HIGHEST,
	SENSORS_SUBFEATURE_TEMP_MIN_HYST,
	SENSORS_SUBFEATURE_TEMP_LCRIT_HYST,
	SENSORS_SUBFEATURE_TEMP_ALARM = (SENSORS_FEATURE_TEMP << 8) | 0x80,
	SENSORS_SUBFEATURE_TEMP_MAX_ALARM,
	SENSORS_SUBFEATURE_TEMP_MIN_ALARM,
	SENSORS_SUBFEATURE_TEMP_CRIT_ALARM,
	SENSORS_SUBFEATURE_TEMP_FAULT,
	SENSORS_SUBFEATURE_TEMP_TYPE,
	SENSORS_SUBFEATURE_TEMP_OFFSET,
	SENSORS_SUBFEATURE_TEMP_BEEP,
	SENSORS_SUBFEATURE_TEMP_EMERGENCY_ALARM,
	SENSORS_SUBFEATURE_TEMP_LCRIT_ALARM,

	SENSORS_SUBFEATURE_POWER_AVERAGE = SENSORS_FEATURE_POWER << 8,
	SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST,
	SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST,
	SENSORS_SUBFEATURE_POWER_INPUT,
	SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST,
	SENSORS_SUBFEATURE_POWER_INPUT_LOWEST,
	SENSORS_SUBFEATURE_POWER_CAP,
	SENSORS_SUBFEATURE_POWER_CAP_HYST,
	SENSORS_SUBFEATURE_POWER_MAX,
	SENSORS_SUBFEATURE_POWER_CRIT,
	SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL = (SENSORS_FEATURE_POWER << 8) | 0x80,
	SENSORS_SUBFEATURE_POWER_ALARM,
	SENSORS_SUBFEATURE_POWER_CAP_ALARM,
	SENSORS_SUBFEATURE_POWER_MAX_ALARM,
	SENSORS_SUBFEATURE_POWER_CRIT_ALARM,

	SENSORS_SUBFEATURE_ENERGY_INPUT = SENSORS_FEATURE_ENERGY << 8,

	SENSORS_SUBFEATURE_CURR_INPUT = SENSORS_FEATURE_CURR << 8,
	SENSORS_SUBFEATURE_CURR_MIN,
	SENSORS_SUBFEATURE_CURR_MAX,
	SENSORS_SUBFEATURE_CURR_LCRIT,
	SENSORS_SUBFEATURE_CURR_CRIT,
	SENSORS_SUBFEATURE_CURR_AVERAGE,
	SENSORS_SUBFEATURE_CURR_LOWEST,
	SENSORS_SUBFEATURE_CURR_HIGHEST,
	SENSORS_SUBFEATURE_CURR_ALARM = (SENSORS_FEATURE_CURR << 8) | 0x80,
	SENSORS_SUBFEATURE_CURR_MIN_ALARM,
	SENSORS_SUBFEATURE_CURR_MAX_ALARM,
	SENSORS_SUBFEATURE_CURR_BEEP,
	SENSORS_SUBFEATURE_CURR_LCRIT_ALARM,
	SENSORS_SUBFEATURE_CURR_CRIT_ALARM,

	SENSORS_SUBFEATURE_HUMIDITY_INPUT = SENSORS_FEATURE_HUMIDITY << 8,

	SENSORS_SUBFEATURE_VID = SENSORS_FEATURE_VID << 8,

	SENSORS_SUBFEATURE_INTRUSION_ALARM = SENSORS_FEATURE_INTRUSION << 8,
	SENSORS_SUBFEATURE_INTRUSION_BEEP,

	SENSORS_SUBFEATURE_BEEP_ENABLE = SENSORS_FEATURE_BEEP_ENABLE << 8,

	SENSORS_SUBFEATURE_UNKNOWN = INT_MAX,
} sensors_subfeature_type;

struct sensors_feature {
	char *name;
	int number;
	sensors_feature_type type;
	/* Members below are for libsensors internal use only */
	int first_subfeature;
	int padding1;
};

typedef struct sensors_subfeature {
	char *name;
	int number;
	sensors_subfeature_type type;
	int mapping;
	unsigned int flags;
} sensors_subfeature;

const sensors_feature *
sensors_get_features(const sensors_chip_name *name, int *nr);

const sensors_subfeature *
sensors_get_all_subfeatures(const sensors_chip_name *name,
			    const sensors_feature *feature, int *nr);

const sensors_subfeature *
sensors_get_subfeature(const sensors_chip_name *name,
		       const sensors_feature *feature,
		       sensors_subfeature_type type);

]]

ffi_types["sensors_bus_id"] = ffi.typeof("sensors_bus_id")
ffi_types["sensors_bus_id_ptr"] = ffi.typeof("sensors_bus_id*")
ffi_types["sensors_bus_id_ref"] = ffi.typeof("sensors_bus_id[1]")
ffi_types["sensors_bus_id_arr"] = ffi.typeof("sensors_bus_id[?]")
ffi_types["sensors_chip_name"] = ffi.typeof("sensors_chip_name")
ffi_types["sensors_chip_name_ptr"] = ffi.typeof("sensors_chip_name*")
ffi_types["sensors_chip_name_ref"] = ffi.typeof("sensors_chip_name[1]")
ffi_types["sensors_chip_name_arr"] = ffi.typeof("sensors_chip_name[?]")

LIBSENSORS_SUBFEATURE_TYPES={}
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_INPUT]="IN_INPUT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_MIN]="IN_MIN"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_MAX]="IN_MAX"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_LCRIT]="IN_LCRIT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_CRIT]="IN_CRIT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_AVERAGE]="IN_AVERAGE"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_LOWEST]="IN_LOWEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_HIGHEST]="IN_HIGHEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_ALARM]="IN_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_MIN_ALARM]="IN_MIN_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_MAX_ALARM]="IN_MAX_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_BEEP]="IN_BEEP"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_LCRIT_ALARM]="IN_LCRIT_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_IN_CRIT_ALARM]="IN_CRIT_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_INPUT]="FAN_INPUT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_MIN]="FAN_MIN"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_MAX]="FAN_MAX"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_ALARM]="FAN_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_FAULT]="FAN_FAULT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_DIV]="FAN_DIV"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_BEEP]="FAN_BEEP"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_PULSES]="FAN_PULSES"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_MIN_ALARM]="FAN_MIN_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_FAN_MAX_ALARM]="FAN_MAX_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_INPUT]="TEMP_INPUT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_MAX]="TEMP_MAX"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_MAX_HYST]="TEMP_MAX_HYST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_MIN]="TEMP_MIN"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_CRIT]="TEMP_CRIT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_CRIT_HYST]="TEMP_CRIT_HYST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_LCRIT]="TEMP_LCRIT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_EMERGENCY]="TEMP_EMERGENCY"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_EMERGENCY_HYST]="TEMP_EMERGENCY_HYST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_LOWEST]="TEMP_LOWEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_HIGHEST]="TEMP_HIGHEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_MIN_HYST]="TEMP_MIN_HYST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_LCRIT_HYST]="TEMP_LCRIT_HYST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_ALARM]="TEMP_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_MAX_ALARM]="TEMP_MAX_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_MIN_ALARM]="TEMP_MIN_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_CRIT_ALARM]="TEMP_CRIT_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_FAULT]="TEMP_FAULT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_TYPE]="TEMP_TYPE"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_OFFSET]="TEMP_OFFSET"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_BEEP]="TEMP_BEEP"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_EMERGENCY_ALARM]="TEMP_EMERGENCY_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_TEMP_LCRIT_ALARM]="TEMP_LCRIT_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_AVERAGE]="POWER_AVERAGE"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST]="POWER_AVERAGE_HIGHEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST]="POWER_AVERAGE_LOWEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_INPUT]="POWER_INPUT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_INPUT_HIGHEST]="POWER_INPUT_HIGHEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_INPUT_LOWEST]="POWER_INPUT_LOWEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_CAP]="POWER_CAP"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_CAP_HYST]="POWER_CAP_HYST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_MAX]="POWER_MAX"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_CRIT]="POWER_CRIT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL]="POWER_AVERAGE_INTERVAL"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_ALARM]="POWER_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_CAP_ALARM]="POWER_CAP_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_MAX_ALARM]="POWER_MAX_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_POWER_CRIT_ALARM]="POWER_CRIT_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_ENERGY_INPUT]="ENERGY_INPUT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_INPUT]="CURR_INPUT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_MIN]="CURR_MIN"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_MAX]="CURR_MAX"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_LCRIT]="CURR_LCRIT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_CRIT]="CURR_CRIT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_AVERAGE]="CURR_AVERAGE"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_LOWEST]="CURR_LOWEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_HIGHEST]="CURR_HIGHEST"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_ALARM]="CURR_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_MIN_ALARM]="CURR_MIN_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_MAX_ALARM]="CURR_MAX_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_BEEP]="CURR_BEEP"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_LCRIT_ALARM]="CURR_LCRIT_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_CURR_CRIT_ALARM]="CURR_CRIT_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_HUMIDITY_INPUT]="HUMIDITY_INPUT"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_VID]="VID"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_INTRUSION_ALARM]="INTRUSION_ALARM"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_INTRUSION_BEEP]="INTRUSION_BEEP"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_BEEP_ENABLE]="BEEP_ENABLE"
LIBSENSORS_SUBFEATURE_TYPES[sens.SENSORS_SUBFEATURE_UNKNOWN]="UNKNOWN"

return sens
