xiaoxiang781216 commented on a change in pull request #5624:
URL: https://github.com/apache/incubator-nuttx/pull/5624#discussion_r817006877



##########
File path: drivers/input/ajoystick.c
##########
@@ -722,6 +720,19 @@ static int ajoy_poll(FAR struct file *filep, FAR struct 
pollfd *fds,
 
               opriv->ao_fds[i] = fds;
               fds->priv = &opriv->ao_fds[i];
+
+              /* Report if the event is pending */
+
+              if (opriv->ao_pollpending)
+                {
+                  fds->revents |= (fds->events & POLLIN);
+                  if (fds->revents != 0)
+                    {
+                      iinfo("Report events: %02x\n", fds->revents);
+                      nxsem_post(fds->sem);

Review comment:
       No, the protocol require that fds must save into ao_fds if it return 
true regardless the semaphore post or not. You can see touchscreen_upper.c do 
the same thing:
   
https://github.com/apache/incubator-nuttx/blob/master/drivers/input/touchscreen_upper.c#L319-L324
   poll will call ajoy_poll with setup == false immediately after return.

##########
File path: drivers/input/button_upper.c
##########
@@ -759,6 +767,19 @@ static int btn_poll(FAR struct file *filep, FAR struct 
pollfd *fds,
 
               opriv->bo_fds[i] = fds;
               fds->priv = &opriv->bo_fds[i];
+
+              /* Report if the event is pending */
+
+              if (opriv->bo_pending)
+                {
+                  fds->revents |= (fds->events & POLLIN);
+                  if (fds->revents != 0)
+                    {
+                      iinfo("Report events: %02x\n", fds->revents);
+                      nxsem_post(fds->sem);

Review comment:
       ditto

##########
File path: drivers/input/djoystick.c
##########
@@ -713,6 +711,17 @@ static int djoy_poll(FAR struct file *filep, FAR struct 
pollfd *fds,
 
               opriv->do_fds[i] = fds;
               fds->priv = &opriv->do_fds[i];
+
+              if (opriv->do_pollpending)
+                {
+                  fds->revents |= (fds->events & POLLIN);

Review comment:
       ditto




-- 
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-unsubscr...@nuttx.apache.org

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


Reply via email to