Page MenuHomeFreeBSD

D57715.diff
No OneTemporary

D57715.diff

Index: sbin/devd/devd.conf.5
===================================================================
--- sbin/devd/devd.conf.5
+++ sbin/devd/devd.conf.5
@@ -354,6 +354,12 @@
.Pp
.Bl -column "SYSTEM" "SUBSYSTEM" "12345678" -compact
.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
+.It Li brightness Ta Li backlight%n Ta Li changed Ta
+The brightness of a display when it changes.
+.El
+.Pp
+.Bl -column "SYSTEM" "SUBSYSTEM" "12345678" -compact
+.Sy "System" Ta Sy "Subsystem" Ta Sy "Type" Ta Sy "Description"
.It Li CAM Ta Ta Ta
Events related to the
.Xr cam 4
Index: share/man/man9/backlight.9
===================================================================
--- share/man/man9/backlight.9
+++ share/man/man9/backlight.9
@@ -53,6 +53,20 @@
which is used to query the current brightness level and
.Fn BACKLIGHT_SET_STATUS
which is used to update it.
+.Pp
+Whenever a brightness change requested through
+.Xr backlight 8
+or any other consumer of
+.Pa /dev/backlight/*
+succeeds, the
+.Nm backlight
+driver emits a
+.Xr devctl 9
+notification on the
+.Dq BACKLIGHT
+system so that userland consumers, such as
+.Xr devd 8 ,
+can react to brightness changes.
.Sh INTERFACE
.Bl -tag -width indent
.It Fn BACKLIGHT_GET_STATUS "device_t bus" "struct backlight_props *props"
@@ -60,6 +74,11 @@
.It Fn BACKLIGHT_SET_STATUS "device_t bus" "struct backlight_props *props"
Driver update the backlight level based on the brightness member of the props
struct.
+On success, the
+.Nm backlight
+driver notifies
+.Xr devd 8
+of the new brightness level.
.El
.Sh FILES
.Bl -tag -width "/dev/backlight/*"
@@ -67,11 +86,17 @@
.El
.Sh SEE ALSO
.Xr backlight 8
+.Xr devd 8 ,
+.Xr devd.conf 5
.Sh HISTORY
The
.Nm backlight
interface first appear in
.Fx 13.0 .
+Notification of brightness changes via
+.Xr devctl 8
+was added in
+.Fx 15.2 .
The
.Nm backlight
driver and manual page was written by
Index: sys/dev/backlight/backlight.c
===================================================================
--- sys/dev/backlight/backlight.c
+++ sys/dev/backlight/backlight.c
@@ -32,6 +32,7 @@
#include <sys/conf.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
+#include <sys/devctl.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/sx.h>
@@ -59,6 +60,8 @@
struct backlight_softc *sc;
struct backlight_props props;
struct backlight_info info;
+ char notify_buf[16];
+ char bl_name[16];
int error;
sc = dev->si_drv1;
@@ -81,6 +84,12 @@
if (error == 0) {
bcopy(&props, data, sizeof(struct backlight_props));
sc->cached_brightness = props.brightness;
+ snprintf(bl_name, sizeof(bl_name), "backlight%u",
+ sc->unit);
+ snprintf(notify_buf, sizeof(notify_buf), "notify=%u",
+ props.brightness);
+ devctl_notify("brightness", bl_name,
+ "change", notify_buf);
}
break;
case BACKLIGHTGETINFO:

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 17, 5:31 AM (6 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35160560
Default Alt Text
D57715.diff (2 KB)

Event Timeline