static const struct ctrl sd_ctrls[] = {
};
+#define MODE_640x480 0x0001
+#define MODE_1280x1024 0x0002
+
+#define FORMAT_BAYER 0x0010
+#define FORMAT_UYUV 0x0020
+
+#define FPS_HIGH 0x0100
+
static const struct v4l2_pix_format color_camera_mode[] = {
{640, 480, V4L2_PIX_FMT_SGRBG8, V4L2_FIELD_NONE,
.bytesperline = 640,
.sizeimage = 640 * 480,
.colorspace = V4L2_COLORSPACE_SRGB,
- .priv = 0},
+ .priv = MODE_640x480 | FORMAT_BAYER | FPS_HIGH},
+ {640, 480, V4L2_PIX_FMT_UYVY, V4L2_FIELD_NONE,
+ .bytesperline = 640 * 2,
+ .sizeimage = 640 * 480 * 2,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = MODE_640x480 | FORMAT_UYUV},
+ {1280, 1024, V4L2_PIX_FMT_SGRBG8, V4L2_FIELD_NONE,
+ .bytesperline = 1280,
+ .sizeimage = 1280 * 1024,
+ .colorspace = V4L2_COLORSPACE_SRGB,
+ .priv = MODE_1280x1024 | FORMAT_BAYER},
};
static int kinect_write(struct usb_device *udev, uint8_t *data, uint16_t wLength)
static int sd_start(struct gspca_dev *gspca_dev)
{
- write_register(gspca_dev, 0x05, 0x00); // reset video stream
- write_register(gspca_dev, 0x0c, 0x00);
- write_register(gspca_dev, 0x0d, 0x01);
- write_register(gspca_dev, 0x0e, 0x1e); // 30Hz bayer
+ int mode;
+ uint8_t fmt_reg, fmt_val;
+ uint8_t res_reg, res_val;
+ uint8_t fps_reg, fps_val;
+
+ mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
+
+ fmt_reg = 0x0c;
+ res_reg = 0x0d;
+ fps_reg = 0x0e;
+
+ /* format */
+ if (mode & FORMAT_UYUV)
+ fmt_val = 0x05;
+ else
+ fmt_val = 0x00;
+
+ if (mode & MODE_1280x1024)
+ res_val = 0x02;
+ else
+ res_val = 0x01;
+
+ if (mode & FPS_HIGH)
+ fps_val = 0x1e;
+ else
+ fps_val = 0x0f;
+
+ /* Reset video stream */
+ write_register(gspca_dev, 0x05, 0x00);
+
+ write_register(gspca_dev, fmt_reg, fmt_val);
+ write_register(gspca_dev, res_reg, res_val);
+ write_register(gspca_dev, fps_reg, fps_val);
- /* Video Format: Raw bayer data */
- write_register(gspca_dev, 0x05, 0x01); // start video stream
+ /* Start video stream */
+ write_register(gspca_dev, 0x05, 0x01);
- write_register(gspca_dev, 0x47, 0x00); // disable Hflip
+ /* disable Hflip */
+ write_register(gspca_dev, 0x47, 0x00);
return 0;
}