mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
media: uvcvideo: Fix comment blocks style
The uvcvideo driver historically uses the /* Comment * style */ for multi-line block comments, which is frowned upon. Patches for the driver are required to use the more standard /* * Comment * style */ style. This result in inconsistencies. Fix it by converting all remaining instances of the old style. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
edbb6e251e
commit
699b9a86a3
8 changed files with 156 additions and 82 deletions
|
@ -749,7 +749,8 @@ static inline void uvc_clear_bit(u8 *data, int bit)
|
||||||
data[bit >> 3] &= ~(1 << (bit & 7));
|
data[bit >> 3] &= ~(1 << (bit & 7));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Extract the bit string specified by mapping->offset and mapping->size
|
/*
|
||||||
|
* Extract the bit string specified by mapping->offset and mapping->size
|
||||||
* from the little-endian data stored at 'data' and return the result as
|
* from the little-endian data stored at 'data' and return the result as
|
||||||
* a signed 32bit integer. Sign extension will be performed if the mapping
|
* a signed 32bit integer. Sign extension will be performed if the mapping
|
||||||
* references a signed data type.
|
* references a signed data type.
|
||||||
|
@ -785,7 +786,8 @@ static s32 uvc_get_le_value(struct uvc_control_mapping *mapping,
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the bit string specified by mapping->offset and mapping->size
|
/*
|
||||||
|
* Set the bit string specified by mapping->offset and mapping->size
|
||||||
* in the little-endian data stored at 'data' to the value 'value'.
|
* in the little-endian data stored at 'data' to the value 'value'.
|
||||||
*/
|
*/
|
||||||
static void uvc_set_le_value(struct uvc_control_mapping *mapping,
|
static void uvc_set_le_value(struct uvc_control_mapping *mapping,
|
||||||
|
@ -795,7 +797,8 @@ static void uvc_set_le_value(struct uvc_control_mapping *mapping,
|
||||||
int offset = mapping->offset;
|
int offset = mapping->offset;
|
||||||
u8 mask;
|
u8 mask;
|
||||||
|
|
||||||
/* According to the v4l2 spec, writing any value to a button control
|
/*
|
||||||
|
* According to the v4l2 spec, writing any value to a button control
|
||||||
* should result in the action belonging to the button control being
|
* should result in the action belonging to the button control being
|
||||||
* triggered. UVC devices however want to see a 1 written -> override
|
* triggered. UVC devices however want to see a 1 written -> override
|
||||||
* value.
|
* value.
|
||||||
|
@ -927,7 +930,8 @@ static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain,
|
||||||
UVC_VC_EXTENSION_UNIT)
|
UVC_VC_EXTENSION_UNIT)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* GET_RES is mandatory for XU controls, but some
|
/*
|
||||||
|
* GET_RES is mandatory for XU controls, but some
|
||||||
* cameras still choke on it. Ignore errors and set the
|
* cameras still choke on it. Ignore errors and set the
|
||||||
* resolution value to zero.
|
* resolution value to zero.
|
||||||
*/
|
*/
|
||||||
|
@ -1522,8 +1526,10 @@ static int uvc_ctrl_add_event(struct v4l2_subscribed_event *sev, unsigned elems)
|
||||||
|
|
||||||
uvc_ctrl_fill_event(handle->chain, &ev, ctrl, mapping, val,
|
uvc_ctrl_fill_event(handle->chain, &ev, ctrl, mapping, val,
|
||||||
changes);
|
changes);
|
||||||
/* Mark the queue as active, allowing this initial
|
/*
|
||||||
event to be accepted. */
|
* Mark the queue as active, allowing this initial event to be
|
||||||
|
* accepted.
|
||||||
|
*/
|
||||||
sev->elems = elems;
|
sev->elems = elems;
|
||||||
v4l2_event_queue_fh(sev->fh, &ev);
|
v4l2_event_queue_fh(sev->fh, &ev);
|
||||||
}
|
}
|
||||||
|
@ -1596,7 +1602,8 @@ static int uvc_ctrl_commit_entity(struct uvc_device *dev,
|
||||||
if (!ctrl->initialized)
|
if (!ctrl->initialized)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Reset the loaded flag for auto-update controls that were
|
/*
|
||||||
|
* Reset the loaded flag for auto-update controls that were
|
||||||
* marked as loaded in uvc_ctrl_get/uvc_ctrl_set to prevent
|
* marked as loaded in uvc_ctrl_get/uvc_ctrl_set to prevent
|
||||||
* uvc_ctrl_get from using the cached value, and for write-only
|
* uvc_ctrl_get from using the cached value, and for write-only
|
||||||
* controls to prevent uvc_ctrl_set from setting bits not
|
* controls to prevent uvc_ctrl_set from setting bits not
|
||||||
|
@ -1755,7 +1762,8 @@ int uvc_ctrl_set(struct uvc_fh *handle,
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
value = mapping->menu_info[xctrl->value].value;
|
value = mapping->menu_info[xctrl->value].value;
|
||||||
|
|
||||||
/* Valid menu indices are reported by the GET_RES request for
|
/*
|
||||||
|
* Valid menu indices are reported by the GET_RES request for
|
||||||
* UVC controls that support it.
|
* UVC controls that support it.
|
||||||
*/
|
*/
|
||||||
if (mapping->data_type == UVC_CTRL_DATA_TYPE_BITMASK &&
|
if (mapping->data_type == UVC_CTRL_DATA_TYPE_BITMASK &&
|
||||||
|
@ -1779,7 +1787,8 @@ int uvc_ctrl_set(struct uvc_fh *handle,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the mapping doesn't span the whole UVC control, the current value
|
/*
|
||||||
|
* If the mapping doesn't span the whole UVC control, the current value
|
||||||
* needs to be loaded from the device to perform the read-modify-write
|
* needs to be loaded from the device to perform the read-modify-write
|
||||||
* operation.
|
* operation.
|
||||||
*/
|
*/
|
||||||
|
@ -2180,7 +2189,8 @@ static int __uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
/* Most mappings come from static kernel data and need to be duplicated.
|
/*
|
||||||
|
* Most mappings come from static kernel data and need to be duplicated.
|
||||||
* Mappings that come from userspace will be unnecessarily duplicated,
|
* Mappings that come from userspace will be unnecessarily duplicated,
|
||||||
* this could be optimized.
|
* this could be optimized.
|
||||||
*/
|
*/
|
||||||
|
@ -2389,7 +2399,8 @@ static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain,
|
||||||
const struct uvc_control_mapping *mend =
|
const struct uvc_control_mapping *mend =
|
||||||
mapping + ARRAY_SIZE(uvc_ctrl_mappings);
|
mapping + ARRAY_SIZE(uvc_ctrl_mappings);
|
||||||
|
|
||||||
/* XU controls initialization requires querying the device for control
|
/*
|
||||||
|
* XU controls initialization requires querying the device for control
|
||||||
* information. As some buggy UVC devices will crash when queried
|
* information. As some buggy UVC devices will crash when queried
|
||||||
* repeatedly in a tight loop, delay XU controls initialization until
|
* repeatedly in a tight loop, delay XU controls initialization until
|
||||||
* first use.
|
* first use.
|
||||||
|
|
|
@ -329,7 +329,8 @@ static enum v4l2_ycbcr_encoding uvc_ycbcr_enc(const u8 matrix_coefficients)
|
||||||
return V4L2_YCBCR_ENC_DEFAULT; /* Reserved */
|
return V4L2_YCBCR_ENC_DEFAULT; /* Reserved */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simplify a fraction using a simple continued fraction decomposition. The
|
/*
|
||||||
|
* Simplify a fraction using a simple continued fraction decomposition. The
|
||||||
* idea here is to convert fractions such as 333333/10000000 to 1/30 using
|
* idea here is to convert fractions such as 333333/10000000 to 1/30 using
|
||||||
* 32 bit arithmetic only. The algorithm is not perfect and relies upon two
|
* 32 bit arithmetic only. The algorithm is not perfect and relies upon two
|
||||||
* arbitrary parameters to remove non-significative terms from the simple
|
* arbitrary parameters to remove non-significative terms from the simple
|
||||||
|
@ -347,7 +348,8 @@ void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
|
||||||
if (an == NULL)
|
if (an == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Convert the fraction to a simple continued fraction. See
|
/*
|
||||||
|
* Convert the fraction to a simple continued fraction. See
|
||||||
* https://mathforum.org/dr.math/faq/faq.fractions.html
|
* https://mathforum.org/dr.math/faq/faq.fractions.html
|
||||||
* Stop if the current term is bigger than or equal to the given
|
* Stop if the current term is bigger than or equal to the given
|
||||||
* threshold.
|
* threshold.
|
||||||
|
@ -383,7 +385,8 @@ void uvc_simplify_fraction(u32 *numerator, u32 *denominator,
|
||||||
kfree(an);
|
kfree(an);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert a fraction to a frame interval in 100ns multiples. The idea here is
|
/*
|
||||||
|
* Convert a fraction to a frame interval in 100ns multiples. The idea here is
|
||||||
* to compute numerator / denominator * 10000000 using 32 bit fixed point
|
* to compute numerator / denominator * 10000000 using 32 bit fixed point
|
||||||
* arithmetic only.
|
* arithmetic only.
|
||||||
*/
|
*/
|
||||||
|
@ -396,7 +399,8 @@ u32 uvc_fraction_to_interval(u32 numerator, u32 denominator)
|
||||||
numerator/denominator >= ((u32)-1)/10000000)
|
numerator/denominator >= ((u32)-1)/10000000)
|
||||||
return (u32)-1;
|
return (u32)-1;
|
||||||
|
|
||||||
/* Divide both the denominator and the multiplier by two until
|
/*
|
||||||
|
* Divide both the denominator and the multiplier by two until
|
||||||
* numerator * multiplier doesn't overflow. If anyone knows a better
|
* numerator * multiplier doesn't overflow. If anyone knows a better
|
||||||
* algorithm please let me know.
|
* algorithm please let me know.
|
||||||
*/
|
*/
|
||||||
|
@ -548,7 +552,8 @@ 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
|
/*
|
||||||
|
* Some devices report a format that doesn't match what they
|
||||||
* really send.
|
* really send.
|
||||||
*/
|
*/
|
||||||
if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
|
if (dev->quirks & UVC_QUIRK_FORCE_Y8) {
|
||||||
|
@ -663,7 +668,8 @@ static int uvc_parse_format(struct uvc_device *dev,
|
||||||
buflen -= buffer[0];
|
buflen -= buffer[0];
|
||||||
buffer += buffer[0];
|
buffer += buffer[0];
|
||||||
|
|
||||||
/* Parse the frame descriptors. Only uncompressed, MJPEG and frame
|
/*
|
||||||
|
* Parse the frame descriptors. Only uncompressed, MJPEG and frame
|
||||||
* based formats have frame descriptors.
|
* based formats have frame descriptors.
|
||||||
*/
|
*/
|
||||||
while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
|
while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE &&
|
||||||
|
@ -705,7 +711,8 @@ static int uvc_parse_format(struct uvc_device *dev,
|
||||||
}
|
}
|
||||||
frame->dwFrameInterval = *intervals;
|
frame->dwFrameInterval = *intervals;
|
||||||
|
|
||||||
/* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
|
/*
|
||||||
|
* Several UVC chipsets screw up dwMaxVideoFrameBufferSize
|
||||||
* completely. Observed behaviours range from setting the
|
* completely. Observed behaviours range from setting the
|
||||||
* value to 1.1x the actual frame size to hardwiring the
|
* value to 1.1x the actual frame size to hardwiring the
|
||||||
* 16 low bits to 0. This results in a higher than necessary
|
* 16 low bits to 0. This results in a higher than necessary
|
||||||
|
@ -717,7 +724,8 @@ static int uvc_parse_format(struct uvc_device *dev,
|
||||||
frame->dwMaxVideoFrameBufferSize = format->bpp
|
frame->dwMaxVideoFrameBufferSize = format->bpp
|
||||||
* frame->wWidth * frame->wHeight / 8;
|
* frame->wWidth * frame->wHeight / 8;
|
||||||
|
|
||||||
/* Some bogus devices report dwMinFrameInterval equal to
|
/*
|
||||||
|
* Some bogus devices report dwMinFrameInterval equal to
|
||||||
* dwMaxFrameInterval and have dwFrameIntervalStep set to
|
* dwMaxFrameInterval and have dwFrameIntervalStep set to
|
||||||
* zero. Setting all null intervals to 1 fixes the problem and
|
* zero. Setting all null intervals to 1 fixes the problem and
|
||||||
* some other divisions by zero that could happen.
|
* some other divisions by zero that could happen.
|
||||||
|
@ -727,7 +735,8 @@ static int uvc_parse_format(struct uvc_device *dev,
|
||||||
*(*intervals)++ = interval ? interval : 1;
|
*(*intervals)++ = interval ? interval : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the default frame interval stays between
|
/*
|
||||||
|
* Make sure that the default frame interval stays between
|
||||||
* the boundaries.
|
* the boundaries.
|
||||||
*/
|
*/
|
||||||
n -= frame->bFrameIntervalType ? 1 : 2;
|
n -= frame->bFrameIntervalType ? 1 : 2;
|
||||||
|
@ -819,7 +828,8 @@ static int uvc_parse_streaming(struct uvc_device *dev,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The Pico iMage webcam has its class-specific interface descriptors
|
/*
|
||||||
|
* The Pico iMage webcam has its class-specific interface descriptors
|
||||||
* after the endpoint descriptors.
|
* after the endpoint descriptors.
|
||||||
*/
|
*/
|
||||||
if (buflen == 0) {
|
if (buflen == 0) {
|
||||||
|
@ -918,7 +928,8 @@ static int uvc_parse_streaming(struct uvc_device *dev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UVC_VS_FORMAT_DV:
|
case UVC_VS_FORMAT_DV:
|
||||||
/* DV format has no frame descriptor. We will create a
|
/*
|
||||||
|
* DV format has no frame descriptor. We will create a
|
||||||
* dummy frame descriptor with a dummy frame interval.
|
* dummy frame descriptor with a dummy frame interval.
|
||||||
*/
|
*/
|
||||||
nformats++;
|
nformats++;
|
||||||
|
@ -1105,7 +1116,8 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
|
||||||
if (buffer[1] != 0x41 || buffer[2] != 0x01)
|
if (buffer[1] != 0x41 || buffer[2] != 0x01)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Logitech implements several vendor specific functions
|
/*
|
||||||
|
* Logitech implements several vendor specific functions
|
||||||
* through vendor specific extension units (LXU).
|
* through vendor specific extension units (LXU).
|
||||||
*
|
*
|
||||||
* The LXU descriptors are similar to XU descriptors
|
* The LXU descriptors are similar to XU descriptors
|
||||||
|
@ -1303,7 +1315,8 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the terminal type MSB is not null, otherwise it
|
/*
|
||||||
|
* Make sure the terminal type MSB is not null, otherwise it
|
||||||
* could be confused with a unit.
|
* could be confused with a unit.
|
||||||
*/
|
*/
|
||||||
type = get_unaligned_le16(&buffer[4]);
|
type = get_unaligned_le16(&buffer[4]);
|
||||||
|
@ -1437,7 +1450,8 @@ static int uvc_parse_control(struct uvc_device *dev)
|
||||||
int buflen = alts->extralen;
|
int buflen = alts->extralen;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Parse the default alternate setting only, as the UVC specification
|
/*
|
||||||
|
* Parse the default alternate setting only, as the UVC specification
|
||||||
* defines a single alternate setting, the default alternate setting
|
* defines a single alternate setting, the default alternate setting
|
||||||
* zero.
|
* zero.
|
||||||
*/
|
*/
|
||||||
|
@ -1455,7 +1469,8 @@ static int uvc_parse_control(struct uvc_device *dev)
|
||||||
buffer += buffer[0];
|
buffer += buffer[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the optional status endpoint is present. Built-in iSight
|
/*
|
||||||
|
* Check if the optional status endpoint is present. Built-in iSight
|
||||||
* webcams have an interrupt endpoint but spit proprietary data that
|
* webcams have an interrupt endpoint but spit proprietary data that
|
||||||
* don't conform to the UVC status endpoint messages. Don't try to
|
* don't conform to the UVC status endpoint messages. Don't try to
|
||||||
* handle the interrupt endpoint for those cameras.
|
* handle the interrupt endpoint for those cameras.
|
||||||
|
@ -2057,7 +2072,8 @@ static int uvc_scan_device(struct uvc_device *dev)
|
||||||
if (!UVC_ENTITY_IS_OTERM(term))
|
if (!UVC_ENTITY_IS_OTERM(term))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If the terminal is already included in a chain, skip it.
|
/*
|
||||||
|
* If the terminal is already included in a chain, skip it.
|
||||||
* This can happen for chains that have multiple output
|
* This can happen for chains that have multiple output
|
||||||
* terminals, where all output terminals beside the first one
|
* terminals, where all output terminals beside the first one
|
||||||
* will be inserted in the chain in forward scans.
|
* will be inserted in the chain in forward scans.
|
||||||
|
@ -2309,7 +2325,8 @@ static int uvc_register_terms(struct uvc_device *dev,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Register a metadata node, but ignore a possible failure,
|
/*
|
||||||
|
* Register a metadata node, but ignore a possible failure,
|
||||||
* complete registration of video nodes anyway.
|
* complete registration of video nodes anyway.
|
||||||
*/
|
*/
|
||||||
uvc_meta_register(stream);
|
uvc_meta_register(stream);
|
||||||
|
@ -2507,7 +2524,8 @@ static void uvc_disconnect(struct usb_interface *intf)
|
||||||
{
|
{
|
||||||
struct uvc_device *dev = usb_get_intfdata(intf);
|
struct uvc_device *dev = usb_get_intfdata(intf);
|
||||||
|
|
||||||
/* Set the USB interface data to NULL. This can be done outside the
|
/*
|
||||||
|
* Set the USB interface data to NULL. This can be done outside the
|
||||||
* lock, as there's no other reader.
|
* lock, as there's no other reader.
|
||||||
*/
|
*/
|
||||||
usb_set_intfdata(intf, NULL);
|
usb_set_intfdata(intf, NULL);
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
|
|
||||||
#include "uvcvideo.h"
|
#include "uvcvideo.h"
|
||||||
|
|
||||||
/* Built-in iSight webcams implements most of UVC 1.0 except a
|
/*
|
||||||
|
* Built-in iSight webcams implements most of UVC 1.0 except a
|
||||||
* different packet format. Instead of sending a header at the
|
* different packet format. Instead of sending a header at the
|
||||||
* beginning of each isochronous transfer payload, the webcam sends a
|
* beginning of each isochronous transfer payload, the webcam sends a
|
||||||
* single header per image (on its own in a packet), followed by
|
* single header per image (on its own in a packet), followed by
|
||||||
|
@ -65,7 +66,8 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,
|
||||||
buf->state = UVC_BUF_STATE_ACTIVE;
|
buf->state = UVC_BUF_STATE_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark the buffer as done if we're at the beginning of a new frame.
|
/*
|
||||||
|
* Mark the buffer as done if we're at the beginning of a new frame.
|
||||||
*
|
*
|
||||||
* Empty buffers (bytesused == 0) don't trigger end of frame detection
|
* Empty buffers (bytesused == 0) don't trigger end of frame detection
|
||||||
* as it doesn't make sense to return an empty buffer.
|
* as it doesn't make sense to return an empty buffer.
|
||||||
|
@ -75,7 +77,8 @@ static int isight_decode(struct uvc_video_queue *queue, struct uvc_buffer *buf,
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the video data to the buffer. Skip header packets, as they
|
/*
|
||||||
|
* Copy the video data to the buffer. Skip header packets, as they
|
||||||
* contain no data.
|
* contain no data.
|
||||||
*/
|
*/
|
||||||
if (!is_header) {
|
if (!is_header) {
|
||||||
|
@ -109,7 +112,9 @@ void uvc_video_decode_isight(struct uvc_urb *uvc_urb, struct uvc_buffer *buf,
|
||||||
urb->iso_frame_desc[i].status);
|
urb->iso_frame_desc[i].status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decode the payload packet.
|
/*
|
||||||
|
* Decode the payload packet.
|
||||||
|
*
|
||||||
* uvc_video_decode is entered twice when a frame transition
|
* uvc_video_decode is entered twice when a frame transition
|
||||||
* has been detected because the end of frame can only be
|
* has been detected because the end of frame can only be
|
||||||
* reliably detected when the first packet of the new frame
|
* reliably detected when the first packet of the new frame
|
||||||
|
|
|
@ -135,7 +135,8 @@ static void uvc_buffer_queue(struct vb2_buffer *vb)
|
||||||
kref_init(&buf->ref);
|
kref_init(&buf->ref);
|
||||||
list_add_tail(&buf->queue, &queue->irqqueue);
|
list_add_tail(&buf->queue, &queue->irqqueue);
|
||||||
} else {
|
} else {
|
||||||
/* If the device is disconnected return the buffer to userspace
|
/*
|
||||||
|
* If the device is disconnected return the buffer to userspace
|
||||||
* directly. The next QBUF call will fail with -ENODEV.
|
* directly. The next QBUF call will fail with -ENODEV.
|
||||||
*/
|
*/
|
||||||
buf->state = UVC_BUF_STATE_ERROR;
|
buf->state = UVC_BUF_STATE_ERROR;
|
||||||
|
@ -412,7 +413,8 @@ void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect)
|
||||||
|
|
||||||
spin_lock_irqsave(&queue->irqlock, flags);
|
spin_lock_irqsave(&queue->irqlock, flags);
|
||||||
uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR);
|
uvc_queue_return_buffers(queue, UVC_BUF_STATE_ERROR);
|
||||||
/* This must be protected by the irqlock spinlock to avoid race
|
/*
|
||||||
|
* This must be protected by the irqlock spinlock to avoid race
|
||||||
* conditions between uvc_buffer_queue and the disconnection event that
|
* conditions between uvc_buffer_queue and the disconnection event that
|
||||||
* could result in an interruptible wait in uvc_dequeue_buffer. Do not
|
* could result in an interruptible wait in uvc_dequeue_buffer. Do not
|
||||||
* blindly replace this logic by checking for the UVC_QUEUE_DISCONNECTED
|
* blindly replace this logic by checking for the UVC_QUEUE_DISCONNECTED
|
||||||
|
|
|
@ -202,8 +202,7 @@ static void uvc_status_complete(struct urb *urb)
|
||||||
case -ENOENT: /* usb_kill_urb() called. */
|
case -ENOENT: /* usb_kill_urb() called. */
|
||||||
case -ECONNRESET: /* usb_unlink_urb() called. */
|
case -ECONNRESET: /* usb_unlink_urb() called. */
|
||||||
case -ESHUTDOWN: /* The endpoint is being disabled. */
|
case -ESHUTDOWN: /* The endpoint is being disabled. */
|
||||||
case -EPROTO: /* Device is disconnected (reported by some
|
case -EPROTO: /* Device is disconnected (reported by some host controllers). */
|
||||||
* host controller). */
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -272,7 +271,8 @@ int uvc_status_init(struct uvc_device *dev)
|
||||||
|
|
||||||
pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
|
pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
|
||||||
|
|
||||||
/* For high-speed interrupt endpoints, the bInterval value is used as
|
/*
|
||||||
|
* For high-speed interrupt endpoints, the bInterval value is used as
|
||||||
* an exponent of two. Some developers forgot about it.
|
* an exponent of two. Some developers forgot about it.
|
||||||
*/
|
*/
|
||||||
interval = ep->desc.bInterval;
|
interval = ep->desc.bInterval;
|
||||||
|
|
|
@ -63,7 +63,8 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case V4L2_CTRL_TYPE_MENU:
|
case V4L2_CTRL_TYPE_MENU:
|
||||||
/* Prevent excessive memory consumption, as well as integer
|
/*
|
||||||
|
* Prevent excessive memory consumption, as well as integer
|
||||||
* overflows.
|
* overflows.
|
||||||
*/
|
*/
|
||||||
if (xmap->menu_count == 0 ||
|
if (xmap->menu_count == 0 ||
|
||||||
|
@ -177,7 +178,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
|
||||||
fcc[0], fcc[1], fcc[2], fcc[3],
|
fcc[0], fcc[1], fcc[2], fcc[3],
|
||||||
fmt->fmt.pix.width, fmt->fmt.pix.height);
|
fmt->fmt.pix.width, fmt->fmt.pix.height);
|
||||||
|
|
||||||
/* Check if the hardware supports the requested format, use the default
|
/*
|
||||||
|
* Check if the hardware supports the requested format, use the default
|
||||||
* format otherwise.
|
* format otherwise.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < stream->nformats; ++i) {
|
for (i = 0; i < stream->nformats; ++i) {
|
||||||
|
@ -191,7 +193,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
|
||||||
fmt->fmt.pix.pixelformat = format->fcc;
|
fmt->fmt.pix.pixelformat = format->fcc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the closest image size. The distance between image sizes is
|
/*
|
||||||
|
* Find the closest image size. The distance between image sizes is
|
||||||
* the size in pixels of the non-overlapping regions between the
|
* the size in pixels of the non-overlapping regions between the
|
||||||
* requested size and the frame-specified size.
|
* requested size and the frame-specified size.
|
||||||
*/
|
*/
|
||||||
|
@ -233,7 +236,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
|
||||||
probe->bFormatIndex = format->index;
|
probe->bFormatIndex = format->index;
|
||||||
probe->bFrameIndex = frame->bFrameIndex;
|
probe->bFrameIndex = frame->bFrameIndex;
|
||||||
probe->dwFrameInterval = uvc_try_frame_interval(frame, interval);
|
probe->dwFrameInterval = uvc_try_frame_interval(frame, interval);
|
||||||
/* Some webcams stall the probe control set request when the
|
/*
|
||||||
|
* Some webcams stall the probe control set request when the
|
||||||
* dwMaxVideoFrameSize field is set to zero. The UVC specification
|
* dwMaxVideoFrameSize field is set to zero. The UVC specification
|
||||||
* clearly states that the field is read-only from the host, so this
|
* clearly states that the field is read-only from the host, so this
|
||||||
* is a webcam bug. Set dwMaxVideoFrameSize to the value reported by
|
* is a webcam bug. Set dwMaxVideoFrameSize to the value reported by
|
||||||
|
@ -256,7 +260,8 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
/* After the probe, update fmt with the values returned from
|
/*
|
||||||
|
* After the probe, update fmt with the values returned from
|
||||||
* negotiation with the device. Some devices return invalid bFormatIndex
|
* negotiation with the device. Some devices return invalid bFormatIndex
|
||||||
* and bFrameIndex values, in which case we can only assume they have
|
* and bFrameIndex values, in which case we can only assume they have
|
||||||
* accepted the requested format as-is.
|
* accepted the requested format as-is.
|
||||||
|
|
|
@ -189,7 +189,8 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
|
||||||
ctrl->dwMaxVideoFrameSize =
|
ctrl->dwMaxVideoFrameSize =
|
||||||
frame->dwMaxVideoFrameBufferSize;
|
frame->dwMaxVideoFrameBufferSize;
|
||||||
|
|
||||||
/* The "TOSHIBA Web Camera - 5M" Chicony device (04f2:b50b) seems to
|
/*
|
||||||
|
* The "TOSHIBA Web Camera - 5M" Chicony device (04f2:b50b) seems to
|
||||||
* compute the bandwidth on 16 bits and erroneously sign-extend it to
|
* compute the bandwidth on 16 bits and erroneously sign-extend it to
|
||||||
* 32 bits, resulting in a huge bandwidth value. Detect and fix that
|
* 32 bits, resulting in a huge bandwidth value. Detect and fix that
|
||||||
* condition by setting the 16 MSBs to 0 when they're all equal to 1.
|
* condition by setting the 16 MSBs to 0 when they're all equal to 1.
|
||||||
|
@ -207,7 +208,8 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
|
||||||
? ctrl->dwFrameInterval
|
? ctrl->dwFrameInterval
|
||||||
: frame->dwFrameInterval[0];
|
: frame->dwFrameInterval[0];
|
||||||
|
|
||||||
/* Compute a bandwidth estimation by multiplying the frame
|
/*
|
||||||
|
* Compute a bandwidth estimation by multiplying the frame
|
||||||
* size by the number of video frames per second, divide the
|
* size by the number of video frames per second, divide the
|
||||||
* result by the number of USB frames (or micro-frames for
|
* result by the number of USB frames (or micro-frames for
|
||||||
* high-speed devices) per second and add the UVC header size
|
* high-speed devices) per second and add the UVC header size
|
||||||
|
@ -220,7 +222,8 @@ static void uvc_fixup_video_ctrl(struct uvc_streaming *stream,
|
||||||
bandwidth /= 8;
|
bandwidth /= 8;
|
||||||
bandwidth += 12;
|
bandwidth += 12;
|
||||||
|
|
||||||
/* The bandwidth estimate is too low for many cameras. Don't use
|
/*
|
||||||
|
* The bandwidth estimate is too low for many cameras. Don't use
|
||||||
* maximum packet sizes lower than 1024 bytes to try and work
|
* maximum packet sizes lower than 1024 bytes to try and work
|
||||||
* around the problem. According to measurements done on two
|
* around the problem. According to measurements done on two
|
||||||
* different camera models, the value is high enough to get most
|
* different camera models, the value is high enough to get most
|
||||||
|
@ -267,7 +270,8 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream,
|
||||||
size, uvc_timeout_param);
|
size, uvc_timeout_param);
|
||||||
|
|
||||||
if ((query == UVC_GET_MIN || query == UVC_GET_MAX) && ret == 2) {
|
if ((query == UVC_GET_MIN || query == UVC_GET_MAX) && ret == 2) {
|
||||||
/* Some cameras, mostly based on Bison Electronics chipsets,
|
/*
|
||||||
|
* Some cameras, mostly based on Bison Electronics chipsets,
|
||||||
* answer a GET_MIN or GET_MAX request with the wCompQuality
|
* answer a GET_MIN or GET_MAX request with the wCompQuality
|
||||||
* field only.
|
* field only.
|
||||||
*/
|
*/
|
||||||
|
@ -279,7 +283,8 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream,
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto out;
|
goto out;
|
||||||
} else if (query == UVC_GET_DEF && probe == 1 && ret != size) {
|
} else if (query == UVC_GET_DEF && probe == 1 && ret != size) {
|
||||||
/* Many cameras don't support the GET_DEF request on their
|
/*
|
||||||
|
* Many cameras don't support the GET_DEF request on their
|
||||||
* video probe control. Warn once and return, the caller will
|
* video probe control. Warn once and return, the caller will
|
||||||
* fall back to GET_CUR.
|
* fall back to GET_CUR.
|
||||||
*/
|
*/
|
||||||
|
@ -322,7 +327,8 @@ static int uvc_get_video_ctrl(struct uvc_streaming *stream,
|
||||||
ctrl->bMaxVersion = 0;
|
ctrl->bMaxVersion = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Some broken devices return null or wrong dwMaxVideoFrameSize and
|
/*
|
||||||
|
* Some broken devices return null or wrong dwMaxVideoFrameSize and
|
||||||
* dwMaxPayloadTransferSize fields. Try to get the value from the
|
* dwMaxPayloadTransferSize fields. Try to get the value from the
|
||||||
* format and frame descriptors.
|
* format and frame descriptors.
|
||||||
*/
|
*/
|
||||||
|
@ -386,7 +392,8 @@ int uvc_probe_video(struct uvc_streaming *stream,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Perform probing. The device should adjust the requested values
|
/*
|
||||||
|
* Perform probing. The device should adjust the requested values
|
||||||
* according to its capabilities. However, some devices, namely the
|
* according to its capabilities. However, some devices, namely the
|
||||||
* first generation UVC Logitech webcams, don't implement the Video
|
* first generation UVC Logitech webcams, don't implement the Video
|
||||||
* Probe control properly, and just return the needed bandwidth. For
|
* Probe control properly, and just return the needed bandwidth. For
|
||||||
|
@ -493,7 +500,8 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
|
||||||
if (len < header_size)
|
if (len < header_size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Extract the timestamps:
|
/*
|
||||||
|
* Extract the timestamps:
|
||||||
*
|
*
|
||||||
* - store the frame PTS in the buffer structure
|
* - store the frame PTS in the buffer structure
|
||||||
* - if the SCR field is present, retrieve the host SOF counter and
|
* - if the SCR field is present, retrieve the host SOF counter and
|
||||||
|
@ -506,7 +514,8 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
|
||||||
if (!has_scr)
|
if (!has_scr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* To limit the amount of data, drop SCRs with an SOF identical to the
|
/*
|
||||||
|
* To limit the amount of data, drop SCRs with an SOF identical to the
|
||||||
* previous one.
|
* previous one.
|
||||||
*/
|
*/
|
||||||
dev_sof = get_unaligned_le16(&data[header_size - 2]);
|
dev_sof = get_unaligned_le16(&data[header_size - 2]);
|
||||||
|
@ -518,7 +527,8 @@ uvc_video_clock_decode(struct uvc_streaming *stream, struct uvc_buffer *buf,
|
||||||
host_sof = usb_get_current_frame_number(stream->dev->udev);
|
host_sof = usb_get_current_frame_number(stream->dev->udev);
|
||||||
time = uvc_video_get_time();
|
time = uvc_video_get_time();
|
||||||
|
|
||||||
/* The UVC specification allows device implementations that can't obtain
|
/*
|
||||||
|
* The UVC specification allows device implementations that can't obtain
|
||||||
* the USB frame number to keep their own frame counters as long as they
|
* the USB frame number to keep their own frame counters as long as they
|
||||||
* match the size and frequency of the frame number associated with USB
|
* match the size and frequency of the frame number associated with USB
|
||||||
* SOF tokens. The SOF values sent by such devices differ from the USB
|
* SOF tokens. The SOF values sent by such devices differ from the USB
|
||||||
|
@ -756,7 +766,8 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
|
||||||
y1 = NSEC_PER_SEC;
|
y1 = NSEC_PER_SEC;
|
||||||
y2 = (u32)ktime_to_ns(ktime_sub(last->host_time, first->host_time)) + y1;
|
y2 = (u32)ktime_to_ns(ktime_sub(last->host_time, first->host_time)) + y1;
|
||||||
|
|
||||||
/* Interpolated and host SOF timestamps can wrap around at slightly
|
/*
|
||||||
|
* Interpolated and host SOF timestamps can wrap around at slightly
|
||||||
* different times. Handle this by adding or removing 2048 to or from
|
* different times. Handle this by adding or removing 2048 to or from
|
||||||
* the computed SOF value to keep it close to the SOF samples mean
|
* the computed SOF value to keep it close to the SOF samples mean
|
||||||
* value.
|
* value.
|
||||||
|
@ -854,7 +865,8 @@ static void uvc_video_stats_decode(struct uvc_streaming *stream,
|
||||||
stream->stats.frame.pts = pts;
|
stream->stats.frame.pts = pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do all frames have a PTS in their first non-empty packet, or before
|
/*
|
||||||
|
* Do all frames have a PTS in their first non-empty packet, or before
|
||||||
* their first empty packet ?
|
* their first empty packet ?
|
||||||
*/
|
*/
|
||||||
if (stream->stats.frame.size == 0) {
|
if (stream->stats.frame.size == 0) {
|
||||||
|
@ -945,7 +957,8 @@ size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
|
||||||
unsigned int duration;
|
unsigned int duration;
|
||||||
size_t count = 0;
|
size_t count = 0;
|
||||||
|
|
||||||
/* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF
|
/*
|
||||||
|
* Compute the SCR.SOF frequency estimate. At the nominal 1kHz SOF
|
||||||
* frequency this will not overflow before more than 1h.
|
* frequency this will not overflow before more than 1h.
|
||||||
*/
|
*/
|
||||||
duration = ktime_ms_delta(stream->stats.stream.stop_ts,
|
duration = ktime_ms_delta(stream->stats.stream.stop_ts,
|
||||||
|
@ -997,7 +1010,8 @@ static void uvc_video_stats_stop(struct uvc_streaming *stream)
|
||||||
* Video codecs
|
* Video codecs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Video payload decoding is handled by uvc_video_decode_start(),
|
/*
|
||||||
|
* Video payload decoding is handled by uvc_video_decode_start(),
|
||||||
* uvc_video_decode_data() and uvc_video_decode_end().
|
* uvc_video_decode_data() and uvc_video_decode_end().
|
||||||
*
|
*
|
||||||
* uvc_video_decode_start is called with URB data at the start of a bulk or
|
* uvc_video_decode_start is called with URB data at the start of a bulk or
|
||||||
|
@ -1037,7 +1051,8 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
|
||||||
{
|
{
|
||||||
u8 fid;
|
u8 fid;
|
||||||
|
|
||||||
/* Sanity checks:
|
/*
|
||||||
|
* Sanity checks:
|
||||||
* - packet must be at least 2 bytes long
|
* - packet must be at least 2 bytes long
|
||||||
* - bHeaderLength value must be at least 2 bytes (see above)
|
* - bHeaderLength value must be at least 2 bytes (see above)
|
||||||
* - bHeaderLength value can't be larger than the packet size.
|
* - bHeaderLength value can't be larger than the packet size.
|
||||||
|
@ -1049,7 +1064,8 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
|
||||||
|
|
||||||
fid = data[1] & UVC_STREAM_FID;
|
fid = data[1] & UVC_STREAM_FID;
|
||||||
|
|
||||||
/* Increase the sequence number regardless of any buffer states, so
|
/*
|
||||||
|
* Increase the sequence number regardless of any buffer states, so
|
||||||
* that discontinuous sequence numbers always indicate lost frames.
|
* that discontinuous sequence numbers always indicate lost frames.
|
||||||
*/
|
*/
|
||||||
if (stream->last_fid != fid) {
|
if (stream->last_fid != fid) {
|
||||||
|
@ -1061,7 +1077,8 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
|
||||||
uvc_video_clock_decode(stream, buf, data, len);
|
uvc_video_clock_decode(stream, buf, data, len);
|
||||||
uvc_video_stats_decode(stream, data, len);
|
uvc_video_stats_decode(stream, data, len);
|
||||||
|
|
||||||
/* Store the payload FID bit and return immediately when the buffer is
|
/*
|
||||||
|
* Store the payload FID bit and return immediately when the buffer is
|
||||||
* NULL.
|
* NULL.
|
||||||
*/
|
*/
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
|
@ -1076,7 +1093,8 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
|
||||||
buf->error = 1;
|
buf->error = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Synchronize to the input stream by waiting for the FID bit to be
|
/*
|
||||||
|
* Synchronize to the input stream by waiting for the FID bit to be
|
||||||
* toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE.
|
* toggled when the the buffer state is not UVC_BUF_STATE_ACTIVE.
|
||||||
* stream->last_fid is initialized to -1, so the first isochronous
|
* stream->last_fid is initialized to -1, so the first isochronous
|
||||||
* frame will always be in sync.
|
* frame will always be in sync.
|
||||||
|
@ -1102,7 +1120,8 @@ static int uvc_video_decode_start(struct uvc_streaming *stream,
|
||||||
buf->state = UVC_BUF_STATE_ACTIVE;
|
buf->state = UVC_BUF_STATE_ACTIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark the buffer as done if we're at the beginning of a new frame.
|
/*
|
||||||
|
* Mark the buffer as done if we're at the beginning of a new frame.
|
||||||
* End of frame detection is better implemented by checking the EOF
|
* End of frame detection is better implemented by checking the EOF
|
||||||
* bit (FID bit toggling is delayed by one frame compared to the EOF
|
* bit (FID bit toggling is delayed by one frame compared to the EOF
|
||||||
* bit), but some devices don't set the bit at end of frame (and the
|
* bit), but some devices don't set the bit at end of frame (and the
|
||||||
|
@ -1226,7 +1245,8 @@ static void uvc_video_decode_end(struct uvc_streaming *stream,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Video payload encoding is handled by uvc_video_encode_header() and
|
/*
|
||||||
|
* Video payload encoding is handled by uvc_video_encode_header() and
|
||||||
* uvc_video_encode_data(). Only bulk transfers are currently supported.
|
* uvc_video_encode_data(). Only bulk transfers are currently supported.
|
||||||
*
|
*
|
||||||
* uvc_video_encode_header is called at the start of a payload. It adds header
|
* uvc_video_encode_header is called at the start of a payload. It adds header
|
||||||
|
@ -1450,7 +1470,8 @@ static void uvc_video_decode_bulk(struct uvc_urb *uvc_urb,
|
||||||
len = urb->actual_length;
|
len = urb->actual_length;
|
||||||
stream->bulk.payload_size += len;
|
stream->bulk.payload_size += len;
|
||||||
|
|
||||||
/* If the URB is the first of its payload, decode and save the
|
/*
|
||||||
|
* If the URB is the first of its payload, decode and save the
|
||||||
* header.
|
* header.
|
||||||
*/
|
*/
|
||||||
if (stream->bulk.header_size == 0 && !stream->bulk.skip_payload) {
|
if (stream->bulk.header_size == 0 && !stream->bulk.skip_payload) {
|
||||||
|
@ -1474,7 +1495,8 @@ static void uvc_video_decode_bulk(struct uvc_urb *uvc_urb,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The buffer queue might have been cancelled while a bulk transfer
|
/*
|
||||||
|
* The buffer queue might have been cancelled while a bulk transfer
|
||||||
* was in progress, so we can reach here with buf equal to NULL. Make
|
* was in progress, so we can reach here with buf equal to NULL. Make
|
||||||
* sure buf is never dereferenced if NULL.
|
* sure buf is never dereferenced if NULL.
|
||||||
*/
|
*/
|
||||||
|
@ -1483,7 +1505,8 @@ static void uvc_video_decode_bulk(struct uvc_urb *uvc_urb,
|
||||||
if (!stream->bulk.skip_payload && buf != NULL)
|
if (!stream->bulk.skip_payload && buf != NULL)
|
||||||
uvc_video_decode_data(uvc_urb, buf, mem, len);
|
uvc_video_decode_data(uvc_urb, buf, mem, len);
|
||||||
|
|
||||||
/* Detect the payload end by a URB smaller than the maximum size (or
|
/*
|
||||||
|
* Detect the payload end by a URB smaller than the maximum size (or
|
||||||
* a payload size equal to the maximum) and process the header again.
|
* a payload size equal to the maximum) and process the header again.
|
||||||
*/
|
*/
|
||||||
if (urb->actual_length < urb->transfer_buffer_length ||
|
if (urb->actual_length < urb->transfer_buffer_length ||
|
||||||
|
@ -1686,7 +1709,8 @@ static int uvc_alloc_urb_buffers(struct uvc_streaming *stream,
|
||||||
if (stream->urb_size)
|
if (stream->urb_size)
|
||||||
return stream->urb_size / psize;
|
return stream->urb_size / psize;
|
||||||
|
|
||||||
/* Compute the number of packets. Bulk endpoints might transfer UVC
|
/*
|
||||||
|
* Compute the number of packets. Bulk endpoints might transfer UVC
|
||||||
* payloads across multiple URBs.
|
* payloads across multiple URBs.
|
||||||
*/
|
*/
|
||||||
npackets = DIV_ROUND_UP(size, psize);
|
npackets = DIV_ROUND_UP(size, psize);
|
||||||
|
@ -1975,7 +1999,8 @@ static int uvc_video_start_transfer(struct uvc_streaming *stream,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The Logitech C920 temporarily forgets that it should not be adjusting
|
/*
|
||||||
|
* The Logitech C920 temporarily forgets that it should not be adjusting
|
||||||
* Exposure Absolute during init so restore controls to stored values.
|
* Exposure Absolute during init so restore controls to stored values.
|
||||||
*/
|
*/
|
||||||
if (stream->dev->quirks & UVC_QUIRK_RESTORE_CTRLS_ON_INIT)
|
if (stream->dev->quirks & UVC_QUIRK_RESTORE_CTRLS_ON_INIT)
|
||||||
|
@ -2018,7 +2043,8 @@ int uvc_video_resume(struct uvc_streaming *stream, int reset)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* If the bus has been reset on resume, set the alternate setting to 0.
|
/*
|
||||||
|
* If the bus has been reset on resume, set the alternate setting to 0.
|
||||||
* This should be the default value, but some devices crash or otherwise
|
* This should be the default value, but some devices crash or otherwise
|
||||||
* misbehave if they don't receive a SET_INTERFACE request before any
|
* misbehave if they don't receive a SET_INTERFACE request before any
|
||||||
* other video control request.
|
* other video control request.
|
||||||
|
@ -2071,14 +2097,16 @@ int uvc_video_init(struct uvc_streaming *stream)
|
||||||
|
|
||||||
atomic_set(&stream->active, 0);
|
atomic_set(&stream->active, 0);
|
||||||
|
|
||||||
/* Alternate setting 0 should be the default, yet the XBox Live Vision
|
/*
|
||||||
|
* Alternate setting 0 should be the default, yet the XBox Live Vision
|
||||||
* Cam (and possibly other devices) crash or otherwise misbehave if
|
* Cam (and possibly other devices) crash or otherwise misbehave if
|
||||||
* they don't receive a SET_INTERFACE request before any other video
|
* they don't receive a SET_INTERFACE request before any other video
|
||||||
* control request.
|
* control request.
|
||||||
*/
|
*/
|
||||||
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
|
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
|
||||||
|
|
||||||
/* Set the streaming probe control with default streaming parameters
|
/*
|
||||||
|
* Set the streaming probe control with default streaming parameters
|
||||||
* retrieved from the device. Webcams that don't support GET_DEF
|
* retrieved from the device. Webcams that don't support GET_DEF
|
||||||
* requests on the probe control will just keep their current streaming
|
* requests on the probe control will just keep their current streaming
|
||||||
* parameters.
|
* parameters.
|
||||||
|
@ -2086,7 +2114,8 @@ int uvc_video_init(struct uvc_streaming *stream)
|
||||||
if (uvc_get_video_ctrl(stream, probe, 1, UVC_GET_DEF) == 0)
|
if (uvc_get_video_ctrl(stream, probe, 1, UVC_GET_DEF) == 0)
|
||||||
uvc_set_video_ctrl(stream, probe, 1);
|
uvc_set_video_ctrl(stream, probe, 1);
|
||||||
|
|
||||||
/* Initialize the streaming parameters with the probe control current
|
/*
|
||||||
|
* Initialize the streaming parameters with the probe control current
|
||||||
* value. This makes sure SET_CUR requests on the streaming commit
|
* value. This makes sure SET_CUR requests on the streaming commit
|
||||||
* control will always use values retrieved from a successful GET_CUR
|
* control will always use values retrieved from a successful GET_CUR
|
||||||
* request on the probe control, as required by the UVC specification.
|
* request on the probe control, as required by the UVC specification.
|
||||||
|
@ -2095,7 +2124,8 @@ int uvc_video_init(struct uvc_streaming *stream)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
/* Check if the default format descriptor exists. Use the first
|
/*
|
||||||
|
* Check if the default format descriptor exists. Use the first
|
||||||
* available format otherwise.
|
* available format otherwise.
|
||||||
*/
|
*/
|
||||||
for (i = stream->nformats; i > 0; --i) {
|
for (i = stream->nformats; i > 0; --i) {
|
||||||
|
@ -2110,7 +2140,8 @@ int uvc_video_init(struct uvc_streaming *stream)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Zero bFrameIndex might be correct. Stream-based formats (including
|
/*
|
||||||
|
* Zero bFrameIndex might be correct. Stream-based formats (including
|
||||||
* MPEG-2 TS and DV) do not support frames but have a dummy frame
|
* MPEG-2 TS and DV) do not support frames but have a dummy frame
|
||||||
* descriptor with bFrameIndex set to zero. If the default frame
|
* descriptor with bFrameIndex set to zero. If the default frame
|
||||||
* descriptor is not found, use the first available frame.
|
* descriptor is not found, use the first available frame.
|
||||||
|
@ -2187,7 +2218,8 @@ void uvc_video_stop_streaming(struct uvc_streaming *stream)
|
||||||
if (stream->intf->num_altsetting > 1) {
|
if (stream->intf->num_altsetting > 1) {
|
||||||
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
|
usb_set_interface(stream->dev->udev, stream->intfnum, 0);
|
||||||
} else {
|
} else {
|
||||||
/* UVC doesn't specify how to inform a bulk-based device
|
/*
|
||||||
|
* UVC doesn't specify how to inform a bulk-based device
|
||||||
* when the video stream is stopped. Windows sends a
|
* when the video stream is stopped. Windows sends a
|
||||||
* CLEAR_FEATURE(HALT) request to the video streaming
|
* CLEAR_FEATURE(HALT) request to the video streaming
|
||||||
* bulk endpoint, mimic the same behaviour.
|
* bulk endpoint, mimic the same behaviour.
|
||||||
|
|
|
@ -225,7 +225,8 @@ struct gpio_desc;
|
||||||
struct sg_table;
|
struct sg_table;
|
||||||
struct uvc_device;
|
struct uvc_device;
|
||||||
|
|
||||||
/* TODO: Put the most frequently accessed fields at the beginning of
|
/*
|
||||||
|
* TODO: Put the most frequently accessed fields at the beginning of
|
||||||
* structures to maximize cache efficiency.
|
* structures to maximize cache efficiency.
|
||||||
*/
|
*/
|
||||||
struct uvc_control_info {
|
struct uvc_control_info {
|
||||||
|
@ -270,8 +271,7 @@ struct uvc_control {
|
||||||
struct uvc_entity *entity;
|
struct uvc_entity *entity;
|
||||||
struct uvc_control_info info;
|
struct uvc_control_info info;
|
||||||
|
|
||||||
u8 index; /* Used to match the uvc_control entry with a
|
u8 index; /* Used to match the uvc_control entry with a uvc_control_info. */
|
||||||
uvc_control_info. */
|
|
||||||
u8 dirty:1,
|
u8 dirty:1,
|
||||||
loaded:1,
|
loaded:1,
|
||||||
modified:1,
|
modified:1,
|
||||||
|
@ -289,7 +289,8 @@ struct uvc_format_desc {
|
||||||
u32 fcc;
|
u32 fcc;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The term 'entity' refers to both UVC units and UVC terminals.
|
/*
|
||||||
|
* The term 'entity' refers to both UVC units and UVC terminals.
|
||||||
*
|
*
|
||||||
* The type field is either the terminal type (wTerminalType in the terminal
|
* The type field is either the terminal type (wTerminalType in the terminal
|
||||||
* descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
|
* descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
|
||||||
|
@ -308,8 +309,7 @@ struct uvc_format_desc {
|
||||||
|
|
||||||
struct uvc_entity {
|
struct uvc_entity {
|
||||||
struct list_head list; /* Entity as part of a UVC device. */
|
struct list_head list; /* Entity as part of a UVC device. */
|
||||||
struct list_head chain; /* Entity as part of a video device
|
struct list_head chain; /* Entity as part of a video device chain. */
|
||||||
* chain. */
|
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -591,7 +591,8 @@ struct uvc_streaming {
|
||||||
struct uvc_format *cur_format;
|
struct uvc_format *cur_format;
|
||||||
struct uvc_frame *cur_frame;
|
struct uvc_frame *cur_frame;
|
||||||
|
|
||||||
/* Protect access to ctrl, cur_format, cur_frame and hardware video
|
/*
|
||||||
|
* Protect access to ctrl, cur_format, cur_frame and hardware video
|
||||||
* probe control.
|
* probe control.
|
||||||
*/
|
*/
|
||||||
struct mutex mutex;
|
struct mutex mutex;
|
||||||
|
|
Loading…
Reference in a new issue