Warn only once on repeated occurrences of the same errno when the FBIOBLANK ioctl fails. Change the status of the message from error to info as this is ioctl is not supported for all fbdev drivers. Also give a better description to make the user happier.
Signed-off-by: Egbert Eich <[email protected]> --- hw/xfree86/fbdevhw/fbdevhw.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c index cbb4093..487a1dc 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.c +++ b/hw/xfree86/fbdevhw/fbdevhw.c @@ -829,6 +829,7 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) { fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long fbmode; + static int last_errno = 0; if (!pScrn->vtSema) return; @@ -850,9 +851,13 @@ fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) return; } - if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) fbmode)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "FBIOBLANK: %s\n", strerror(errno)); + if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) fbmode) && + last_errno != errno) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "FBIOBLANK: %s (Screen blanking not supported " + "by kernel)\n", strerror(errno)); + } + last_errno = errno; } Bool @@ -861,15 +866,18 @@ fbdevHWSaveScreen(ScreenPtr pScreen, int mode) ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen); fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long unblank; + static int last_errno = 0; if (!pScrn->vtSema) return TRUE; unblank = xf86IsUnblank(mode); - if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) (1 - unblank))) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "FBIOBLANK: %s\n", strerror(errno)); + if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *) (1 - unblank)) && + last_errno != errno) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "FBIOBLANK: (Screen blanking not supported by kernel)%s\n", strerror(errno)); + last_errno = errno; return FALSE; } -- 1.8.1.4 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
