msm: camera: Add support to return session id through g_ctrl ioctl

User space needs a mechanism to return the current session id. Use the
g_ctrl ioctl to return the session id.

Change-Id: I8404c8d627c771e0a2f4535d6f66b1b85288808a
Signed-off-by: Seemanta Dutta <seemanta@codeaurora.org>
This commit is contained in:
Seemanta Dutta 2015-02-19 16:54:24 -08:00 committed by TARKZiM
parent 0c9888d59a
commit c9bd49a32a
2 changed files with 15 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -170,16 +170,22 @@ static int camera_v4l2_g_ctrl(struct file *filep, void *fh,
{
int rc = 0;
struct v4l2_event event;
struct msm_video_device *pvdev = video_drvdata(filep);
unsigned int session_id = pvdev->vdev->num;
if (ctrl->id >= V4L2_CID_PRIVATE_BASE) {
camera_pack_event(filep, MSM_CAMERA_GET_PARM, ctrl->id, -1,
&event);
if (ctrl->id == MSM_CAMERA_PRIV_G_SESSION_ID) {
ctrl->value = session_id;
} else {
camera_pack_event(filep, MSM_CAMERA_GET_PARM,
ctrl->id, -1, &event);
rc = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
if (rc < 0)
return rc;
rc = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
if (rc < 0)
return rc;
rc = camera_check_event_status(&event);
rc = camera_check_event_status(&event);
}
}
return rc;

View File

@ -113,6 +113,8 @@
#define MSM_CAMERA_PRIV_SHUTDOWN (V4L2_CID_PRIVATE_BASE + 12)
#define MSM_CAMERA_PRIV_STREAM_INFO_SYNC \
(V4L2_CID_PRIVATE_BASE + 13)
#define MSM_CAMERA_PRIV_G_SESSION_ID (V4L2_CID_PRIVATE_BASE + 14)
#define MSM_CAMERA_PRIV_CMD_MAX 20
/* data.status - success */
#define MSM_CAMERA_CMD_SUCESS 0x00000001