From 358e09aaa9c404671d83f7d71e22b8d4ae2c46b2 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Thu, 23 Oct 2008 23:19:27 +0200 Subject: [PATCH] Check backlight level range before using it I have seen brightness values decrease from 255 down to 0 and on to negative values on a rawhide/Fedora 10 beta system with Xorg 1.5.2. After going down to negative values, it is impossible to change the backlight level until the next reboot. This check should prevent the problem. Whether this is preventing the root of the problem or just a symptom, remains to be determined. --- src/rhd_lvtma.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/rhd_lvtma.c b/src/rhd_lvtma.c index 0dfa296..c777f3f 100644 --- a/src/rhd_lvtma.c +++ b/src/rhd_lvtma.c @@ -201,6 +201,13 @@ LVDSSetBacklight(struct rhdOutput *Output, int level) struct LVDSPrivate *Private = (struct LVDSPrivate *) Output->Private; RHDPtr rhdPtr = RHDPTRI(Output); + if ((level & ~0xff) != 0) { + xf86DrvMsg(rhdPtr->scrnIndex, X_ERROR, + "%s: BL_MOD_LEVEL out of range: %d. Ignoring.\n", + __func__, level); + return; + } + Private->BlLevel = level; xf86DrvMsg(rhdPtr->scrnIndex, X_INFO, -- 1.6.0.3