UVC gadget updates for v4.20
- configfs cleanups, fixes and extensions - Endianness fixes - Miscellaneous cleanups -----BEGIN PGP SIGNATURE----- iQJWBAABCgBAFiEEvZRkio5H7O2/GZsYYiVdKZ4oCyQFAluqZVoiHGxhdXJlbnQu cGluY2hhcnRAaWRlYXNvbmJvYXJkLmNvbQAKCRBiJV0pnigLJLsIEACSy6pyPb76 AaUPSUbG4KjlO/5PWZDER10SKoz8MA6iPI1eNQngqYfO0jCCEErdFF2fOrPv4BFg VdDgFJasitQSL9bC9OQhHRTNPOzukXfQ4HxwUlXWJx0MV6jCea14G0BcOHQOdmvc UVXjERMP6R9CuwH6flyRRAeVJT6A352wZiuWHmqEzvEdl8sqmDBH+23lTKmh9PBg ilBe+Bdb7cSrwncLaGxCFNgvhDrm3IEzPoAbq5vHpLiTVJkS12wKUtJ8DgeUlY7E +u3xwwdVrdxcRXrK3LD9G+Cx76JcNdR3OT0xdKZNPFDiGbWU5jCl1/ljk2KOS/SU QbG3PwWyM12SM2/Y/2XNAm8dzXKZNnTSe47/5Ke6D6mbFPK09iLBLcKbyzCI1eXo zLUGwNi3SWLPJfIpfVZ3z2L8M5G0f9EV0XFNd7alYiK2mZpk+POIAq+TECRP+wyV WmUrCfEFUCIe17bBDgDnlWD+5AOTN+oApisA2srrU3we+t7jp5OTLC7pA+dwFNlQ 0lwMNIqUdyJjGtae2ud3CJWkU1o05zssT9etSQGJomqESwBG0c7KwPy7kFG/dMas 29O7WcQfIldURYLUbP6C7aB9z/guU/o6V7Cm64lmxbXd1xCQuu3rTtKg/gu1Ue3H 8Xh0H3psjvn6RT24aKaYiGvfKzMNhD9+lw== =wxJG -----END PGP SIGNATURE----- Merge tag 'uvcg-20180925' of git://linuxtv.org/pinchartl/media into testing/next UVC gadget updates for v4.20 - configfs cleanups, fixes and extensions - Endianness fixes - Miscellaneous cleanups
This commit is contained in:
commit
755801cb9f
|
@ -12,6 +12,10 @@ Date: Dec 2014
|
|||
KernelVersion: 4.0
|
||||
Description: Control descriptors
|
||||
|
||||
All attributes read only:
|
||||
bInterfaceNumber - USB interface number for this
|
||||
streaming interface
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/control/class
|
||||
Date: Dec 2014
|
||||
KernelVersion: 4.0
|
||||
|
@ -109,6 +113,10 @@ Date: Dec 2014
|
|||
KernelVersion: 4.0
|
||||
Description: Streaming descriptors
|
||||
|
||||
All attributes read only:
|
||||
bInterfaceNumber - USB interface number for this
|
||||
streaming interface
|
||||
|
||||
What: /config/usb-gadget/gadget/functions/uvc.name/streaming/class
|
||||
Date: Dec 2014
|
||||
KernelVersion: 4.0
|
||||
|
@ -160,6 +168,10 @@ Description: Specific MJPEG format descriptors
|
|||
|
||||
All attributes read only,
|
||||
except bmaControls and bDefaultFrameIndex:
|
||||
bFormatIndex - unique id for this format descriptor;
|
||||
only defined after parent header is
|
||||
linked into the streaming class;
|
||||
read-only
|
||||
bmaControls - this format's data for bmaControls in
|
||||
the streaming header
|
||||
bmInterfaceFlags - specifies interlace information,
|
||||
|
@ -177,6 +189,10 @@ Date: Dec 2014
|
|||
KernelVersion: 4.0
|
||||
Description: Specific MJPEG frame descriptors
|
||||
|
||||
bFrameIndex - unique id for this framedescriptor;
|
||||
only defined after parent format is
|
||||
linked into the streaming header;
|
||||
read-only
|
||||
dwFrameInterval - indicates how frame interval can be
|
||||
programmed; a number of values
|
||||
separated by newline can be specified
|
||||
|
@ -204,6 +220,10 @@ Date: Dec 2014
|
|||
KernelVersion: 4.0
|
||||
Description: Specific uncompressed format descriptors
|
||||
|
||||
bFormatIndex - unique id for this format descriptor;
|
||||
only defined after parent header is
|
||||
linked into the streaming class;
|
||||
read-only
|
||||
bmaControls - this format's data for bmaControls in
|
||||
the streaming header
|
||||
bmInterfaceFlags - specifies interlace information,
|
||||
|
@ -224,6 +244,10 @@ Date: Dec 2014
|
|||
KernelVersion: 4.0
|
||||
Description: Specific uncompressed frame descriptors
|
||||
|
||||
bFrameIndex - unique id for this framedescriptor;
|
||||
only defined after parent format is
|
||||
linked into the streaming header;
|
||||
read-only
|
||||
dwFrameInterval - indicates how frame interval can be
|
||||
programmed; a number of values
|
||||
separated by newline can be specified
|
||||
|
|
|
@ -197,12 +197,6 @@ static const struct usb_descriptor_header * const uvc_ss_streaming[] = {
|
|||
NULL,
|
||||
};
|
||||
|
||||
void uvc_set_trace_param(unsigned int trace)
|
||||
{
|
||||
uvc_gadget_trace_param = trace;
|
||||
}
|
||||
EXPORT_SYMBOL(uvc_set_trace_param);
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
* Control requests
|
||||
*/
|
||||
|
@ -232,13 +226,8 @@ uvc_function_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
|
|||
struct v4l2_event v4l2_event;
|
||||
struct uvc_event *uvc_event = (void *)&v4l2_event.u.data;
|
||||
|
||||
/* printk(KERN_INFO "setup request %02x %02x value %04x index %04x %04x\n",
|
||||
* ctrl->bRequestType, ctrl->bRequest, le16_to_cpu(ctrl->wValue),
|
||||
* le16_to_cpu(ctrl->wIndex), le16_to_cpu(ctrl->wLength));
|
||||
*/
|
||||
|
||||
if ((ctrl->bRequestType & USB_TYPE_MASK) != USB_TYPE_CLASS) {
|
||||
INFO(f->config->cdev, "invalid request type\n");
|
||||
uvcg_info(f, "invalid request type\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -272,7 +261,7 @@ uvc_function_get_alt(struct usb_function *f, unsigned interface)
|
|||
{
|
||||
struct uvc_device *uvc = to_uvc(f);
|
||||
|
||||
INFO(f->config->cdev, "uvc_function_get_alt(%u)\n", interface);
|
||||
uvcg_info(f, "%s(%u)\n", __func__, interface);
|
||||
|
||||
if (interface == uvc->control_intf)
|
||||
return 0;
|
||||
|
@ -291,13 +280,13 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt)
|
|||
struct uvc_event *uvc_event = (void *)&v4l2_event.u.data;
|
||||
int ret;
|
||||
|
||||
INFO(cdev, "uvc_function_set_alt(%u, %u)\n", interface, alt);
|
||||
uvcg_info(f, "%s(%u, %u)\n", __func__, interface, alt);
|
||||
|
||||
if (interface == uvc->control_intf) {
|
||||
if (alt)
|
||||
return -EINVAL;
|
||||
|
||||
INFO(cdev, "reset UVC Control\n");
|
||||
uvcg_info(f, "reset UVC Control\n");
|
||||
usb_ep_disable(uvc->control_ep);
|
||||
|
||||
if (!uvc->control_ep->desc)
|
||||
|
@ -348,7 +337,7 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt)
|
|||
if (!uvc->video.ep)
|
||||
return -EINVAL;
|
||||
|
||||
INFO(cdev, "reset UVC\n");
|
||||
uvcg_info(f, "reset UVC\n");
|
||||
usb_ep_disable(uvc->video.ep);
|
||||
|
||||
ret = config_ep_by_speed(f->config->cdev->gadget,
|
||||
|
@ -373,7 +362,7 @@ uvc_function_disable(struct usb_function *f)
|
|||
struct uvc_device *uvc = to_uvc(f);
|
||||
struct v4l2_event v4l2_event;
|
||||
|
||||
INFO(f->config->cdev, "uvc_function_disable\n");
|
||||
uvcg_info(f, "%s()\n", __func__);
|
||||
|
||||
memset(&v4l2_event, 0, sizeof(v4l2_event));
|
||||
v4l2_event.type = UVC_EVENT_DISCONNECT;
|
||||
|
@ -392,21 +381,19 @@ uvc_function_disable(struct usb_function *f)
|
|||
void
|
||||
uvc_function_connect(struct uvc_device *uvc)
|
||||
{
|
||||
struct usb_composite_dev *cdev = uvc->func.config->cdev;
|
||||
int ret;
|
||||
|
||||
if ((ret = usb_function_activate(&uvc->func)) < 0)
|
||||
INFO(cdev, "UVC connect failed with %d\n", ret);
|
||||
uvcg_info(&uvc->func, "UVC connect failed with %d\n", ret);
|
||||
}
|
||||
|
||||
void
|
||||
uvc_function_disconnect(struct uvc_device *uvc)
|
||||
{
|
||||
struct usb_composite_dev *cdev = uvc->func.config->cdev;
|
||||
int ret;
|
||||
|
||||
if ((ret = usb_function_deactivate(&uvc->func)) < 0)
|
||||
INFO(cdev, "UVC disconnect failed with %d\n", ret);
|
||||
uvcg_info(&uvc->func, "UVC disconnect failed with %d\n", ret);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
|
@ -605,7 +592,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
struct f_uvc_opts *opts;
|
||||
int ret = -EINVAL;
|
||||
|
||||
INFO(cdev, "uvc_function_bind\n");
|
||||
uvcg_info(f, "%s()\n", __func__);
|
||||
|
||||
opts = fi_to_f_uvc_opts(f->fi);
|
||||
/* Sanity check the streaming endpoint module parameters.
|
||||
|
@ -618,8 +605,8 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
if (opts->streaming_maxburst &&
|
||||
(opts->streaming_maxpacket % 1024) != 0) {
|
||||
opts->streaming_maxpacket = roundup(opts->streaming_maxpacket, 1024);
|
||||
INFO(cdev, "overriding streaming_maxpacket to %d\n",
|
||||
opts->streaming_maxpacket);
|
||||
uvcg_info(f, "overriding streaming_maxpacket to %d\n",
|
||||
opts->streaming_maxpacket);
|
||||
}
|
||||
|
||||
/* Fill in the FS/HS/SS Video Streaming specific descriptors from the
|
||||
|
@ -658,7 +645,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
/* Allocate endpoints. */
|
||||
ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
|
||||
if (!ep) {
|
||||
INFO(cdev, "Unable to allocate control EP\n");
|
||||
uvcg_info(f, "Unable to allocate control EP\n");
|
||||
goto error;
|
||||
}
|
||||
uvc->control_ep = ep;
|
||||
|
@ -672,7 +659,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
ep = usb_ep_autoconfig(cdev->gadget, &uvc_fs_streaming_ep);
|
||||
|
||||
if (!ep) {
|
||||
INFO(cdev, "Unable to allocate streaming EP\n");
|
||||
uvcg_info(f, "Unable to allocate streaming EP\n");
|
||||
goto error;
|
||||
}
|
||||
uvc->video.ep = ep;
|
||||
|
@ -699,12 +686,14 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
uvc_iad.bFirstInterface = ret;
|
||||
uvc_control_intf.bInterfaceNumber = ret;
|
||||
uvc->control_intf = ret;
|
||||
opts->control_interface = ret;
|
||||
|
||||
if ((ret = usb_interface_id(c, f)) < 0)
|
||||
goto error;
|
||||
uvc_streaming_intf_alt0.bInterfaceNumber = ret;
|
||||
uvc_streaming_intf_alt1.bInterfaceNumber = ret;
|
||||
uvc->streaming_intf = ret;
|
||||
opts->streaming_interface = ret;
|
||||
|
||||
/* Copy descriptors */
|
||||
f->fs_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_FULL);
|
||||
|
@ -743,19 +732,19 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
|
|||
uvc->control_req->context = uvc;
|
||||
|
||||
if (v4l2_device_register(&cdev->gadget->dev, &uvc->v4l2_dev)) {
|
||||
printk(KERN_INFO "v4l2_device_register failed\n");
|
||||
uvcg_err(f, "failed to register V4L2 device\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Initialise video. */
|
||||
ret = uvcg_video_init(&uvc->video);
|
||||
ret = uvcg_video_init(&uvc->video, uvc);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
|
||||
/* Register a V4L2 device. */
|
||||
ret = uvc_register_video(uvc);
|
||||
if (ret < 0) {
|
||||
printk(KERN_INFO "Unable to register video device\n");
|
||||
uvcg_err(f, "failed to register video device\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -792,6 +781,7 @@ static struct usb_function_instance *uvc_alloc_inst(void)
|
|||
struct uvc_output_terminal_descriptor *od;
|
||||
struct uvc_color_matching_descriptor *md;
|
||||
struct uvc_descriptor_header **ctl_cls;
|
||||
int ret;
|
||||
|
||||
opts = kzalloc(sizeof(*opts), GFP_KERNEL);
|
||||
if (!opts)
|
||||
|
@ -868,7 +858,12 @@ static struct usb_function_instance *uvc_alloc_inst(void)
|
|||
opts->streaming_interval = 1;
|
||||
opts->streaming_maxpacket = 1024;
|
||||
|
||||
uvcg_attach_configfs(opts);
|
||||
ret = uvcg_attach_configfs(opts);
|
||||
if (ret < 0) {
|
||||
kfree(opts);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return &opts->func_inst;
|
||||
}
|
||||
|
||||
|
@ -886,7 +881,7 @@ static void uvc_unbind(struct usb_configuration *c, struct usb_function *f)
|
|||
struct usb_composite_dev *cdev = c->cdev;
|
||||
struct uvc_device *uvc = to_uvc(f);
|
||||
|
||||
INFO(cdev, "%s\n", __func__);
|
||||
uvcg_info(f, "%s\n", __func__);
|
||||
|
||||
device_remove_file(&uvc->vdev.dev, &dev_attr_function_name);
|
||||
video_unregister_device(&uvc->vdev);
|
||||
|
|
|
@ -25,6 +25,9 @@ struct f_uvc_opts {
|
|||
unsigned int streaming_maxpacket;
|
||||
unsigned int streaming_maxburst;
|
||||
|
||||
unsigned int control_interface;
|
||||
unsigned int streaming_interface;
|
||||
|
||||
/*
|
||||
* Control descriptors array pointers for full-/high-speed and
|
||||
* super-speed. They point by default to the uvc_fs_control_cls and
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
struct usb_ep;
|
||||
struct usb_request;
|
||||
struct uvc_descriptor_header;
|
||||
struct uvc_device;
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
* Debugging, printing and logging
|
||||
|
@ -51,14 +52,12 @@ extern unsigned int uvc_gadget_trace_param;
|
|||
printk(KERN_DEBUG "uvcvideo: " msg); \
|
||||
} while (0)
|
||||
|
||||
#define uvc_warn_once(dev, warn, msg...) \
|
||||
do { \
|
||||
if (!test_and_set_bit(warn, &dev->warnings)) \
|
||||
printk(KERN_INFO "uvcvideo: " msg); \
|
||||
} while (0)
|
||||
|
||||
#define uvc_printk(level, msg...) \
|
||||
printk(level "uvcvideo: " msg)
|
||||
#define uvcg_dbg(f, fmt, args...) \
|
||||
dev_dbg(&(f)->config->cdev->gadget->dev, "%s: " fmt, (f)->name, ##args)
|
||||
#define uvcg_info(f, fmt, args...) \
|
||||
dev_info(&(f)->config->cdev->gadget->dev, "%s: " fmt, (f)->name, ##args)
|
||||
#define uvcg_err(f, fmt, args...) \
|
||||
dev_err(&(f)->config->cdev->gadget->dev, "%s: " fmt, (f)->name, ##args)
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
* Driver specific constants
|
||||
|
@ -73,6 +72,7 @@ extern unsigned int uvc_gadget_trace_param;
|
|||
*/
|
||||
|
||||
struct uvc_video {
|
||||
struct uvc_device *uvc;
|
||||
struct usb_ep *ep;
|
||||
|
||||
/* Frame parameters */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -115,8 +115,8 @@ uvc_v4l2_set_format(struct file *file, void *fh, struct v4l2_format *fmt)
|
|||
}
|
||||
|
||||
if (i == ARRAY_SIZE(uvc_formats)) {
|
||||
printk(KERN_INFO "Unsupported format 0x%08x.\n",
|
||||
fmt->fmt.pix.pixelformat);
|
||||
uvcg_info(&uvc->func, "Unsupported format 0x%08x.\n",
|
||||
fmt->fmt.pix.pixelformat);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,23 @@ uvc_video_encode_isoc(struct usb_request *req, struct uvc_video *video,
|
|||
* Request handling
|
||||
*/
|
||||
|
||||
static int uvcg_video_ep_queue(struct uvc_video *video, struct usb_request *req)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = usb_ep_queue(video->ep, req, GFP_ATOMIC);
|
||||
if (ret < 0) {
|
||||
uvcg_err(&video->uvc->func, "Failed to queue request (%d).\n",
|
||||
ret);
|
||||
|
||||
/* Isochronous endpoints can't be halted. */
|
||||
if (usb_endpoint_xfer_bulk(video->ep->desc))
|
||||
usb_ep_set_halt(video->ep);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* I somehow feel that synchronisation won't be easy to achieve here. We have
|
||||
* three events that control USB requests submission:
|
||||
|
@ -169,13 +186,14 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)
|
|||
break;
|
||||
|
||||
case -ESHUTDOWN: /* disconnect from host. */
|
||||
printk(KERN_DEBUG "VS request cancelled.\n");
|
||||
uvcg_dbg(&video->uvc->func, "VS request cancelled.\n");
|
||||
uvcg_queue_cancel(queue, 1);
|
||||
goto requeue;
|
||||
|
||||
default:
|
||||
printk(KERN_INFO "VS request completed with status %d.\n",
|
||||
req->status);
|
||||
uvcg_info(&video->uvc->func,
|
||||
"VS request completed with status %d.\n",
|
||||
req->status);
|
||||
uvcg_queue_cancel(queue, 0);
|
||||
goto requeue;
|
||||
}
|
||||
|
@ -189,14 +207,13 @@ uvc_video_complete(struct usb_ep *ep, struct usb_request *req)
|
|||
|
||||
video->encode(req, video, buf);
|
||||
|
||||
if ((ret = usb_ep_queue(ep, req, GFP_ATOMIC)) < 0) {
|
||||
printk(KERN_INFO "Failed to queue request (%d).\n", ret);
|
||||
usb_ep_set_halt(ep);
|
||||
spin_unlock_irqrestore(&video->queue.irqlock, flags);
|
||||
ret = uvcg_video_ep_queue(video, req);
|
||||
spin_unlock_irqrestore(&video->queue.irqlock, flags);
|
||||
|
||||
if (ret < 0) {
|
||||
uvcg_queue_cancel(queue, 0);
|
||||
goto requeue;
|
||||
}
|
||||
spin_unlock_irqrestore(&video->queue.irqlock, flags);
|
||||
|
||||
return;
|
||||
|
||||
|
@ -316,15 +333,13 @@ int uvcg_video_pump(struct uvc_video *video)
|
|||
video->encode(req, video, buf);
|
||||
|
||||
/* Queue the USB request */
|
||||
ret = usb_ep_queue(video->ep, req, GFP_ATOMIC);
|
||||
ret = uvcg_video_ep_queue(video, req);
|
||||
spin_unlock_irqrestore(&queue->irqlock, flags);
|
||||
|
||||
if (ret < 0) {
|
||||
printk(KERN_INFO "Failed to queue request (%d)\n", ret);
|
||||
usb_ep_set_halt(video->ep);
|
||||
spin_unlock_irqrestore(&queue->irqlock, flags);
|
||||
uvcg_queue_cancel(queue, 0);
|
||||
break;
|
||||
}
|
||||
spin_unlock_irqrestore(&queue->irqlock, flags);
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&video->req_lock, flags);
|
||||
|
@ -342,8 +357,8 @@ int uvcg_video_enable(struct uvc_video *video, int enable)
|
|||
int ret;
|
||||
|
||||
if (video->ep == NULL) {
|
||||
printk(KERN_INFO "Video enable failed, device is "
|
||||
"uninitialized.\n");
|
||||
uvcg_info(&video->uvc->func,
|
||||
"Video enable failed, device is uninitialized.\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
@ -375,11 +390,12 @@ int uvcg_video_enable(struct uvc_video *video, int enable)
|
|||
/*
|
||||
* Initialize the UVC video stream.
|
||||
*/
|
||||
int uvcg_video_init(struct uvc_video *video)
|
||||
int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc)
|
||||
{
|
||||
INIT_LIST_HEAD(&video->req_free);
|
||||
spin_lock_init(&video->req_lock);
|
||||
|
||||
video->uvc = uvc;
|
||||
video->fcc = V4L2_PIX_FMT_YUYV;
|
||||
video->bpp = 16;
|
||||
video->width = 320;
|
||||
|
|
|
@ -18,6 +18,6 @@ int uvcg_video_pump(struct uvc_video *video);
|
|||
|
||||
int uvcg_video_enable(struct uvc_video *video, int enable);
|
||||
|
||||
int uvcg_video_init(struct uvc_video *video);
|
||||
int uvcg_video_init(struct uvc_video *video, struct uvc_device *uvc);
|
||||
|
||||
#endif /* __UVC_VIDEO_H__ */
|
||||
|
|
|
@ -192,14 +192,14 @@ struct uvc_descriptor_header {
|
|||
|
||||
/* 3.7.2. Video Control Interface Header Descriptor */
|
||||
struct uvc_header_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u16 bcdUVC;
|
||||
__u16 wTotalLength;
|
||||
__u32 dwClockFrequency;
|
||||
__u8 bInCollection;
|
||||
__u8 baInterfaceNr[];
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__le16 bcdUVC;
|
||||
__le16 wTotalLength;
|
||||
__le32 dwClockFrequency;
|
||||
__u8 bInCollection;
|
||||
__u8 baInterfaceNr[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_HEADER_SIZE(n) (12+(n))
|
||||
|
@ -209,57 +209,57 @@ struct uvc_header_descriptor {
|
|||
|
||||
#define DECLARE_UVC_HEADER_DESCRIPTOR(n) \
|
||||
struct UVC_HEADER_DESCRIPTOR(n) { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u16 bcdUVC; \
|
||||
__u16 wTotalLength; \
|
||||
__u32 dwClockFrequency; \
|
||||
__u8 bInCollection; \
|
||||
__u8 baInterfaceNr[n]; \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__le16 bcdUVC; \
|
||||
__le16 wTotalLength; \
|
||||
__le32 dwClockFrequency; \
|
||||
__u8 bInCollection; \
|
||||
__u8 baInterfaceNr[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
/* 3.7.2.1. Input Terminal Descriptor */
|
||||
struct uvc_input_terminal_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__u16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 iTerminal;
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__le16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 iTerminal;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_INPUT_TERMINAL_SIZE 8
|
||||
|
||||
/* 3.7.2.2. Output Terminal Descriptor */
|
||||
struct uvc_output_terminal_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__u16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 bSourceID;
|
||||
__u8 iTerminal;
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__le16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 bSourceID;
|
||||
__u8 iTerminal;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_OUTPUT_TERMINAL_SIZE 9
|
||||
|
||||
/* 3.7.2.3. Camera Terminal Descriptor */
|
||||
struct uvc_camera_terminal_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__u16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 iTerminal;
|
||||
__u16 wObjectiveFocalLengthMin;
|
||||
__u16 wObjectiveFocalLengthMax;
|
||||
__u16 wOcularFocalLength;
|
||||
__u8 bControlSize;
|
||||
__u8 bmControls[3];
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bTerminalID;
|
||||
__le16 wTerminalType;
|
||||
__u8 bAssocTerminal;
|
||||
__u8 iTerminal;
|
||||
__le16 wObjectiveFocalLengthMin;
|
||||
__le16 wObjectiveFocalLengthMax;
|
||||
__le16 wOcularFocalLength;
|
||||
__u8 bControlSize;
|
||||
__u8 bmControls[3];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_CAMERA_TERMINAL_SIZE(n) (15+(n))
|
||||
|
@ -293,15 +293,15 @@ struct UVC_SELECTOR_UNIT_DESCRIPTOR(n) { \
|
|||
|
||||
/* 3.7.2.5. Processing Unit Descriptor */
|
||||
struct uvc_processing_unit_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bUnitID;
|
||||
__u8 bSourceID;
|
||||
__u16 wMaxMultiplier;
|
||||
__u8 bControlSize;
|
||||
__u8 bmControls[2];
|
||||
__u8 iProcessing;
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bUnitID;
|
||||
__u8 bSourceID;
|
||||
__le16 wMaxMultiplier;
|
||||
__u8 bControlSize;
|
||||
__u8 bmControls[2];
|
||||
__u8 iProcessing;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_PROCESSING_UNIT_SIZE(n) (9+(n))
|
||||
|
@ -343,29 +343,29 @@ struct UVC_EXTENSION_UNIT_DESCRIPTOR(p, n) { \
|
|||
|
||||
/* 3.8.2.2. Video Control Interrupt Endpoint Descriptor */
|
||||
struct uvc_control_endpoint_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u16 wMaxTransferSize;
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__le16 wMaxTransferSize;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_CONTROL_ENDPOINT_SIZE 5
|
||||
|
||||
/* 3.9.2.1. Input Header Descriptor */
|
||||
struct uvc_input_header_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bNumFormats;
|
||||
__u16 wTotalLength;
|
||||
__u8 bEndpointAddress;
|
||||
__u8 bmInfo;
|
||||
__u8 bTerminalLink;
|
||||
__u8 bStillCaptureMethod;
|
||||
__u8 bTriggerSupport;
|
||||
__u8 bTriggerUsage;
|
||||
__u8 bControlSize;
|
||||
__u8 bmaControls[];
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bNumFormats;
|
||||
__le16 wTotalLength;
|
||||
__u8 bEndpointAddress;
|
||||
__u8 bmInfo;
|
||||
__u8 bTerminalLink;
|
||||
__u8 bStillCaptureMethod;
|
||||
__u8 bTriggerSupport;
|
||||
__u8 bTriggerUsage;
|
||||
__u8 bControlSize;
|
||||
__u8 bmaControls[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_INPUT_HEADER_SIZE(n, p) (13+(n*p))
|
||||
|
@ -375,32 +375,32 @@ struct uvc_input_header_descriptor {
|
|||
|
||||
#define DECLARE_UVC_INPUT_HEADER_DESCRIPTOR(n, p) \
|
||||
struct UVC_INPUT_HEADER_DESCRIPTOR(n, p) { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bNumFormats; \
|
||||
__u16 wTotalLength; \
|
||||
__u8 bEndpointAddress; \
|
||||
__u8 bmInfo; \
|
||||
__u8 bTerminalLink; \
|
||||
__u8 bStillCaptureMethod; \
|
||||
__u8 bTriggerSupport; \
|
||||
__u8 bTriggerUsage; \
|
||||
__u8 bControlSize; \
|
||||
__u8 bmaControls[p][n]; \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bNumFormats; \
|
||||
__le16 wTotalLength; \
|
||||
__u8 bEndpointAddress; \
|
||||
__u8 bmInfo; \
|
||||
__u8 bTerminalLink; \
|
||||
__u8 bStillCaptureMethod; \
|
||||
__u8 bTriggerSupport; \
|
||||
__u8 bTriggerUsage; \
|
||||
__u8 bControlSize; \
|
||||
__u8 bmaControls[p][n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
/* 3.9.2.2. Output Header Descriptor */
|
||||
struct uvc_output_header_descriptor {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bNumFormats;
|
||||
__u16 wTotalLength;
|
||||
__u8 bEndpointAddress;
|
||||
__u8 bTerminalLink;
|
||||
__u8 bControlSize;
|
||||
__u8 bmaControls[];
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bNumFormats;
|
||||
__le16 wTotalLength;
|
||||
__u8 bEndpointAddress;
|
||||
__u8 bTerminalLink;
|
||||
__u8 bControlSize;
|
||||
__u8 bmaControls[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_OUTPUT_HEADER_SIZE(n, p) (9+(n*p))
|
||||
|
@ -410,15 +410,15 @@ struct uvc_output_header_descriptor {
|
|||
|
||||
#define DECLARE_UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) \
|
||||
struct UVC_OUTPUT_HEADER_DESCRIPTOR(n, p) { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bNumFormats; \
|
||||
__u16 wTotalLength; \
|
||||
__u8 bEndpointAddress; \
|
||||
__u8 bTerminalLink; \
|
||||
__u8 bControlSize; \
|
||||
__u8 bmaControls[p][n]; \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bNumFormats; \
|
||||
__le16 wTotalLength; \
|
||||
__u8 bEndpointAddress; \
|
||||
__u8 bTerminalLink; \
|
||||
__u8 bControlSize; \
|
||||
__u8 bmaControls[p][n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
/* 3.9.2.6. Color matching descriptor */
|
||||
|
@ -473,19 +473,19 @@ struct uvc_format_uncompressed {
|
|||
|
||||
/* Uncompressed Payload - 3.1.2. Uncompressed Video Frame Descriptor */
|
||||
struct uvc_frame_uncompressed {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bFrameIndex;
|
||||
__u8 bmCapabilities;
|
||||
__u16 wWidth;
|
||||
__u16 wHeight;
|
||||
__u32 dwMinBitRate;
|
||||
__u32 dwMaxBitRate;
|
||||
__u32 dwMaxVideoFrameBufferSize;
|
||||
__u32 dwDefaultFrameInterval;
|
||||
__u8 bFrameIntervalType;
|
||||
__u32 dwFrameInterval[];
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bFrameIndex;
|
||||
__u8 bmCapabilities;
|
||||
__le16 wWidth;
|
||||
__le16 wHeight;
|
||||
__le32 dwMinBitRate;
|
||||
__le32 dwMaxBitRate;
|
||||
__le32 dwMaxVideoFrameBufferSize;
|
||||
__le32 dwDefaultFrameInterval;
|
||||
__u8 bFrameIntervalType;
|
||||
__le32 dwFrameInterval[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_FRAME_UNCOMPRESSED_SIZE(n) (26+4*(n))
|
||||
|
@ -495,19 +495,19 @@ struct uvc_frame_uncompressed {
|
|||
|
||||
#define DECLARE_UVC_FRAME_UNCOMPRESSED(n) \
|
||||
struct UVC_FRAME_UNCOMPRESSED(n) { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bFrameIndex; \
|
||||
__u8 bmCapabilities; \
|
||||
__u16 wWidth; \
|
||||
__u16 wHeight; \
|
||||
__u32 dwMinBitRate; \
|
||||
__u32 dwMaxBitRate; \
|
||||
__u32 dwMaxVideoFrameBufferSize; \
|
||||
__u32 dwDefaultFrameInterval; \
|
||||
__u8 bFrameIntervalType; \
|
||||
__u32 dwFrameInterval[n]; \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bFrameIndex; \
|
||||
__u8 bmCapabilities; \
|
||||
__le16 wWidth; \
|
||||
__le16 wHeight; \
|
||||
__le32 dwMinBitRate; \
|
||||
__le32 dwMaxBitRate; \
|
||||
__le32 dwMaxVideoFrameBufferSize; \
|
||||
__le32 dwDefaultFrameInterval; \
|
||||
__u8 bFrameIntervalType; \
|
||||
__le32 dwFrameInterval[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
/* MJPEG Payload - 3.1.1. MJPEG Video Format Descriptor */
|
||||
|
@ -529,19 +529,19 @@ struct uvc_format_mjpeg {
|
|||
|
||||
/* MJPEG Payload - 3.1.2. MJPEG Video Frame Descriptor */
|
||||
struct uvc_frame_mjpeg {
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bFrameIndex;
|
||||
__u8 bmCapabilities;
|
||||
__u16 wWidth;
|
||||
__u16 wHeight;
|
||||
__u32 dwMinBitRate;
|
||||
__u32 dwMaxBitRate;
|
||||
__u32 dwMaxVideoFrameBufferSize;
|
||||
__u32 dwDefaultFrameInterval;
|
||||
__u8 bFrameIntervalType;
|
||||
__u32 dwFrameInterval[];
|
||||
__u8 bLength;
|
||||
__u8 bDescriptorType;
|
||||
__u8 bDescriptorSubType;
|
||||
__u8 bFrameIndex;
|
||||
__u8 bmCapabilities;
|
||||
__le16 wWidth;
|
||||
__le16 wHeight;
|
||||
__le32 dwMinBitRate;
|
||||
__le32 dwMaxBitRate;
|
||||
__le32 dwMaxVideoFrameBufferSize;
|
||||
__le32 dwDefaultFrameInterval;
|
||||
__u8 bFrameIntervalType;
|
||||
__le32 dwFrameInterval[];
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#define UVC_DT_FRAME_MJPEG_SIZE(n) (26+4*(n))
|
||||
|
@ -551,19 +551,19 @@ struct uvc_frame_mjpeg {
|
|||
|
||||
#define DECLARE_UVC_FRAME_MJPEG(n) \
|
||||
struct UVC_FRAME_MJPEG(n) { \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bFrameIndex; \
|
||||
__u8 bmCapabilities; \
|
||||
__u16 wWidth; \
|
||||
__u16 wHeight; \
|
||||
__u32 dwMinBitRate; \
|
||||
__u32 dwMaxBitRate; \
|
||||
__u32 dwMaxVideoFrameBufferSize; \
|
||||
__u32 dwDefaultFrameInterval; \
|
||||
__u8 bFrameIntervalType; \
|
||||
__u32 dwFrameInterval[n]; \
|
||||
__u8 bLength; \
|
||||
__u8 bDescriptorType; \
|
||||
__u8 bDescriptorSubType; \
|
||||
__u8 bFrameIndex; \
|
||||
__u8 bmCapabilities; \
|
||||
__le16 wWidth; \
|
||||
__le16 wHeight; \
|
||||
__le32 dwMinBitRate; \
|
||||
__le32 dwMaxBitRate; \
|
||||
__le32 dwMaxVideoFrameBufferSize; \
|
||||
__le32 dwDefaultFrameInterval; \
|
||||
__u8 bFrameIntervalType; \
|
||||
__le32 dwFrameInterval[n]; \
|
||||
} __attribute__ ((packed))
|
||||
|
||||
#endif /* __LINUX_USB_VIDEO_H */
|
||||
|
|
Loading…
Reference in New Issue