Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions system/uorb/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ config UORB_PRIORITY

config UORB_STACKSIZE
int "stack size"
default 4096 if UORB_FORMAT

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will do.

default DEFAULT_TASK_STACKSIZE
---help---
UORB_FORMAT needs around 2.2KB of stack for the listener, which
does not fit in a DEFAULT_TASK_STACKSIZE of 2048.

config UORB_FORMAT
bool
select LIBC_PRINT_EXTENSION
default n

config UORB_LISTENER
Expand Down
34 changes: 31 additions & 3 deletions system/uorb/listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.
I've been avoiding messing with the kernel, I'm going to stop doing that.

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

/****************************************************************************
Expand Down Expand Up @@ -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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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;
Expand Down Expand Up @@ -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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the cast

{
usleep((unsigned)((orb_abstime)interval - elapsed));
}
}
}

i = 0;
Expand Down
Loading