Android NDK open() device permission denied

后端 未结 3 2198
不思量自难忘°
不思量自难忘° 2020-12-21 17:07

In a native call, I\'m trying to open(\"/dev/video4\", O_RDWR) but I get errno EACCES 13 \"permission denied\".

If I run the same code* in an executable

3条回答
  •  我在风中等你
    2020-12-21 17:37

    The answers was not enough for me, so I left one more anwser. open API has more parameter 'mode'.

    int open(const char *pathname, int flags, mode_t mode);

    check out the link http://man7.org/linux/man-pages/man2/open.2.html

    you might need to use 'open' with S_IRWXU option. like

    open("/dev/video4", O_RDWR | O_CREAT, S_IRWXU )

提交回复
热议问题