Subject: envsys version 2 API
To: None <tech-kern@netbsd.org>
From: Juan RP <juan@xtrarom.org>
List: tech-kern
Date: 04/20/2007 18:26:23
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;

IMHO we need only two ioctls ENVSYS_GRANGE and ENVSYS_GETDATA (which uses
a struct plistref), the code will be simplified a lot.

warnflags/validflags/envsys_units won't be touched, because they are IMHO
ok as is.

The userland app will use prop_dictionary_sendrecv_ioctl to set/get
the values for the sensor's dictionary.

Is it ok for you? my goal is to improve current design but without
changing it too much.

-- 
http://plog.xtrarom.org/
Juan RP's blog - NetBSD/pkgsrc news in Spanish