Commit e1b78a33 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] uvcvideo: Add quirk to force the Oculus DK2 IR tracker to grayscale

This patch adds a quirk to force Y8 pixel format even if the camera reports
half-width YUYV.
Signed-off-by: default avatarPhilipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 4daee779
...@@ -331,6 +331,7 @@ static int uvc_parse_format(struct uvc_device *dev, ...@@ -331,6 +331,7 @@ static int uvc_parse_format(struct uvc_device *dev,
struct uvc_format_desc *fmtdesc; struct uvc_format_desc *fmtdesc;
struct uvc_frame *frame; struct uvc_frame *frame;
const unsigned char *start = buffer; const unsigned char *start = buffer;
unsigned int width_multiplier = 1;
unsigned int interval; unsigned int interval;
unsigned int i, n; unsigned int i, n;
__u8 ftype; __u8 ftype;
...@@ -366,6 +367,20 @@ static int uvc_parse_format(struct uvc_device *dev, ...@@ -366,6 +367,20 @@ static int uvc_parse_format(struct uvc_device *dev,
} }
format->bpp = buffer[21]; format->bpp = buffer[21];
/* Some devices report a format that doesn't match what they
* really send.
*/
if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
if (format->fcc == V4L2_PIX_FMT_YUYV) {
strlcpy(format->name, "Greyscale 8-bit (Y8 )",
sizeof(format->name));
format->fcc = V4L2_PIX_FMT_GREY;
format->bpp = 8;
width_multiplier = 2;
}
}
if (buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED) { if (buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED) {
ftype = UVC_VS_FRAME_UNCOMPRESSED; ftype = UVC_VS_FRAME_UNCOMPRESSED;
} else { } else {
...@@ -474,7 +489,8 @@ static int uvc_parse_format(struct uvc_device *dev, ...@@ -474,7 +489,8 @@ static int uvc_parse_format(struct uvc_device *dev,
frame->bFrameIndex = buffer[3]; frame->bFrameIndex = buffer[3];
frame->bmCapabilities = buffer[4]; frame->bmCapabilities = buffer[4];
frame->wWidth = get_unaligned_le16(&buffer[5]); frame->wWidth = get_unaligned_le16(&buffer[5])
* width_multiplier;
frame->wHeight = get_unaligned_le16(&buffer[7]); frame->wHeight = get_unaligned_le16(&buffer[7]);
frame->dwMinBitRate = get_unaligned_le32(&buffer[9]); frame->dwMinBitRate = get_unaligned_le32(&buffer[9]);
frame->dwMaxBitRate = get_unaligned_le32(&buffer[13]); frame->dwMaxBitRate = get_unaligned_le32(&buffer[13]);
...@@ -2504,6 +2520,15 @@ static struct usb_device_id uvc_ids[] = { ...@@ -2504,6 +2520,15 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceProtocol = 0, .bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX .driver_info = UVC_QUIRK_PROBE_MINMAX
| UVC_QUIRK_IGNORE_SELECTOR_UNIT }, | UVC_QUIRK_IGNORE_SELECTOR_UNIT },
/* Oculus VR Positional Tracker DK2 */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x2833,
.idProduct = 0x0201,
.bInterfaceClass = USB_CLASS_VIDEO,
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_FORCE_Y8 },
/* Generic USB Video Class */ /* Generic USB Video Class */
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) }, { USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) },
{} {}
......
...@@ -148,6 +148,7 @@ ...@@ -148,6 +148,7 @@
#define UVC_QUIRK_PROBE_DEF 0x00000100 #define UVC_QUIRK_PROBE_DEF 0x00000100
#define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200 #define UVC_QUIRK_RESTRICT_FRAME_RATE 0x00000200
#define UVC_QUIRK_RESTORE_CTRLS_ON_INIT 0x00000400 #define UVC_QUIRK_RESTORE_CTRLS_ON_INIT 0x00000400
#define UVC_QUIRK_FORCE_Y8 0x00000800
/* Format flags */ /* Format flags */
#define UVC_FMT_FLAG_COMPRESSED 0x00000001 #define UVC_FMT_FLAG_COMPRESSED 0x00000001
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment