Hi,

the second camrea on my Lenovo X395 is an "IR" camera that produces some
greyscale picture.  video(1) doesn't support that format, but with this
patch I can use

 $ ffmpeg -f v4l2 -i /dev/video1 test.mp4
 $ mplayer test.mp4

to record and show the video correctly.

Patrick

diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index 0c382b39071..fbf058073ad 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -989,6 +1067,7 @@ uvideo_vs_parse_desc_format_uncompressed(struct 
uvideo_softc *sc,
     const usb_descriptor_t *desc)
 {
        struct usb_video_format_uncompressed_desc *d;
+       uint8_t format_ir_8bit[16] = UVIDEO_FORMAT_GUID_KSMEDIA_L8_IR;
        int i;
 
        d = (struct usb_video_format_uncompressed_desc *)(uint8_t *)desc;
@@ -1021,6 +1100,9 @@ uvideo_vs_parse_desc_format_uncompressed(struct 
uvideo_softc *sc,
                sc->sc_fmtgrp[i].pixelformat = V4L2_PIX_FMT_NV12;
        } else if (!strcmp(sc->sc_fmtgrp[i].format->u.uc.guidFormat, "UYVY")) {
                sc->sc_fmtgrp[i].pixelformat = V4L2_PIX_FMT_UYVY;
+       } else if (!memcmp(sc->sc_fmtgrp[i].format->u.uc.guidFormat,
+           format_ir_8bit, 16)) {
+               sc->sc_fmtgrp[i].pixelformat = V4L2_PIX_FMT_GREY;
        } else {
                sc->sc_fmtgrp[i].pixelformat = 0;
        }
diff --git a/sys/dev/usb/uvideo.h b/sys/dev/usb/uvideo.h
index dbc089e7e21..a952c829fef 100644
--- a/sys/dev/usb/uvideo.h
+++ b/sys/dev/usb/uvideo.h
@@ -308,6 +308,10 @@ struct usb_video_probe_commit {
     0x55, 0x59, 0x56, 0x59, 0x00, 0x00, 0x10, 0x00,    \
     0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,        0x9b, 0x71 }
 
+#define        UVIDEO_FORMAT_GUID_KSMEDIA_L8_IR        {       \
+    0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00,    \
+    0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,        0x9b, 0x71 }
+
 /*
  * USB Video Payload MJPEG
  */

Reply via email to