Menu

Unable to set exposure value using ioctl()

Pranav
2012-08-07
2013-02-28
  • Pranav

    Pranav - 2012-08-07

    Hi,
    I am trying to control the webcam exposure using following code(excerpt only) but i get Input/Output error while setting 'value':

    struct v4l2_control ctrl;
    
    memset(&ctrl,0,sizeof(ctrl));
    ctrl.id=V4L2_CID_EXPOSURE_ABSOLUTE;
    ctrl.value=1;
    
    if(-1==ioctl(fd_webcam,VIDIOC_S_CTRL,&ctrl))
    perror("");
    

    am i doing any mistake here?
    I am using Logitech Webcam Sphere AF.

     
  • Pranav

    Pranav - 2013-02-27

    Any updates on this issue?

     
  • Paulo Assis

    Paulo Assis - 2013-02-27

    Exposure value can only be set set if exposure mode is set to manual.
    Make sure to change this first, by default it will be in auto mode.

    Regards,
    Paulo

     
  • Pranav

    Pranav - 2013-02-28

    Hi,
    I tried setting exposure mode to manual by:
    ctrl.id=V4L2_CID_EXPOSURE_AUTO;
    ctrl.value=V4L2_EXPOSURE_MANUAL;

    but it is giving Error Code-5:Input/Output error.

     
  • Paulo Assis

    Paulo Assis - 2013-02-28

    Do other controls work ?

    If not, then it could be that you are missing some v4l2 initialization make sure you follow all the necessary steps (check v4l2 api here: http://linuxtv.org/downloads/v4l-dvb-apis/)

    you should also query the controls first to get the hardware supported values,
    use VIDIOC_QUERYCTRL and VIDIOC_QUERYMENU for that.

    predefined values like V4L2_EXPOSURE_MANUAL may not work as expected or even be available at all, this is the reason why it's important to query the controls first.

    It could also be that you camera crashed, this is easy to solve, just unplug and plug back the usb cable :D

     

Log in to post a comment.

MongoDB Logo MongoDB