Hello. I didn't change any code from the original code in vvext.cpp, viv_private_ioctl(int fd, const char *cmd, char *request, char *response):
int viv_private_ioctl(const char *cmd, Json::Value& jsonRequest, Json::Value& jsonResponse) {
if (!cmd) {
ALOGE("cmd should not be null!");
return -1;
}
jsonRequest["id"] = cmd;
jsonRequest["streamid"] = streamid;
struct v4l2_ext_controls ecs;
struct v4l2_ext_control ec;
memset(&ecs, 0, sizeof(ecs));
memset(&ec, 0, sizeof(ec));
ec.string = new char[VIV_JSON_BUFFER_SIZE];
ec.id = V4L2_CID_VIV_EXTCTRL;
ec.size = 0;
ecs.controls = &ec;
ecs.count = 1;
::ioctl(fd, VIDIOC_G_EXT_CTRLS, &ecs);
strcpy(ec.string, jsonRequest.toStyledString().c_str());
int ret = ::ioctl(fd, VIDIOC_S_EXT_CTRLS, &ecs);
if (ret != 0)
return ret;
::ioctl(fd, VIDIOC_G_EXT_CTRLS, &ecs);
Json::Reader reader;
reader.parse(ec.string, jsonResponse, true);
delete ec.string;
ec.string = NULL;
return jsonResponse["MC_RET"].asInt();
}
Does this code work on the i.MX8Plus?