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 2020/11/23 13:03:52 UTC

[GitHub] [incubator-nuttx] Donny9 commented on a change in pull request #2369: driver/sensors: support custom types of sensor.

Donny9 commented on a change in pull request #2369:
URL: https://github.com/apache/incubator-nuttx/pull/2369#discussion_r528687562



##########
File path: drivers/sensors/sensor.c
##########
@@ -651,22 +682,22 @@ int sensor_register(FAR struct sensor_lowerhalf_s *lower, int devno)
     {
       if (!lower->buffer_size)
         {
-          lower->buffer_size = g_sensor_info[lower->type].esize;
+          lower->buffer_size = esize;
+        }
+      else
+        {
+          lower->buffer_size = ROUNDUP(lower->buffer_size, esize);
         }
 
       lower->push_event = sensor_push_event;
     }
   else
     {
       lower->notify_event = sensor_notify_event;
+      lower->buffer_size = 0;

Review comment:
       Okay, I will modify this issue later.

##########
File path: drivers/sensors/sensor.c
##########
@@ -98,6 +99,7 @@ static int     sensor_poll(FAR struct file *filep, FAR struct pollfd *fds,
 
 static const struct sensor_info g_sensor_info[] =
 {
+  {1,                                 "custom"},

Review comment:
       Done




----------------------------------------------------------------
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.

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