drivers/media/usb/gspca/kinect.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/gspca/kinect.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/gspca/kinect.c- Extension
.c- Size
- 11978 bytes
- Lines
- 475
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
gspca.h
Detected Declarations
struct pkt_hdrstruct cam_hdrstruct sdfunction kinect_writefunction kinect_readfunction send_cmdfunction write_registerfunction sd_config_videofunction sd_config_depthfunction sd_initfunction sd_start_videofunction sd_start_depthfunction sd_stopN_videofunction sd_stopN_depthfunction sd_pkt_scanfunction sd_probe
Annotated Snippet
struct pkt_hdr {
uint8_t magic[2];
uint8_t pad;
uint8_t flag;
uint8_t unk1;
uint8_t seq;
uint8_t unk2;
uint8_t unk3;
uint32_t timestamp;
};
struct cam_hdr {
uint8_t magic[2];
__le16 len;
__le16 cmd;
__le16 tag;
};
/* specific webcam descriptor */
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
uint16_t cam_tag; /* a sequence number for packets */
uint8_t stream_flag; /* to identify different stream types */
uint8_t obuf[0x400]; /* output buffer for control commands */
uint8_t ibuf[0x200]; /* input buffer for control commands */
};
#define MODE_640x480 0x0001
#define MODE_640x488 0x0002
#define MODE_1280x1024 0x0004
#define FORMAT_BAYER 0x0010
#define FORMAT_UYVY 0x0020
#define FORMAT_Y10B 0x0040
#define FPS_HIGH 0x0100
static const struct v4l2_pix_format depth_camera_mode[] = {
{640, 480, V4L2_PIX_FMT_Y10BPACK, V4L2_FIELD_NONE,
.bytesperline = 640 * 10 / 8,
.sizeimage = 640 * 480 * 10 / 8,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = MODE_640x488 | FORMAT_Y10B},
};
static const struct v4l2_pix_format video_camera_mode[] = {
{640, 480, V4L2_PIX_FMT_SGRBG8, V4L2_FIELD_NONE,
.bytesperline = 640,
.sizeimage = 640 * 480,
.colorspace = V4L2_COLORSPACE_SRGB,
.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_UYVY},
{1280, 1024, V4L2_PIX_FMT_SGRBG8, V4L2_FIELD_NONE,
.bytesperline = 1280,
.sizeimage = 1280 * 1024,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = MODE_1280x1024 | FORMAT_BAYER},
{640, 488, V4L2_PIX_FMT_Y10BPACK, V4L2_FIELD_NONE,
.bytesperline = 640 * 10 / 8,
.sizeimage = 640 * 488 * 10 / 8,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = MODE_640x488 | FORMAT_Y10B | FPS_HIGH},
{1280, 1024, V4L2_PIX_FMT_Y10BPACK, V4L2_FIELD_NONE,
.bytesperline = 1280 * 10 / 8,
.sizeimage = 1280 * 1024 * 10 / 8,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = MODE_1280x1024 | FORMAT_Y10B},
};
static int kinect_write(struct usb_device *udev, uint8_t *data,
uint16_t wLength)
{
return usb_control_msg(udev,
usb_sndctrlpipe(udev, 0),
0x00,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, 0, data, wLength, CTRL_TIMEOUT);
}
static int kinect_read(struct usb_device *udev, uint8_t *data, uint16_t wLength)
{
return usb_control_msg(udev,
usb_rcvctrlpipe(udev, 0),
0x00,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, 0, data, wLength, CTRL_TIMEOUT);
Annotation
- Immediate include surface: `gspca.h`.
- Detected declarations: `struct pkt_hdr`, `struct cam_hdr`, `struct sd`, `function kinect_write`, `function kinect_read`, `function send_cmd`, `function write_register`, `function sd_config_video`, `function sd_config_depth`, `function sd_init`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.