On 28/02/20(Fri) 12:34, Boudewijn Dijkstra wrote:
> Op Fri, 28 Feb 2020 11:14:43 +0100 schreef Martin Pieuchot
> <m...@openbsd.org>:
> > On 28/02/20(Fri) 10:02, Boudewijn Dijkstra wrote:
> > > Op Thu, 27 Feb 2020 17:30:34 +0100 schreef Martin Pieuchot
> > > <m...@openbsd.org>:
> > > > On 27/02/20(Thu) 16:58, boudew...@indes.com wrote:
> > > > > >Synopsis:    boolean indicators in sensorsd.conf(5) are too 
> > > > > >cumbersome
> > > > > >Category:    system
> > > > > >Environment:
> > > > >       System      : OpenBSD 6.6
> > > > >       Details     : OpenBSD 6.6 (GENERIC.MP) #372: Sat Oct 12 10:56:27
> > > > > MDT 2019
> > > dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > > > >
> > > > >       Architecture: OpenBSD.amd64
> > > > >       Machine     : amd64
> > > > > >Description:
> > > > >       Some upd(4) devices use -1 for "On" and some use 1.  sysctl(8) 
> > > > > and
> > > > > sensorsd(8) hide this detail from the user, which makes it difficult
> > > > > to define low and high values in sensorsd.conf(5).
> > > >
> > > > Which device reports "-1" for which usage?  Is this from any
> > > > specification or is it a workaround for your device?
> > > 
> > > In the misc@ thread I linked it was reported that different devices use
> > > different values.  My device happens to report -1 for "On".  Given how
> > > sensorsd.conf currently works, it would be most convenient if 0 and
> > > 1 were the only possible values.
> > 
> > You're rephrasing your diff in words.  My question is: can there be any
> > drawback to this approach?
> 
> They're boolean indicators, I don't think there can be any.  sensorsd(8) is
> the only program in base that can use upd(4) sensors.  sysctl(8) already
> treats them as booleans.  Obviously some people will have to change their
> sensorsd.conf(5) if this goes in.
> 
> > Did you check the spec?
> 
> I checked "Universal Serial Bus Usage Tables for HID Power Devices"
> https://www.usb.org/sites/default/files/documents/pdcv10.pdf
> For every boolean indicator it specifies two allowed values: 0 and 1.
> 
> > Why is your UPS returning -1 and not 1 in this case?
> 
> No idea.  It's working fine.  Some further testing revealed that On==-1 (and
> Off==0) for all the indicators that I can easily toggle (Charging,
> Discharging, ACPresent).
> 
> > Is this the right place to fix the bug?
> 
> I think so. It's a violation of HID Power, not generic HID, so it should be
> fixed in a place where HID Power data is (first) interpreted.

Thanks for checking.  I committed the simpler diff.  If you have any
other improvement for upd(4) or any other part of the system you're
welcome to submit them to tech@.

Thanks again,
Martin

Reply via email to