Resolution switching in libuvc_camera

asked 2019-03-18 08:33:38 -0600

BugBuster99 gravatar image

I am using libuvc_camera packge for a custom camera and dynamic reconfigure to provide GUI for resolution switching. I have implemented the UVC controls successfully. However I am encountering a problem on when switching resolution. The imageCallback function never gets called and the application seems to wait indefinitely. The modified portion of the config file for resolution switching is as shown below :

resolutions = gen.enum([gen.const("WVGA", int_t, 0, "WVGA format"),
                        gen.const("VGA", int_t, 1, "VGA format"),
                        gen.const("QVGA", int_t, 2, "QVGA format")],
                        "Set Resolution")

gen.add("resolution", int_t, RECONFIGURE_CLOSE,
        "Resolution of video stream from camera.", 0,0,3,
        edit_method = resolutions)

In the camera_driver.cpp, the reconfigure callback function handles the above as: >

devh_, &ctrl,
width, height,

width and height are passed to the above function and returns success

  if ((level & kReconfigureClose) == kReconfigureClose) {
    if (state_ == kRunning) {

  if (state_ == kStopped) {
    if(new_config.resolution != config_.resolution) {   
        switch(new_config.resolution) {
            case WVGA:
                width = 752;
                height = 480;
            case VGA:
                width = 640;
                height = 480;
            case QVGA:
                width = 320;
                height = 240;

OpenCamera() is successfully called and uvc_start_streaming function

uvc_error_t stream_err = uvc_start_streaming(devh_, &ctrl, &CameraDriver::ImageCallbackAdapter, this, 0);

returns UVC_SUCCESS. But the ImageCallbackAdapter never gets called. I am confused what could be the cause of this? I have not changed the sequence of closing and opening the camera from the libuvc_camera package. The appication seems to be waiting for the callback function to be called indefinitely. I think am missing something here. Any suggestions please?

The prints on the console window are as shown:

unsupported descriptor subtype VS_STILL_IMAGE_FRAME
unsupported descriptor subtype VS_STILL_IMAGE_FRAME
Opening /dev/bus/usb/002/044
attempt to claim already-claimed interface 1
uvc_start_streaming- return value:0

Also the for the line >attempt to claim already-claimed interface 1

libusb_detach_kernel_driver() is called prior to claiming the interface.

edit retag flag offensive close merge delete