How to disable backlight when laptop work on battery?

No completely disable, mental shortcut :D Linux or other windows when AC is unplugged, Brightness Control self power by give less light on screen. How to do it on FreeBSD? Because is no any difference between AC and Battery.
 
Do you use any desktop environment like XFCE, MATE or GNOME? They all have power managers that do this for you. Of course I don't know if they even work correctly on FreeBSD.

Another way would be to use devd(8) to run a script when you unplug your charger. The script would then need to set the brightness accordingly. There is an example devd entry at the end of /etc/devd.conf for this.

Anyway this probably a moot point if your laptop does not detect the AC state correctly as you mentioned in Thread laptop-do-not-detect-ac-charger.53367.
 
HP 8460p

Code:
root@komputer:~ # dmesg
Copyright (c) 1992-2014 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
   The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014
  root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz (2494.39-MHz K8-class CPU)
  Origin = "GenuineIntel"  Id = 0x206a7  Family = 0x6  Model = 0x2a  Stepping = 7
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x1fbae3ff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX>
  AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
  AMD Features2=0x1<LAHF>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  = 8589934592 (8192 MB)
avail memory = 8155799552 (7777 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <HPQOEM 161C  >
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 SMT threads
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
 cpu2 (AP): APIC ID:  2
 cpu3 (AP): APIC ID:  3
ioapic0 <Version 2.0> irqs 0-23 on motherboard
random: <Software, Yarrow> initialized
kbd1 at kbdmux0
acpi0: <HPQOEM SLIC-MPC> on motherboard
acpi0: Power Button (fixed)
acpi0: reservation of 0, 1000 (3) failed
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 14318180 Hz quality 950
Event timer "HPET" frequency 14318180 Hz quality 550
Event timer "HPET1" frequency 14318180 Hz quality 440
Event timer "HPET2" frequency 14318180 Hz quality 440
Event timer "HPET3" frequency 14318180 Hz quality 440
Event timer "HPET4" frequency 14318180 Hz quality 440
atrtc0: <AT realtime clock> port 0x70-0x77 irq 8 on acpi0
atrtc0: Warning: Couldn't map I/O.
Event timer "RTC" frequency 32768 Hz quality 0
attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
acpi_ec0: <Embedded Controller: GPE 0x16> port 0x62,0x66 on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0x4000-0x403f mem 0xd4000000-0xd43fffff,0xc0000000-0xcfffffff irq 16 at device 2.0 on pci0
agp0: <SandyBridge mobile GT2+ IG> on vgapci0
agp0: aperture size is 256M, detected 32764k stolen memory
acpi_video0: <ACPI video extension> on vgapci0
vgapci0: Boot video device
pci0: <simple comms> at device 22.0 (no driver attached)
em0: <Intel(R) PRO/1000 Network Connection 7.4.2> port 0x4040-0x405f mem 0xd4800000-0xd481ffff,0xd4829000-0xd4829fff irq 20 at device 25.0 on pci0
em0: Using an MSI interrupt
em0: Ethernet address: e4:11:5b:27:2b:fd
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xd4828000-0xd48283ff irq 16 at device 26.0 on pci0
usbus0: EHCI version 1.0
usbus0 on ehci0
hdac0: <Intel Cougar Point HDA Controller> mem 0xd4820000-0xd4823fff irq 22 at device 27.0 on pci0
pcib1: <ACPI PCI-PCI bridge> irq 17 at device 28.0 on pci0
pci1: <ACPI PCI bus> on pcib1
pcib2: <ACPI PCI-PCI bridge> irq 16 at device 28.1 on pci0
pci2: <ACPI PCI bus> on pcib2
pcib3: <ACPI PCI-PCI bridge> irq 18 at device 28.2 on pci0
pci35: <ACPI PCI bus> on pcib3
pci35: <serial bus, FireWire> at device 0.0 (no driver attached)
sdhci_pci0: <Generic SD HCI> mem 0xd4603000-0xd46030ff irq 18 at device 0.2 on pci35
sdhci_pci0: 1 slot(s) allocated
pcib4: <ACPI PCI-PCI bridge> irq 19 at device 28.3 on pci0
pci36: <ACPI PCI bus> on pcib4
iwn0: <Intel Centrino Ultimate-N 6300> mem 0xd4500000-0xd4501fff irq 19 at device 0.0 on pci36
pcib5: <ACPI PCI-PCI bridge> irq 19 at device 28.7 on pci0
pci37: <ACPI PCI bus> on pcib5
xhci0: <NEC uPD720200 USB 3.0 controller> mem 0xd4400000-0xd4401fff irq 19 at device 0.0 on pci37
xhci0: 32 byte context size.
usbus1 on xhci0
ehci1: <EHCI (generic) USB 2.0 controller> mem 0xd4827000-0xd48273ff irq 16 at device 29.0 on pci0
usbus2: EHCI version 1.0
usbus2 on ehci1
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel Cougar Point SATA300 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x4090-0x409f,0x4080-0x408f irq 19 at device 31.2 on pci0
ata0: <ATA channel> at channel 0 on atapci0
ata1: <ATA channel> at channel 1 on atapci0
atapci1: <Intel Cougar Point SATA300 controller> port 0x40a8-0x40af,0x40c4-0x40c7,0x40a0-0x40a7,0x40c0-0x40c3,0x4070-0x407f,0x4060-0x406f irq 19 at device 31.5 on pci0
ata2: <ATA channel> at channel 0 on atapci1
ata3: <ATA channel> at channel 1 on atapci1
battery0: <ACPI Control Method Battery> on acpi0
battery1: <ACPI Control Method Battery> on acpi0
acpi_acad0: <AC Adapter> on acpi0
acpi_button0: <Sleep Button> on acpi0
acpi_lid0: <Control Method Lid Switch> on acpi0
acpi_wmi0: <ACPI-WMI mapping> on acpi0
acpi_hp0: <HP ACPI-WMI Mapping> on acpi_wmi0
acpi_hp0: HP event GUID detected, installing event handler
acpi_hp0: HP CMI GUID detected
acpi_tz0: <Thermal Zone> on acpi0
acpi_tz1: <Thermal Zone> on acpi0
acpi_tz2: <Thermal Zone> on acpi0
acpi_tz3: <Thermal Zone> on acpi0
acpi_tz4: <Thermal Zone> on acpi0
acpi_tz5: <Thermal Zone> on acpi0
acpi_tz6: <Thermal Zone> on acpi0
acpi_tz7: <Thermal Zone> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: model IntelliMouse, device ID 3
ppc1: <Parallel port> port 0x378-0x37f,0x778-0x77a irq 5 on acpi0
ppc1: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode
ppc1: FIFO with 16/16/15 bytes threshold
ppbus0: <Parallel port bus> on ppc1
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
ppc0: cannot reserve I/O port range
est0: <Enhanced SpeedStep Frequency Control> on cpu0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
est2: <Enhanced SpeedStep Frequency Control> on cpu2
est3: <Enhanced SpeedStep Frequency Control> on cpu3
Timecounters tick every 10.000 msec
hdacc0: <IDT 92HD81B1X HDA CODEC> at cad 0 on hdac0
hdaa0: <IDT 92HD81B1X Audio Function Group> at nid 1 on hdacc0
pcm0: <IDT 92HD81B1X (Analog 2.0+HP/2.0)> at nid 13,11 and 12 on hdaa0
pcm1: <IDT 92HD81B1X (Internal Analog Mic)> at nid 17 on hdaa0
hdacc1: <Lucent/Agere Systems (0x1040) HDA CODEC> at cad 1 on hdac0
unknown: <Lucent/Agere Systems (0x1040) HDA CODEC Modem Function Group> at nid 1 on hdacc1 (no driver attached)
hdacc2: <Intel Cougar Point HDA CODEC> at cad 3 on hdac0
hdaa1: <Intel Cougar Point Audio Function Group> at nid 1 on hdacc2
pcm2: <Intel Cougar Point (HDMI/DP 8ch)> at nid 5 on hdaa1
pcm3: <Intel Cougar Point (HDMI/DP 8ch)> at nid 6 on hdaa1
pcm4: <Intel Cougar Point (HDMI/DP 8ch)> at nid 7 on hdaa1
random: unblocking device.
usbus0: 480Mbps High Speed USB v2.0
usbus1: 5.0Gbps Super Speed USB v3.0
usbus2: 480Mbps High Speed USB v2.0
ugen2.1: <Intel> at usbus2
uhub0: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
ugen1.1: <0x1033> at usbus1
uhub1: <0x1033 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus1
ugen0.1: <Intel> at usbus0
uhub2: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub1: 4 ports with 4 removable, self powered
uhub2: 3 ports with 3 removable, self powered
uhub0: 3 ports with 3 removable, self powered
ada0 at ata0 bus 0 scbus0 target 0 lun 0
ada0: <TOSHIBA MK2561GSYN MH000C> ATA-8 SATA 2.x device
ada0: Serial Number Y1SXT43OT
ada0: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
ada0: 238475MB (488397168 512 byte sectors: 16H 63S/T 16383C)
ada0: Previously was known as ad0
cd0 at ata1 bus 0 scbus1 target 0 lun 0
cd0: <hp DVD A  DS8A5LH 1H68> Removable CD-ROM SCSI-0 device
cd0: Serial Number 109240022541
cd0: 150.000MB/s transfers (SATA 1.x, UDMA5, ATAPI 12bytes, PIO 8192bytes)
cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed
SMP: AP CPU #1 Launched!
SMP: AP CPU #3 Launched!
SMP: AP CPU #2 Launched!
Timecounter "TSC-low" frequency 1247194030 Hz quality 1000
ugen0.2: <vendor 0x8087> at usbus0
uhub3: <vendor 0x8087 product 0x0024, class 9/0, rev 2.00/0.00, addr 2> on usbus0
ugen2.2: <vendor 0x8087> at usbus2
uhub4: <vendor 0x8087 product 0x0024, class 9/0, rev 2.00/0.00, addr 2> on usbus2
Root mount waiting for: usbus2 usbus0
uhub3: 6 ports with 6 removable, self powered
Root mount waiting for: usbus2 usbus0
uhub4: 8 ports with 8 removable, self powered
ugen0.3: <vendor 0x138a> at usbus0
ugen2.3: <Broadcom Corp> at usbus2
Trying to mount root from ufs:/dev/ada0p2 [rw]...
WARNING: / was not properly dismounted
WARNING: /: mount pending error: blocks 0 files 11
wlan0: Ethernet address: 24:77:03:22:26:0c
ubt0: <Broadcom Corp HP Integrated Module, class 224/1, rev 2.00/3.06, addr 3> on usbus2
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
info: [drm] Initialized drm 1.1.0 20060810
drmn0: <Intel SandyBridge (M)> on vgapci0
info: [drm] MSI enabled 1 message(s)
info: [drm] AGP at 0xc0000000 256MB
iicbus0: <Philips I2C bus> on iicbb0 addr 0xff
iic0: <I2C generic I/O> on iicbus0
iic1: <I2C generic I/O> on iicbus1
iicbus2: <Philips I2C bus> on iicbb1 addr 0x0
iic2: <I2C generic I/O> on iicbus2
iic3: <I2C generic I/O> on iicbus3
iicbus4: <Philips I2C bus> on iicbb2 addr 0x0
iic4: <I2C generic I/O> on iicbus4
iic5: <I2C generic I/O> on iicbus5
iicbus6: <Philips I2C bus> on iicbb3 addr 0x0
iic6: <I2C generic I/O> on iicbus6
iic7: <I2C generic I/O> on iicbus7
iicbus8: <Philips I2C bus> on iicbb4 addr 0x0
iic8: <I2C generic I/O> on iicbus8
iic9: <I2C generic I/O> on iicbus9
iicbus10: <Philips I2C bus> on iicbb5 addr 0x0
iic10: <I2C generic I/O> on iicbus10
iic11: <I2C generic I/O> on iicbus11
iicbus12: <Philips I2C bus> on iicbb6 addr 0x0
iic12: <I2C generic I/O> on iicbus12
iic13: <I2C generic I/O> on iicbus13
iicbus14: <Philips I2C bus> on iicbb7 addr 0x0
iic14: <I2C generic I/O> on iicbus14
iic15: <I2C generic I/O> on iicbus15
info: [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
info: [drm] Driver supports precise vblank timestamp query.
info: [drm] Enabling RC6 states: RC6 on, RC6p on, RC6pp on
drmn0: taking over the fictitious range 0xc0000000-0xd0000000
info: [drm] GMBUS timed out, falling back to bit banging on pin 7 [gmbus bus dpd]
fbd0 on drmn0
info: [drm] Initialized i915 1.6.0 20080730
wlan0: link state changed to DOWN
wlan0: link state changed to UP
wlan0: link state changed to DOWN
wlan0: link state changed to UP
ugen1.2: <vendor 0x058f> at usbus1
umass0: <vendor 0x058f product 0x6387, class 0/0, rev 2.00/1.02, addr 1> on usbus1
umass0:  SCSI over Bulk-Only; quirks = 0x4101
umass0:4:0:-1: Attached to scbus4
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: <Generic Flash Disk 8.07> Removable Direct Access SCSI-2 device
da0: 40.000MB/s transfers
da0: 1900MB (3891200 512 byte sectors: 255H 63S/T 242C)
da0: quirks=0x2<NO_6_BYTE>
ugen1.2: <vendor 0x058f> at usbus1 (disconnected)
umass0: at uhub1, port 3, addr 1 (disconnected)
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: <Generic Flash Disk 8.07> detached
(da0:umass-sim0:0:0:0): Periph destroyed
Device da0s1 went missing before all of the data could be written to it; expect data loss.
root@komputer:~ #
 
Back
Top