SteveM
You might be assuming that all brightness mechanisms eventually appear through the FreeBSD backlight framework, and that assumption may not hold for all modern hardware.
The reason /usr/bin/backlight uses ioctl() is because it is a client of the FreeBSD backlight device interface. It is not communicating directly with the panel, the GPU, ACPI firmware, or an embedded controller. It opens /dev/backlight/backlight0 and uses the ioctl interface exported by the backlight subsystem.
However, modern laptops have made the situation more complicated. Brightness control may be implemented through several different paths:
- ACPI video methods exposed by firmware.
- DRM/KMS backlight interfaces implemented by GPU drivers.
- Vendor-specific firmware interfaces.
- Embedded controller mechanisms.
- Other platform-specific methods.
Those mechanisms do not necessarily map one-to-one onto the FreeBSD backlight framework today. A laptop may have a perfectly functional brightness control path that is not represented as a /dev/backlight/* device.
Therefore, there are two separate questions:
What should MATE use on FreeBSD?
It should use the operating system's supported user-space interface rather than attempting to implement hardware detection itself. If FreeBSD exposes the backlight through /dev/backlight/backlight0, then the MATE helper should use the same ioctl interface that backlight(8) uses.
Does the FreeBSD backlight subsystem support every brightness mechanism used by current laptops?
That is a FreeBSD kernel/platform support question. If a vendor uses a mechanism that is not represented by the backlight framework, that support needs to be added at the appropriate layer. Otherwise every desktop environment would need to duplicate knowledge of ACPI quirks, vendor firmware interfaces, and GPU-specific behavior.
So the existence of modern vendor brightness mechanisms does not make the ioctl approach incorrect. It means the ioctl is only the final user-space interface. The important question is whether the kernel side exposes all required mechanisms through that interface.
The current MATE problem is that the FreeBSD backend is missing or incomplete. The broader FreeBSD problem is ensuring that the backlight framework represents the brightness mechanisms found in current hardware. Those are related issues, but they are not the same issue.