v4l2 event

v4l2_event_queue:

static int bridge_event_queue(struct cam_sensor_ctrl_t * s_ctrl)
{
    struct v4l2_event event;
    struct cam_req_mgr_message       msg;
    int rc = 0;
    memset(&event, 0, sizeof(struct v4l2_event));
    event.id = V4L_EVENT_CAM_REQ_MGR_SENSOR_LOCK;
    event.type = CAM_SENSOR_EVENT_TYPE;

    memset(&msg, 0, sizeof(msg));

    msg.session_hdl = s_ctrl->bridge_intf.session_hdl;
    msg.u.err_msg.error_type = s_ctrl->mask;
    msg.u.err_msg.request_id = s_ctrl->sensordata->slave_info.sensor_slave_addr;
    msg.u.err_msg.link_hdl= s_ctrl->bridge_intf.link_hdl;
    msg.u.err_msg.sensorname_ptr = (uintptr_t)(s_ctrl->sensordata->sensorname);



    memcpy(&event.u.data[0], &msg,
        sizeof(struct cam_req_mgr_message));

    v4l2_event_queue(s_ctrl->v4l2_dev_str.sd.devnode, &event);

    return rc;
}

 ops:

static struct v4l2_subdev_core_ops cam_sensor_subdev_core_ops = {
    .ioctl = cam_sensor_subdev_ioctl,
#ifdef CONFIG_COMPAT
    .compat_ioctl32 = cam_sensor_init_subdev_do_ioctl,
#endif
    .s_power = cam_sensor_power,
    .subscribe_event = cam_sensor_subdev_subscribe_event,
    .unsubscribe_event = cam_sensor_subdev_unsubscribe_event,
};

static int cam_sensor_subdev_subscribe_event(struct v4l2_subdev *sd,
    struct v4l2_fh *fh,
    struct v4l2_event_subscription *sub)
{
    return v4l2_event_subscribe(fh, sub, CAM_SUBDEVICE_EVENT_MAX, NULL);
}

static int cam_sensor_subdev_unsubscribe_event(struct v4l2_subdev *sd,
    struct v4l2_fh *fh,
    struct v4l2_event_subscription *sub)
{
    return v4l2_event_unsubscribe(fh, sub);
}

参考博客:V4L2之events_麻辣小新的博客-CSDN博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值