[PATCH 6/8] Provide a more consistent message if FBUF fails

Mauro Carvalho Chehab mchehab at redhat.com
Fri Feb 11 07:54:22 PST 2011


Instead of providing an useless info that FBUF fails, print an
error indicating what's the Fourcc format that fails.

Also, on debug mode, prints a message indicating the selection of a
given fourcc. This helps to verify if both the video adapter and the
video capture board were set to the same video format.

Signed-off-by: Mauro Carvalho Chehab <mchehab at redhat.com>

diff --git a/src/v4l.c b/src/v4l.c
index fbb8bd7..877977c 100644
--- a/src/v4l.c
+++ b/src/v4l.c
@@ -212,6 +212,7 @@ static struct V4L_DEVICE {
 static int SetV4LFmt(int fd, CARD32 pixelformat)
 {
     struct v4l2_framebuffer fbuf;
+    char *p = (char *)&pixelformat;
 
     memset(&fbuf, 0, sizeof(fbuf));
     if (ioctl(fd, VIDIOC_G_FBUF, &fbuf) == -1) {
@@ -221,10 +222,13 @@ static int SetV4LFmt(int fd, CARD32 pixelformat)
     if (fbuf.fmt.pixelformat != pixelformat) {
         fbuf.fmt.pixelformat = pixelformat;
         if (ioctl(fd, VIDIOC_S_FBUF, &fbuf) == -1) {
-            xf86Msg(X_ERROR, "v4l: Error %d: Can't set FBUF\n", errno);
+            xf86Msg(X_ERROR, "v4l: Error %d: Can't set FBUF to %c%c%c%c\n",
+                    errno, p[0], p[1], p[2], p[3]);
             return errno;
         }
     }
+    DEBUG(xf86Msg(X_INFO, "v4l: Set overlay format to %c%c%c%c\n",
+                  p[0], p[1], p[2], p[3]));
     return 0;
 }
 static int GetV4LFmt(int fd, CARD32 *pixelformat)
-- 
1.7.1




More information about the xorg-devel mailing list