hw.sensors.acpibat0.raw0 - does it change state?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

hw.sensors.acpibat0.raw0 - does it change state?

tomr
Am I right in thinking that pulling the power cable cannot be directly
detected by sensorsd, because a 'state change' does not occur? A la...

hw.sensors.acpibat0.raw0=1 (battery discharging), OK

vs:

hw.sensors.acpibat0.raw0=2 (battery charging), OK

I want to detect whether the power status changes, within a short period
of time, regardless of remaining battery life, then do something
visible/audible so I can notice, and do something/s to reduce power
consumption. As a first step, dimming the screen would be meet both goals.

I would like the effect to be nearly instant, but if it's not instant
that's okay. And I'd like to avoid monitoring a dependent variable like
hw.sensors.acpibat0.power0 and then checking the A/C status every time a
change is detected.

tia,
tom

Reply | Threaded
Open this post in threaded view
|

Re: hw.sensors.acpibat0.raw0 - does it change state?

Zé Loff-2
On Mon, Sep 19, 2016 at 12:45:27AM +1000, tomr wrote:
> Am I right in thinking that pulling the power cable cannot be directly
> detected by sensorsd, because a 'state change' does not occur? A la...

hw.sensors.acpiac* ?

--

Reply | Threaded
Open this post in threaded view
|

Re: hw.sensors.acpibat0.raw0 - does it change state?

Theo de Raadt-2
In reply to this post by tomr
> I would like the effect to be nearly instant, but if it's not instant
> that's okay. And I'd like to avoid monitoring a dependent variable like
> hw.sensors.acpibat0.power0 and then checking the A/C status every time a
> change is detected.

sensors do not update instantly.  They are serviced in a loop by
a thread.  but it happens soon enough.  use 'systat sens 1' to watch.

Reply | Threaded
Open this post in threaded view
|

Re: hw.sensors.acpibat0.raw0 - does it change state?

Riccardo Mottola
In reply to this post by tomr
Hi,

tomr wrote:
> Am I right in thinking that pulling the power cable cannot be directly
> detected by sensorsd, because a 'state change' does not occur? A la...
>
> hw.sensors.acpibat0.raw0=1 (battery discharging), OK
>
> vs:
>
> hw.sensors.acpibat0.raw0=2 (battery charging), OK

acpiac0.indicator0 ?

That's what I use in GNUstep battery monitor - appears to be fine on
most laptops I have ad access to.

Riccardo

Reply | Threaded
Open this post in threaded view
|

Re: hw.sensors.acpibat0.raw0 - does it change state?

lists-2
In reply to this post by Theo de Raadt-2
> > I would like the effect to be nearly instant, but if it's not instant
> > that's okay. And I'd like to avoid monitoring a dependent variable like
> > hw.sensors.acpibat0.power0 and then checking the A/C status every time a
> > change is detected.  
>
> sensors do not update instantly.  They are serviced in a loop by
> a thread.  but it happens soon enough.  use 'systat sens 1' to watch.
>

Hi misc@,

Please advise, is the frequency of sensor updates the same for upd(4)
and is it possible it becomes the same as other sensors too?  Thanks.

Kind regards,
Anton

Reply | Threaded
Open this post in threaded view
|

Re: hw.sensors.acpibat0.raw0 - does it change state?

Theo de Raadt-2
> > > I would like the effect to be nearly instant, but if it's not instant
> > > that's okay. And I'd like to avoid monitoring a dependent variable like
> > > hw.sensors.acpibat0.power0 and then checking the A/C status every time a
> > > change is detected.  
> >
> > sensors do not update instantly.  They are serviced in a loop by
> > a thread.  but it happens soon enough.  use 'systat sens 1' to watch.
> >
>
> Hi misc@,
>
> Please advise, is the frequency of sensor updates the same for upd(4)
> and is it possible it becomes the same as other sensors too?  Thanks.

They are polled serially.  If one driver is slow, the entire loop slows
down.

Collection is not interrupt driven.

Reply | Threaded
Open this post in threaded view
|

Re: hw.sensors.acpibat0.raw0 - does it change state?

lists-2
Mon, 19 Sep 2016 11:53:45 -0600 "Theo de Raadt" <[hidden email]>

> > > > I would like the effect to be nearly instant, but if it's not instant
> > > > that's okay. And I'd like to avoid monitoring a dependent variable like
> > > > hw.sensors.acpibat0.power0 and then checking the A/C status every time a
> > > > change is detected.    
> > >
> > > sensors do not update instantly.  They are serviced in a loop by
> > > a thread.  but it happens soon enough.  use 'systat sens 1' to watch.
> > >  
> >
> > Hi misc@,
> >
> > Please advise, is the frequency of sensor updates the same for upd(4)
> > and is it possible it becomes the same as other sensors too?  Thanks.  
>
> They are polled serially.  If one driver is slow, the entire loop slows
> down.
>
> Collection is not interrupt driven.

Hi misc@, Theo,

Thanks for the details.  Latest snapshot here, acpi and cpu sensors for
the laptop battery, temp etc are responsive and quick.  However the UPS
sensor upd is slow or does not get updated, without usb cable reinsert.

I'd be happy to assist in establishing if my case is an unique problem.
Can provide full dmesg and other details please advise what's required.

Kind regards,
Anton

Reply | Threaded
Open this post in threaded view
|

Re: hw.sensors.acpibat0.raw0 - does it change state?

tomr
In reply to this post by Zé Loff-2
Thanks for replies so far re both systat and hw.sensors.acpiac*


In both of the cases below I was watching either `sysctl hw.sensors' or
`systat sens 1' and could see eg acpiac0.indicator0 change promptly, but
there was no indication from sensorsd that the sensor exists.

## no sensorsd.conf file:

$ doas sensorsd -c1 & tail -0f /var/log/daemon
Sep 19 16:06:45 workpad sensorsd[9181]: startup, system has 22 sensors
Sep 19 16:06:48 workpad sensorsd[9181]: acpibat0.watthour3: 33.54 Wh, OK
Sep 19 16:06:48 workpad sensorsd[9181]: acpibat0.raw0: 2, OK

## with a sensorsd.conf file

$ doas sensorsd -c1 & tail -0f /var/log/daemon
Sep 20 09:46:34 workpad sensorsd[88233]: startup, system has 22 sensors
Sep 20 09:46:37 workpad sensorsd[29023]: acpibat0.watthour3: 35.45 Wh, OK
Sep 20 09:46:37 workpad sensorsd[29023]: acpibat0.watthour3: within
limits: 35.45 Wh
Sep 20 09:46:37 workpad sensorsd[29023]: acpibat0.raw0: 0, OK

## sensorsd.conf

hw.sensors.acpibat0.watthour3:low=3:command=/home/tomr/bin/sensors.sh %l
%s %x %t %n %2 %3 %4
hw.sensors.acpiac0.indicator0:command=/home/tom/bin/sensors.sh %l %s %x
%t %n %2 %3 %4
hw.sensors.acpibat0.raw0:command=/home/tomr/bin/sensors.sh %l %s %x %t
%n %2 %3 %4

(sensors.sh just writes its invocation out to a file)

## hw.sensors

$ sysctl hw.sensors
hw.sensors.cpu0.temp0=65.00 degC
hw.sensors.acpitz0.temp0=63.00 degC (zone temperature)
hw.sensors.acpibtn0.indicator0=On (lid open)
hw.sensors.acpibat0.volt0=14.80 VDC (voltage)
hw.sensors.acpibat0.volt1=16.49 VDC (current voltage)
hw.sensors.acpibat0.power0=0.00 W (rate)
hw.sensors.acpibat0.watthour0=35.45 Wh (last full capacity)
hw.sensors.acpibat0.watthour1=1.77 Wh (warning capacity)
hw.sensors.acpibat0.watthour2=0.20 Wh (low capacity)
hw.sensors.acpibat0.watthour3=35.45 Wh (remaining capacity), OK
hw.sensors.acpibat0.watthour4=46.03 Wh (design capacity)
hw.sensors.acpibat0.raw0=0 (battery full), OK
hw.sensors.acpiac0.indicator0=On (power supply)
hw.sensors.acpithinkpad0.fan0=3680 RPM

(apciac0.indicator0 responds reliably to un/plugging)

## dmesg

OpenBSD 6.0 (GENERIC.MP) #2319: Tue Jul 26 13:00:43 MDT 2016
    [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 8255741952 (7873MB)
avail mem = 8001060864 (7630MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xdae9d000 (68 entries)
bios0: vendor LENOVO version "G6ET96WW (2.56 )" date 04/29/2013
bios0: LENOVO 34486T7
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP TCPA SSDT SSDT SSDT HPET APIC MCFG ECDT FPDT
ASF! UEFI UEFI MSDM SSDT SSDT UEFI SSDT DBG2
acpi0: wakeup devices LID_(S4) SLPB(S3) IGBE(S4) EXP2(S4) XHCI(S3)
EHC1(S3) EHC2(S3) HDEF(S4)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz, 1696.41 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz, 1696.16 MHz
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz, 1696.16 MHz
cpu2:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz, 1696.16 MHz
cpu3:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,SENSOR,ARAT
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
acpimcfg0 at acpi0 addr 0xf8000000, bus 0-63
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (PEG_)
acpiprt2 at acpi0: bus 2 (EXP1)
acpiprt3 at acpi0: bus 3 (EXP2)
acpicpu0 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C2(350@80 mwait.1@0x20), C1(1000@1 mwait.1), PSS
acpipwrres0 at acpi0: PUBS, resource for XHCI, EHC1, EHC2
acpitz0 at acpi0: critical temperature is 200 degC
acpibtn0 at acpi0: LID_
acpibtn1 at acpi0: SLPB
"MSFT9000" at acpi0 not configured
"MSFT9001" at acpi0 not configured
"LEN0071" at acpi0 not configured
"LEN0030" at acpi0 not configured
"SMO1200" at acpi0 not configured
acpibat0 at acpi0: BAT0 model "45N1071" serial  9485 type LiP oem "SMP"
acpiac0 at acpi0: AC unit online
"LEN0078" at acpi0 not configured
acpithinkpad0 at acpi0
"PNP0C14" at acpi0 not configured
"PNP0C14" at acpi0 not configured
"INT33A0" at acpi0 not configured
acpivideo0 at acpi0: VID_
acpivout at acpivideo0 not configured
acpivideo1 at acpi0: VID_
cpu0: Enhanced SpeedStep 1696 MHz: speeds: 1801, 1800, 1700, 1600, 1500,
1400, 1300, 1200, 1100, 1000, 900, 800 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel Core 3G Host" rev 0x09
inteldrm0 at pci0 dev 2 function 0 "Intel HD Graphics 4000" rev 0x09
drm0 at inteldrm0
inteldrm0: msi
inteldrm0: 1366x768
wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
xhci0 at pci0 dev 20 function 0 "Intel 7 Series xHCI" rev 0x04: msi
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 "Intel xHCI root hub" rev 3.00/1.00 addr 1
"Intel 7 Series MEI" rev 0x04 at pci0 dev 22 function 0 not configured
ehci0 at pci0 dev 26 function 0 "Intel 7 Series USB" rev 0x04: apic 2 int 16
usb1 at ehci0: USB revision 2.0
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 27 function 0 "Intel 7 Series HD Audio" rev 0x04: msi
azalia0: codecs: Realtek ALC269, Intel/0x2806, using Realtek ALC269
audio0 at azalia0
ppb0 at pci0 dev 28 function 0 "Intel 7 Series PCIE" rev 0xc4: msi
pci1 at ppb0 bus 2
sdhc0 at pci1 dev 0 function 0 "Ricoh 5U823 SD/MMC" rev 0x04: apic 2 int 16
sdhc0: SDHC 3.0, 50 MHz base clock
sdmmc0 at sdhc0: 4-bit, sd high-speed, mmc high-speed, dma
ppb1 at pci0 dev 28 function 1 "Intel 7 Series PCIE" rev 0xc4: msi
pci2 at ppb1 bus 3
iwn0 at pci2 dev 0 function 0 "Intel Centrino Advanced-N 6205" rev 0x96:
msi, MIMO 2T2R, MoW, address 84:3a:4b:cf:7e:e4
ehci1 at pci0 dev 29 function 0 "Intel 7 Series USB" rev 0x04: apic 2 int 23
usb2 at ehci1: USB revision 2.0
uhub2 at usb2 "Intel EHCI root hub" rev 2.00/1.00 addr 1
pcib0 at pci0 dev 31 function 0 "Intel QS77 LPC" rev 0x04
ahci0 at pci0 dev 31 function 2 "Intel 7 Series AHCI" rev 0x04: msi,
AHCI 1.3
ahci0: port 0: 6.0Gb/s
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 0 lun 0: <ATA, SanDisk SD5SG212, 10.0> SCSI3
0/direct fixed naa.5001b449df708c96
sd0: 122104MB, 512 bytes/sector, 250069680 sectors, thin
ichiic0 at pci0 dev 31 function 3 "Intel 7 Series SMBus" rev 0x04: apic
2 int 18
iic0 at ichiic0
isa0 at pcib0
isadma0 at isa0
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
wsmouse0 at pms0 mux 0
wsmouse1 at pms0 mux 0
pms0: Synaptics clickpad, firmware 8.1
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
uhub3 at uhub1 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
ugen0 at uhub3 port 4 "Broadcom Corp BCM20702A0" rev 2.00/1.12 addr 3
uvideo0 at uhub3 port 6 configuration 1 interface 0 "SunplusIT INC.
Integrated Camera" rev 2.00/14.12 addr 4
video0 at uvideo0
uhub4 at uhub2 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (a799c995832697f6.a) swap on sd0b dump on sd0b
WARNING: / was not properly unmounted
uhub0 detached
ugen0 detached
video0 detached
uvideo0 detached
uhub3 detached
uhub1 detached
uhub4 detached
uhub2 detached
uhub0 at usb0 "Intel xHCI root hub" rev 3.00/1.00 addr 1
uhub1 at usb1 "Intel EHCI root hub" rev 2.00/1.00 addr 1
uhub2 at usb2 "Intel EHCI root hub" rev 2.00/1.00 addr 1
uhub3 at uhub1 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
ugen0 at uhub3 port 4 "Broadcom Corp BCM20702A0" rev 2.00/1.12 addr 3
uvideo0 at uhub3 port 6 configuration 1 interface 0 "SunplusIT INC.
Integrated Camera" rev 2.00/14.12 addr 4
video0 at uvideo0
uhub4 at uhub2 port 1 "Intel Rate Matching Hub" rev 2.00/0.00 addr 2
uhub0 detached
ugen0 detached