Hi Nathanael,

On Wednesday 13 February 2008, Nathanael Galpin wrote:
> Hi Laurent,
>
> > > On Tuesday 12 February 2008, Nathanael Galpin wrote:
> > > I've run into an error using the UVC driver with V4L2 to stream data
> > > from webcams. Everything works fine the first time around. I allocate
> > > buffers, enque them and then stream data from the camera. However,
> > > after stopping the camera and unmapping all the buffers, a subsequent
> > > attempt to map buffers and start streaming fails.
> >
> > That's definitely not how this is supposed to work. Your code is probably
> > missing something.
>
> I've attached a small sample app to the bottom of this email. It's written
> in C++ and can be compiled with g++ <filename.cpp>.

Thanks. I compiled and ran the application without any visible issue. Here is 
the application output.

Cam Test Project: Restarting a camera.
Video Device Found.
Video Device Configured
Allocated buffers for camera.
Buffers enqueued to camera.
Streaming data...
Processing frame: 0
Processing frame: 1
Processing frame: 2
Processing frame: 3
Processing frame: 4
Processing frame: 5
Processing frame: 6
Processing frame: 7
Processing frame: 8
Processing frame: 9
Streaming data stopped.
Allocated buffers for camera.
Buffers enqueued to camera.
Streaming data...
Processing frame: 0
Processing frame: 1
Processing frame: 2
Processing frame: 3
Processing frame: 4
Processing frame: 5
Processing frame: 6
Processing frame: 7
Processing frame: 8
Processing frame: 9
Streaming data stopped.

Terminated Camera - Code: 0

> > > On a related note, whenever an errenous request is made to the camera,
> > > it goes into an error state and won't accept any other commands. Is
> > > there a way to clear this error state, or should I just close and
> > > reopen the device file?
> >
> > Which camera are you talking about ? What kind of erroneous request ?
> > Please provide more details along with kernel log messages if available.
>
> I wasn't able to get kernel logging enabled last night for the uvc driver
> (but I was pretty tired). I'll spend some more time debugging this and post
> more details when I have them. I figured I would ask in case there was a
> generic way to clear error states in a webcam I wasn't familiar with.

UVC driver logging is controlled by the module's trace parameter. You can set 
it when loading the module with

modprobe uvcvideo trace=xxx

or modify it at runtime with

echo xxx > /sys/modules/uvcvideo/parameters/trace

The parameter is a bitmask. Bit flags are defined in uvcvideo.h and have the 
following meaning:

UVC_TRACE_PROBE         Device probing and scanning
UVC_TRACE_DESCR         Descriptors parsing
UVC_TRACE_CONTROL       Controls registration and requests
UVC_TRACE_FORMAT        Frame format modifications
UVC_TRACE_CAPTURE       Video buffers operations
UVC_TRACE_CALLS         V4L2 calls
UVC_TRACE_IOCTL         V4L2 ioctls
UVC_TRACE_FRAME         Video data frames parsing
UVC_TRACE_SUSPEND       Suspend/resume operations
UVC_TRACE_STATUS        Camera-driven event notifications

Setting UVC_TRACE_FRAME fills the kernel log quite fast. UVC_TRACE_IOCTL and 
UVC_TRACE_CALLS will also print a few messages per frame. Other traces output 
less information.

Best regards,

Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel

Reply via email to