Subject: Re: envsys version 2 API
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 04/20/2007 22:05:30
In article <20070420182623.6075d9f7.juan@xtrarom.org>,
Juan RP  <juan@xtrarom.org> wrote:
>
>Hi, I want to implement envsys version 2 and I need to make the API
>before starting to modify the existing code.
>
>My current idea is to remove envsys_basic_info_t and just use
>a single struct to set/get values for a specific device sensor:
>
>/* struct used by a sensor device */
>typedef struct envsys_device {
>        uint8_t         sensor;         /* Sensor number */
>        uint8_t         units;          /* Type of sensor */
>        uint32_t        warnflags;      /* Warning flags */
>        uint32_t        validflags;     /* Valid flags */
>        int32_t         value_cur;      /* Current value */
>        int32_t         value_min;      /* Minimum value */
>        int32_t         value_max;      /* Maximum value */
>        int32_t         value_avg;      /* Average value */
>        char            desc[33];       /* Description of this sensor */
>        uint8_t         rpms;           /* For fans, nominal RPMs */
>        uint8_t         rfact;          /* For volts, (int)(factor x 10^4) */
>
>} envsys_dev_t;

- I would move rpms and rfact after units to make the struct smaller.
- I would use desc[32]
- perhaps we need 64 bit values?

christos