You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/05/19 18:06:26 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6280: drivers: video: add ISX019 camera driver

xiaoxiang781216 commented on code in PR #6280:
URL: https://github.com/apache/incubator-nuttx/pull/6280#discussion_r877375539


##########
drivers/video/isx012.c:
##########
@@ -694,6 +713,8 @@ static int isx012_putreg(isx012_dev_t *priv,
 
   memcpy((uint8_t *)&buffer[2], (uint8_t *)&regval, regsize);
 
+  i2c_lock();

Review Comment:
   should i2c_ops_s::transfer guarantee the safe concurrent operation, not the caller.



##########
drivers/video/video.c:
##########
@@ -989,6 +990,33 @@ static int video_close(FAR struct file *filep)
   return ret;
 }
 
+static int video_querycap(FAR struct v4l2_capability *cap)
+{
+  FAR const char *name;
+
+  ASSERT(g_video_sensor_ops);
+
+  if (cap == NULL)
+    {
+      return -EINVAL;
+    }
+
+  if (g_video_sensor_ops->get_driver_name == NULL)
+    {
+      return -ENOTTY;
+    }
+
+  name = g_video_sensor_ops->get_driver_name();
+
+  memset(cap, 0, sizeof(struct v4l2_capability));
+
+  /* cap->driver needs to be NULL-terminated. */
+
+  strncpy((FAR char *)cap->driver, name, sizeof(cap->driver) - 1);

Review Comment:
   strlcpy and remove -1



##########
drivers/video/isx012.c:
##########
@@ -635,6 +637,16 @@ static struct imgsensor_ops_s g_isx012_ops =
  * Private Functions
  ****************************************************************************/
 
+static void i2c_lock(void)

Review Comment:
   i2c may be shared by multiple device, is it enough to lock from device driver?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org