summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uvideo.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* The usb configuration descriptor parameter providing the number ofmglocker2021-01-271-2/+2
| | | | | | available device interfaces is called 'bNumInterfaces'. ok phessler@, thfr@ (who provided the man page diff)
* Zap parameter names in function prototypes.mglocker2020-11-171-4/+4
|
* Nuke all occurrences of usbd_abort_pipe() if it gets called rightmglocker2020-07-311-2/+1
| | | | | | | | | | before usbd_close_pipe(), since usbd_close_pipe() already takes care about aborting non-empty pipes. As investigated by gerhard@ usbdi.c rev. 1.57 did add usbd_abort_pipe() to usbd_close_pipe(), but the drivers didn't get cleaned up afterwards. ok gerhard@
* uvideo_querycap(): Set the 'device_caps' field of struct v4l2_capability like done in utvfu(4)landry2020-07-051-2/+3
| | | | | | | | | | | | | | | | | | Fixes webcam detection in firefox 78, where code was added to check for V4L2_CAP_VIDEO_CAPTURE capability on 'device_caps', whereas we only set it in the 'capabilities' field. According to https://www.kernel.org/doc/html/v4.14/media/uapi/v4l/vidioc-querycap.html#description those distinct fields are here for drivers that provide several devices, but firefox decided to check for 'device_caps' field instead of 'capability' (cf https://hg.mozilla.org/integration/autoland/rev/33facf191f23) - so fill the field for compatibility reasons, while https://bugzilla.mozilla.org/show_bug.cgi?id=1650572 discusses with upstream what's the right way. ok mglocker@
* Fix UVIDEO_DEBUG buildfeinerer2020-05-301-1/+2
| | | | | | | | | | | | | | | | | | | | Include sys/proc.h to address following errors: /usr/src/sys/dev/usb/uvideo.c:2901:31: error: incomplete definition of type 'struct proc' vn_close(nd.ni_vp, FWRITE, p->p_ucred, p); ~^ /usr/src/sys/sys/types.h:223:8: note: forward declaration of 'struct proc' struct proc; ^ /usr/src/sys/dev/usb/uvideo.c:2925:40: error: incomplete definition of type 'struct proc' UIO_SYSSPACE, IO_APPEND|IO_UNIT, p->p_ucred, NULL, p); ~^ /usr/src/sys/sys/types.h:223:8: note: forward declaration of 'struct proc' struct proc; ^ 2 errors generated. ok mpi@
* Free data structures after closing the pseudo-device with vdevgone(9).mpi2020-01-161-3/+3
| | | | | | | | | | | | Pseudo-drivers exposing a userland interface generally start & stop I/O in *_open() and *_close() respectively. So it isn't safe to detach such device while it is still open, because I/O might still be in flight. A more generic fix would be to detach children devices before the parents. Fix a race reported by Kevin Chadwick on bugs@. Discussed with Peter Stuge, tested by and ok zhuk@
* Convert tsleep(9) to tsleep_nsec(9).mpi2019-10-141-2/+2
| | | | ok visa@, kn@
* Fix vn_open to require an op of 0, and 0 or KERNELPATH only as flags.beck2019-10-061-2/+2
| | | | | | | | sweep tree to correct NDIINT op and flags ahead of time. document the requirement. This allows KERNELPATH to be used to bypass unveil for crash dumps with nosuidcoredump=2 or 3 ok visa@ deraadt@ florian@
* Add support for integrated USB cameras with two functions, aspatrick2019-08-071-9/+126
| | | | | | | | | seen on a Lenovo X395 which combines normal webcam functionality with another IR camera, by parsing the USB interface association descriptors. This fixes the symptom of uvideo(4) complaining about too many headers and not providing any functionality at all. ok jan@
* Add support for the KSMedia 8-bit IR format, a greyscale format,patrick2019-08-071-1/+5
| | | | | | as seen on the IR camera of my Lenovo X395. ok jan@
* The USB video class specification has increased its probe bufferpatrick2019-07-101-5/+12
| | | | | | | sizes with each specification. Use the correct size for the given version, since some newer devices cannot handle small buffers. ok jan@
* Also dump interface association descriptor when debugging ispatrick2019-07-101-1/+26
| | | | | | compiled in. ok jan@
* Simplify/refactor the way vendor/product/serial informations arelandry2018-05-011-6/+2
| | | | | | | | | | | | | | | | | | gathered from usb devices. Cache them early in usbd_new_device() instead of querying the device several times (the content wont change anyway) and uselessly generating usb traffic (which could conflict with other access..) The heuristic stays the same, first look in the device descriptor, then try to match against usb_known_vendors/usb_known_products, then fallback to use the idVendor/idProduct codes. Remove the now useless 'usedev' parameter from usbd_fill_deviceinfo(). Tested from bsd & bsd.rd. suggested by and ok mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-281-2/+2
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* Fill the 'card' member of v4l2_capability struct with the usb productlandry2018-04-241-3/+6
| | | | | | | | name coming from usbd_devinfo_vp() instead of the dummy "Generic USB video class device" string, makes it easier to differentiate multiple webcams in firefox's webrtc permission dialog. ok/help mpi@
* Don't pull in <sys/file.h> just to get fcntl.hguenther2017-12-301-2/+2
| | | | ok deraadt@ krw@
* Fix off by one in array bounds tests when parsing descriptors.jsg2017-08-211-3/+3
| | | | Coverity CIDs 1452970 1453305.
* A pile of sizes to free(9). In test for a few days in snapshots.deraadt2017-04-081-5/+5
| | | | | Errors will result in nice clean panic messages so we know what's wrong. Reviewed by dhill visa natano jsg.
* Add sizes to various free(9) calls. Fixing the simpler ones first.deraadt2017-03-261-7/+7
| | | | ok natano visa
* Replace tsleep/wakeup by usbd_ref_incr/decr/wait to wait for the kthreadmglocker2016-06-171-3/+4
| | | | | | | | to finish on close. Tested and ok Patrick Keshishian ok mpi
* No need for a special DVACT_DEACTIVATE hook, autoconf(9) knows howmpi2016-06-151-26/+2
| | | | | | to deactivate our children. ok mglocker@
* Add missing line feed to DPRINTF makes debug reading easier.mglocker2016-06-141-2/+2
|
* Correctly set the V4L2_BUF_FLAG_QUEUED and V4L2_BUF_FLAG_DONE buffer flags.mglocker2016-06-011-29/+16
| | | | | | | | | | | 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
* Do the endpoint verification before opening the pipe on the selectedmglocker2016-05-281-8/+6
| | | | | | | alternate interface endpoint instead statically on interface 0. Fix duplicate DPRINTF output while there. Initial diff from Patrick Keshishian, thanks!
* Remove superfluous loop counter to set alternate video interface since wemglocker2016-05-261-6/+4
| | | | | | store the alternate video interface number already. From Patrick Keshishian, thanks!
* Fix pasto; v4l2_buf.flags = V4L2_MEMORY_MMAP -> V4L2_BUF_FLAG_MAPPED.mglocker2016-05-201-2/+2
| | | | From Patrick Keshishian, thanks!
* Plug some gaping holes in the v4l2 ioctl interfaces that would leak kernelkettenis2016-05-171-3/+26
| | | | | | | 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@
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-191-2/+2
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* Do not delay video(4) attachment if the device does not need to loadmpi2015-12-201-2/+5
| | | | | | a firmware. Regression spotted by deraadt@
* Replace mountroothook_establish(9) by config_mountroot(9) a narrower APImpi2015-12-111-9/+5
| | | | | | similar to config_defer(9). ok mikeb@, deraadt@
* Move the softc definition to uvideo.c so that userland can includempi2015-07-091-1/+57
| | | | | | <dev/usb/uvideo.h> to get USB video descriptor definitions. from Ludovic Coues.
* Allow uvideo_mmap_queue() to fail gracefully when the mmap queue is full;miod2015-06-241-8/+16
| | | | | | | | | 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.
* We do not support freeing memory using reqbufs with a zero size soarmani2015-01-061-3/+9
| | | | | | | | 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@
* Nuke yet more obvious #include duplications.krw2014-11-181-2/+1
| | | | ok miod@
* Now that gcc2 is gone revert the removal of anonymous unions, means not having tobrad2014-10-231-11/+11
| | | | | | | 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@
* Add VIDIOC_G_INPUT ioctl, some ports need it (at least ffmpeg)armani2014-10-181-1/+12
| | | | ok ratchov@, sthen@, mpi@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-12/+12
| | | | after discussions with beck deraadt kettenis.
* add a missing argument to a printfjsg2014-01-221-2/+2
|
* Replace sc_dying in favour of usbd_is_dying() and usbd_deactivate().pirofti2013-11-071-5/+5
| | | | Tested and okay mpi@.
* Don't use usbd_bulk_transfer() to submit a synchronous transfer here too.mpi2013-04-261-6/+8
| | | | ok mglocker@
* Rename three functions in usbdi.c to their right prefix (usb_* to usbd_*).mglocker2013-04-261-27/+27
| | | | ok mpi@
* Get rid of various 'typedef struct' definitions and use plain structuremglocker2013-04-151-13/+13
| | | | | | | | | 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@
* proc.h is way too much header for usb to handle.tedu2013-03-281-2/+1
|
* you probably don't need to include vnode.h or reboot.h. you most definitelytedu2013-03-281-5/+6
| | | | | absolutely do not need to include vnode.h because it includes uvm_extern.h and you want the idiotic TRUE FALSE defines from uvm.
* Do not try to get the description of an unexisting video format,mpi2012-06-181-2/+2
| | | | from Gregor Best.
* Fix bogus frame selection check in uvideo_vs_negotiation().mglocker2011-10-281-6/+6
| | | | From Pedro Martelletto
* usbdivar.h needs struct timeout. But don't get it indirectly viakrw2011-09-181-1/+2
| | | | | | | sys/kthread.h, use sys/timeout.h explicitly. Noted by Michael Knudsen. ok deraadt@ kettenis@ guenther@
* Remove config_activate() and DVACT_ACTIVATE. PCMCIA's the only thingmatthew2011-07-031-3/+1
| | | | | | | | 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
* Don't leak the ctrl_data in uvideo_queryctrl, uvideo_s_ctrl and uvideo_g_ctrl.oga2011-06-231-17/+29
| | | | | | | If one of the usb calls we did here failed we'd return immediately and not free our buffer. ok miod@
* M_WAITOK cleanup of two cases:mk2011-06-171-4/+4
| | | | | | | | | | | | | | | | 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.