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 2021/03/08 08:56:35 UTC

[GitHub] [incubator-nuttx] buyuer opened a new pull request #3000: drivers/sensor: fakesensor support batch.

buyuer opened a new pull request #3000:
URL: https://github.com/apache/incubator-nuttx/pull/3000


   Signed-off-by: buyuer <di...@163.com>
   
   ## Summary
   
   ## Impact
   
   ## Testing
   
   


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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #3000: drivers/sensor: fakesensor support batch.

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #3000:
URL: https://github.com/apache/incubator-nuttx/pull/3000#discussion_r589438393



##########
File path: drivers/sensors/fakesensor.c
##########
@@ -222,13 +240,25 @@ static int fakesensor_thread(int argc, char** argv)
     {
       if (sensor->data.f_inode != NULL)
         {
-          /* Notify upper */
+          /* Sleeping thread for interval */
 
-          sensor->lower.notify_event(sensor->lower.priv);
+          usleep(sensor->batch ? sensor->batch : sensor->interval);

Review comment:
       We should avoid using library functions within the OS, since they modify `errno` and set cancellation points.
   Instead, change it to `nxsig_usleep`.




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



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #3000: drivers/sensor: fakesensor support batch.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #3000:
URL: https://github.com/apache/incubator-nuttx/pull/3000


   


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



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #3000: drivers/sensor: fakesensor support batch.

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #3000:
URL: https://github.com/apache/incubator-nuttx/pull/3000#discussion_r589438393



##########
File path: drivers/sensors/fakesensor.c
##########
@@ -222,13 +240,25 @@ static int fakesensor_thread(int argc, char** argv)
     {
       if (sensor->data.f_inode != NULL)
         {
-          /* Notify upper */
+          /* Sleeping thread for interval */
 
-          sensor->lower.notify_event(sensor->lower.priv);
+          usleep(sensor->batch ? sensor->batch : sensor->interval);

Review comment:
       `fakesensor_thread` is executed in a kernel thread.
   We should avoid using library functions within the OS, since they modify `errno` and set cancellation points.
   Instead, change it to `nxsig_usleep`.




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