summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uvideo.c
AgeCommit message (Collapse)Author
2017-08-21Fix off by one in array bounds tests when parsing descriptors.Jonathan Gray
Coverity CIDs 1452970 1453305.
2017-04-08A pile of sizes to free(9). In test for a few days in snapshots.Theo de Raadt
Errors will result in nice clean panic messages so we know what's wrong. Reviewed by dhill visa natano jsg.
2017-03-26Add sizes to various free(9) calls. Fixing the simpler ones first.Theo de Raadt
ok natano visa
2016-06-17Replace tsleep/wakeup by usbd_ref_incr/decr/wait to wait for the kthreadMarcus Glocker
to finish on close. Tested and ok Patrick Keshishian ok mpi
2016-06-15No need for a special DVACT_DEACTIVATE hook, autoconf(9) knows howMartin Pieuchot
to deactivate our children. ok mglocker@
2016-06-14Add missing line feed to DPRINTF makes debug reading easier.Marcus Glocker
2016-06-01Correctly set the V4L2_BUF_FLAG_QUEUED and V4L2_BUF_FLAG_DONE buffer flags.Marcus Glocker
With this we can get rid of the sc_mmap_cur variable to query the buffer queue for a free slot. Remove resetting of the V4L2_BUF_FLAG_MAPPED buffer flag while here. It's enough when it gets set initially by uvideo_reqbufs(). Initial diff from Patrick Keshishian, thanks! ok mpi
2016-05-28Do the endpoint verification before opening the pipe on the selectedMarcus Glocker
alternate interface endpoint instead statically on interface 0. Fix duplicate DPRINTF output while there. Initial diff from Patrick Keshishian, thanks!
2016-05-26Remove superfluous loop counter to set alternate video interface since weMarcus Glocker
store the alternate video interface number already. From Patrick Keshishian, thanks!
2016-05-20Fix pasto; v4l2_buf.flags = V4L2_MEMORY_MMAP -> V4L2_BUF_FLAG_MAPPED.Marcus Glocker
From Patrick Keshishian, thanks!
2016-05-17Plug some gaping holes in the v4l2 ioctl interfaces that would leak kernelMark Kettenis
memory to a local user. Found by Patrick Keshisian. Fix a potential integer overflow issue in related code while I'm there. ok mglocker@, deraadt@
2016-03-19Remove the unused flags argument from VOP_UNLOCK().natano
torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
2015-12-20Do not delay video(4) attachment if the device does not need to loadMartin Pieuchot
a firmware. Regression spotted by deraadt@
2015-12-11Replace mountroothook_establish(9) by config_mountroot(9) a narrower APIMartin Pieuchot
similar to config_defer(9). ok mikeb@, deraadt@
2015-07-09Move the softc definition to uvideo.c so that userland can includeMartin Pieuchot
<dev/usb/uvideo.h> to get USB video descriptor definitions. from Ludovic Coues.
2015-06-24Allow uvideo_mmap_queue() to fail gracefully when the mmap queue is full;Miod Vallat
found the hard way by sebastia@ four years ago, and I'd been sitting on that diff since. The initial diff was more aggressive and would free the mmap queue upon error, but jakemsr@ had objections against this behaviour; this diff only fails gracefully instead of panic'ing.
2015-01-06We do not support freeing memory using reqbufs with a zero size soJonathan Armani
return EINVAL in this case. Also change an easily triggerable panic by a printf and return EINVAL. Reminded by brad@, one typo spotted by sthen@ and ok mpi@
2014-11-18Nuke yet more obvious #include duplications.Kenneth R Westerback
ok miod@
2014-10-23Now that gcc2 is gone revert the removal of anonymous unions, means not ↵Brad Smith
having to modify various third party apps using the V4L2 API to build on OpenBSD specifically. "I think this is the right thing to do" miod@ "Fine with me." sthen@
2014-10-18Add VIDIOC_G_INPUT ioctl, some ports need it (at least ffmpeg)Jonathan Armani
ok ratchov@, sthen@, mpi@
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-01-22add a missing argument to a printfJonathan Gray
2013-11-07Replace sc_dying in favour of usbd_is_dying() and usbd_deactivate().Paul Irofti
Tested and okay mpi@.
2013-04-26Don't use usbd_bulk_transfer() to submit a synchronous transfer here too.Martin Pieuchot
ok mglocker@
2013-04-26Rename three functions in usbdi.c to their right prefix (usb_* to usbd_*).Marcus Glocker
ok mpi@
2013-04-15Get rid of various 'typedef struct' definitions and use plain structureMarcus Glocker
definitions instead. We don't change usb.h for now to stay compatible with userland. Tested by mpi@ on macppc and myself on i386. ok mpi@
2013-03-28proc.h is way too much header for usb to handle.Ted Unangst
2013-03-28you probably don't need to include vnode.h or reboot.h. you most definitelyTed Unangst
absolutely do not need to include vnode.h because it includes uvm_extern.h and you want the idiotic TRUE FALSE defines from uvm.
2012-06-18Do not try to get the description of an unexisting video format,Martin Pieuchot
from Gregor Best.
2011-10-28Fix bogus frame selection check in uvideo_vs_negotiation().Marcus Glocker
From Pedro Martelletto
2011-09-18usbdivar.h needs struct timeout. But don't get it indirectly viaKenneth R Westerback
sys/kthread.h, use sys/timeout.h explicitly. Noted by Michael Knudsen. ok deraadt@ kettenis@ guenther@
2011-07-03Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingMatthew Dempsky
that's ever used it, and it's long since been changed to use DVACT_{QUIESCE,SUSPEND,RESUME} instead. ok deraadt@, dlg@; miod@ also agreed with this idea when I brought it up a few weeks ago
2011-06-23Don't leak the ctrl_data in uvideo_queryctrl, uvideo_s_ctrl and uvideo_g_ctrl.Owain Ainsworth
If one of the usb calls we did here failed we'd return immediately and not free our buffer. ok miod@
2011-06-17M_WAITOK cleanup of two cases:Michael Knudsen
1) Allocating with M_WAITOK, checking for NULL, and calling panic() is pointless (malloc() will panic if it can't allocate) so remove the check and the call. 2) Allocating with M_WAITOK, checking for NULL, and then gracefully handling failure to allocate is pointless. Instead also pass M_CANFAIL so malloc() doesn't panic so we can actually handle it gracefully. 1) was done using Coccinelle. Input from oga. ok miod.
2011-04-11uncompressed video formats have a fixed per-pixel bit depth, whichJacob Meuser
means the data size of a frame can be calculated if the dimensions are known. * calculate frame data sizes for uncompressed formats instead of believing what the hardware says. the UVC spec changed between 1.0 and 1.1, and as a result, some devices return bogus information. * skip under-sized as well as over-sized uncompressed frames; there is only one correct size for uncompressed frames. * remove quirk to fix uncompressed frame sizes on certain devices, since that now always happens. * check that the device is actually using the parameters we think it's using.
2011-04-04the v4l2 spec says that setting time per frame to zero should reset timeJacob Meuser
per frame to the default, so do that instead of returning EINVAL
2011-03-31just report the frame interval in the same terms the device gives us.Jacob Meuser
previously, this was returning the wrong value (frame rate instead of time per frame, d'oh!).
2011-03-26oops. the frame rate is the inverse of the frame interval. fixesJacob Meuser
setting the frame rate with luvcview.
2011-03-26use 'sizeof(struct usb_video_frame_desc)' instead of a hardcodedJacob Meuser
number
2011-03-26fill in the timestamp when copying a frame into the mmap bufferJacob Meuser
2011-03-26fill in support for VIDIOC_ENUM_FRAMEINTERVALSJacob Meuser
2011-03-26support VIDIOC_S_PARM and VIDIOC_G_PARM. these ioctls are used forJacob Meuser
setting and and getting the frame interval.
2011-03-26print the supported frame intervals when printing the frame descriptorJacob Meuser
2011-03-25* don't try to align our array of frame descriptors with theJacob Meuser
frame descriptor's bFrameIndex field. the first valid frame in the array is at index 0, not 1. * don't change the format group's default frame when configuring the device, and don't use the default frame as the current frame: these are what the format group's 'frame_cur' is for. tested by several as part of larger diff
2011-03-25* the mjpeg and uncompressed video frame descriptor structures areJacob Meuser
equivilent. only define one structure, struct usb_video_frame_desc, and handle both types of frame descriptors in the same code. * replace hardcoded numbers with 'sizeof(struct usb_video_frame_desc)' where the numbers represent the size of a frame descriptor tested by several
2011-03-25* empty the queue of frames in the mmap frame buffer and set theJacob Meuser
index of the current frame to -1 when the mmap frame buffer is free'd * set the index of the current frame to 0 when allocating the mmap frame buffer * paranoia: panic if a) the mmap frame buffer is already allocated when we try to allocate it, or b) the mmap frame buffer is not allocated when we try to add frames to it tested by several
2011-01-25garbage collect "usb events". without /dev/usb there is no way to accessJacob Meuser
them from userland, and nothing in the kernel uses them. ok krw@, miod@
2011-01-16* instead of NULLing pointers to interface descriptors in the uaa, markJacob Meuser
interfaces as being claimed in the usbd_device's copy of the interface descriptors * allow ugen(4) to be attached if there are unused interfaces in a configuration that has had drivers attached * make ugen(4) aware that it may be sharing a device with (an)other driver(s), and if so: * do not let ugen(4) change the configuration * do not let ugen(4) access the already claimed interfaces discussed with deraadt and miod
2010-11-24- use *un*signed byte array for control dataJacob Meuser
- use UGETW/USETW instead of letoh16/htole16 fixes controls that use two-byte signed data (e.g. brighness and hue) on sparc64
2010-10-23create another kthread to run xfer abort tasks. xfer abort tasks cannotJacob Meuser
be run from the generic task kthread, because xfers that need to be aborted block newly queued tasks from running (i.e. the xfer to be aborted blocks the abort of that task). as there are now three types of usb tasks, add an argument to usb_init_task() and another member to struct usb_task to specify the task type. fixes boot hangs that are showing up because we now use usb tasks to attach/detach usb devices.