On Tue, May 20, 2014 at 01:19:44PM +0400, Vadim Zhukov wrote:
> 17.05.2014 20:32 ???????????????????????? "Fabian Raetz" 
> <fabian.ra...@gmail.com>
> ??????????????:
> >
> > Hi,
> >
> > i want to expose "capacity" (full capacity design)
> > as a sensor like the rest.
> >
> > This sensor will be used in an upcoming diff to upower to
> > expose "energy-full-design" and "capacity" properties if
> > this patch gets merged.
> >
> > Both patches together will fix wrong notifications about
> > broken batteries in KDE4.
> >
> > Cheers,
> > Fabian
> >
> >
> > Index: acpidev.h
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v
> > retrieving revision 1.33
> > diff -u -p -r1.33 acpidev.h
> > --- acpidev.h   13 Jul 2012 10:37:40 -0000      1.33
> > +++ acpidev.h   17 May 2014 15:51:29 -0000
> > @@ -278,7 +278,7 @@ struct acpibat_softc {
> >         struct acpibat_bst      sc_bst;
> >         volatile int            sc_bat_present;
> >
> > -       struct ksensor          sc_sens[8];
> > +       struct ksensor          sc_sens[9];
> >         struct ksensordev       sc_sensdev;
> >  };
> >
> > Index: acpibat.c
> > ===================================================================
> > RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v
> > retrieving revision 1.59
> > diff -u -p -r1.59 acpibat.c
> > --- acpibat.c   16 Oct 2011 11:59:21 -0000      1.59
> > +++ acpibat.c   17 May 2014 15:51:29 -0000
> > @@ -163,6 +163,12 @@ acpibat_monitor(struct acpibat_softc *sc
> >         sensor_attach(&sc->sc_sensdev, &sc->sc_sens[7]);
> >         sc->sc_sens[7].value = sc->sc_bst.bst_voltage * 1000;
> >
> > +       strlcpy(sc->sc_sens[8].desc, "capacity",
> > +           sizeof(sc->sc_sens[8].desc));
> > +       sc->sc_sens[8].type = type;
> > +       sensor_attach(&sc->sc_sensdev, &sc->sc_sens[8]);
> > +       sc->sc_sens[8].value = sc->sc_bif.bif_capacity * 1000;
> 
> It looks like a missing check for BIF_UNKNOWN, like in acpibat_refresh().
> Otherwise okay zhuk@.

If you look at the surrounding code in acpibat_monitor(), none of the
assignments check for *UNKNOWN values, so i dont think we should bother.

I agree that 'design capacity' might be better than "capacity" too..

todd, can you put this in snaps so that we know if there's some fallout
?

Landry

Reply via email to