-
Notifications
You must be signed in to change notification settings - Fork 760
Fix/uorb listener fetch only sensors #3686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0fd4ade
2a842d9
8551a21
8724e87
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,15 +200,31 @@ static int listener_create_dir(FAR char *dir, size_t size) | |
| static int listener_subscribe(FAR struct listen_object_s *tmp, | ||
| bool nonwakeup) | ||
| { | ||
| int flags; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's better to let sensor upperhalf layer always return POLLIN for the fetch only sensor
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree. |
||
| int fd; | ||
|
|
||
| if (nonwakeup) | ||
| { | ||
| return orb_subscribe_multi_nonwakeup(tmp->object.meta, | ||
| tmp->object.instance); | ||
| fd = orb_subscribe_multi_nonwakeup(tmp->object.meta, | ||
| tmp->object.instance); | ||
| } | ||
| else | ||
| { | ||
| return orb_subscribe_multi(tmp->object.meta, tmp->object.instance); | ||
| fd = orb_subscribe_multi(tmp->object.meta, tmp->object.instance); | ||
| } | ||
|
|
||
| if (fd < 0) | ||
| { | ||
| return fd; | ||
| } | ||
|
|
||
| flags = fcntl(fd, F_GETFL, 0); | ||
| if (flags >= 0) | ||
| { | ||
| fcntl(fd, F_SETFL, flags | O_NONBLOCK); | ||
| } | ||
|
|
||
| return fd; | ||
| } | ||
|
|
||
| /**************************************************************************** | ||
|
|
@@ -897,6 +913,8 @@ static void listener_monitor(FAR struct listen_list_s *objlist, | |
|
|
||
| while ((!nb_msgs || nb_recv_msgs < nb_msgs) && !g_should_exit) | ||
| { | ||
| orb_abstime start = orb_absolute_time(); | ||
|
|
||
| if (poll(&fds[0], nb_objects, timeout * 1000) > 0) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about let driver return one POLLIN in each interval for fetch only sensor |
||
| { | ||
| i = 0; | ||
|
|
@@ -939,6 +957,16 @@ static void listener_monitor(FAR struct listen_list_s *objlist, | |
| "Giving up. err:%d", timeout, errno); | ||
| break; | ||
| } | ||
|
|
||
| if (interval != 0) | ||
| { | ||
| orb_abstime elapsed = orb_absolute_time() - start; | ||
|
|
||
| if (elapsed < (orb_abstime)interval) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove the cast |
||
| { | ||
| usleep((unsigned)((orb_abstime)interval - elapsed)); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| i = 0; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's change to 4KB always?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I will do.