freebsd-src/sys/x86
Warner Losh 8a3fafc821 acpi/apm: Improve APM ioctl interface emulation
The apm(8) program documents certain states, but doesn't document the
'unknown' state. It reports things correctly for systems with a battery,
but incorrectly for systems without one. Emulate the old interface a
little better by saying ac power is online if we have no status (instead
of unknown), the battery has a high charge of 255% if there's no battery
(instead of -1). Programs, like emacs, expect to see only the documented
values and misbehave when they see something else.

This is closer to what would happen on old-school APM machines. Sadly
(or not) I have no access to old-school APM machines to 100% confirm
this, but reading the spec, old code and testing with emacs' mode line
with battery suggests these values are more correct. emacs has never
been converted to acpi_conf due to permissions issues with acpi devices.

Fixing the kernel is preferable to hacking apm(8) for these special
cases because other programs that use these interfaces will also be more
correct. The kernel also has more data with which to decide what to
return.

Sponsored by:	Netflix
MFC After:	1 week
2024-01-10 17:05:00 -07:00
..
acpica acpi/apm: Improve APM ioctl interface emulation 2024-01-10 17:05:00 -07:00
bios sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00
conf sys: Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:54:58 -06:00
cpufreq sys: Automated cleanup of cdefs and other formatting 2023-11-26 22:24:00 -07:00
include x86: Make cpu_model[] public 2024-01-04 08:39:53 -05:00
iommu DMAR: add knob to disable RMRR entries installation into domains 2023-12-26 03:28:22 +02:00
isa atrtc: Add a required include 2023-12-28 15:17:32 -05:00
linux linux(4): Remove sys/cdefs.h inclusion under x86/linux due to 685dc743 2023-08-18 15:58:32 +03:00
pci pci_cfgreg: Add a PCI domain argument to the low-level register API 2023-11-29 10:31:47 -08:00
x86 sysctl: Don't pass CTLFLAG_MPSAFE to SYSCTL_STRING 2024-01-04 08:39:53 -05:00
xen xen: remove xen_domain_type enum/variable 2023-11-28 13:40:19 +01:00