Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4l2_control invalid argument and permission denied error #63

Open
xaprier opened this issue Jan 19, 2024 · 0 comments
Open

v4l2_control invalid argument and permission denied error #63

xaprier opened this issue Jan 19, 2024 · 0 comments

Comments

@xaprier
Copy link

xaprier commented Jan 19, 2024

Using Auvidea JNX30D with L4T 32.7.3
Camera: IMX568

I'm writing a module for setting camera controls with v4l, and when i try to get/set values of controls, i have got an error with specific controls.

Code block:

bool getControl(int controlId, int &value) {
    struct v4l2_control ctrl;
    std::memset(&ctrl, 0, sizeof(ctrl));
    ctrl.id = controlId;
    
    if (ioctl(_fd, VIDIOC_G_CTRL, &ctrl) == -1) {
        std::perror(std::string("Error getting control of " + std::to_string(controlId)).c_str());
        return false;
    }
    value = ctrl.value;
    return true;
}

I'm getting the controlId with querying the controls:

void queryControls(const std::string &devicePath) {
    int fd = open(devicePath.c_str(), O_RDWR);
    if (fd == -1) {
        std::perror("error opening device");
        return;
    }

    v4l2_queryctrl queryctrl;
    std::memset(&queryctrl, 0, sizeof(queryctrl));
    queryctrl.id = V4L2_CTRL_FLAG_NEXT_CTRL;
    while (ioctl(fd, VIDIOC_QUERYCTRL, &queryctrl) == 0) {
        std::cout << "Control id = " << queryctrl.id << std::endl;
        std::cout << "Control Name = " << queryctrl.name << std::endl;

        // next control
        queryctrl.id |= V4L2_CTRL_FLAG_NEXT_CTRL;
    }

    close(fd);
}

But when I try to get all control values, i have faced with this output:

ID        Name                Value     
10100752  Black Level         0         
10100836  Bypass Mode         1         
Error getting control of 10092545: Permission denied
10092545  Camera Controls     1         
Error getting control of 10100746: Invalid argument
10100746  Exposure            1         
Error getting control of 10100747: Invalid argument
10100747  Frame Rate          1         
Error getting control of 10100745: Invalid argument
10100745  Gain                1         
10100739  Group Hold          0         
10100838  Height Align        1         
10100751  IO Mode             0         
10100845  Low Latency Mode    0         
10100837  Override Enable     1         
10100846  Preferred Stride    0         
Error getting control of 10100744: Invalid argument
10100744  Sensor Mode         0         
10100866  Sensor Modes        1         
Error getting control of 10100753: Permission denied
10100753  Single Trigger      1         
10100839  Size Align          0         
10100750  Trigger Mode        0         
10100840  Write ISP format    1

Any ideas why and how to fix it?

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant