Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 May 2022 14:50:48 GMT
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: e26ef41f7990 - main - backlight: Update cached value when getting the brightness
Message-ID:  <202205251450.24PEomVR088993@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=e26ef41f79902991c772b59927c721aa7fa5fc64

commit e26ef41f79902991c772b59927c721aa7fa5fc64
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2022-05-25 14:48:10 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-05-25 14:50:25 +0000

    backlight: Update cached value when getting the brightness
    
    External events can cause the backlight level to change (AC adapter
    plug/unplug for example) so cache the value there too.
    
    PR:             257796
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    MFC after:      1 week
---
 sys/dev/backlight/backlight.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/dev/backlight/backlight.c b/sys/dev/backlight/backlight.c
index 19d273ae55d8..2d3fe02d33e9 100644
--- a/sys/dev/backlight/backlight.c
+++ b/sys/dev/backlight/backlight.c
@@ -73,8 +73,10 @@ backlight_ioctl(struct cdev *dev, u_long cmd, caddr_t data,
 		/* Call the driver function so it fills up the props */
 		bcopy(data, &props, sizeof(struct backlight_props));
 		error = BACKLIGHT_GET_STATUS(sc->dev, &props);
-		if (error == 0)
+		if (error == 0) {
 			bcopy(&props, data, sizeof(struct backlight_props));
+			sc->cached_brightness = props.brightness;
+		}
 		break;
 	case BACKLIGHTUPDATESTATUS:
 		bcopy(data, &props, sizeof(struct backlight_props));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202205251450.24PEomVR088993>