8000 iio_refill_buffer() return different when use local context and network context · Issue #740 · analogdevicesinc/libiio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
iio_refill_buffer() return different when use local context and network context #740
Closed
@ChenhuiZhang

Description

@ChenhuiZhang

Hi all,

I'm using iiod to let multiple application can access the 3 accel and 3 gyro data, but it get some problem when enable network context.
E.g. when I enable channel 0/1/2 4/5/6 to fetch 3 accel and 3 gyro data, if I create a local context, it works as expect, each iio_refill_buffer() return the sample with 12 bytes (2 * 3 + 2 * 3), and if I use iio_buffer_foreach_sample() I could get some print as below:

** Message: 11:32:54.555: Read 2 from accel_x
** Message: 11:32:54.555: Read 2 from accel_y
** Message: 11:32:54.556: Read 2 from accel_z
** Message: 11:32:54.556: Read 2 from anglvel_x
** Message: 11:32:54.556: Read 2 from anglvel_y
** Message: 11:32:54.556: Read 2 from anglvel_z
** Message: 11:32:54.556: Read 2 from accel_x
** Message: 11:32:54.556: Read 2 from accel_y
** Message: 11:32:54.557: Read 2 from accel_z
** Message: 11:32:54.557: Read 2 from anglvel_x
** Message: 11:32:54.557: Read 2 from anglvel_y
** Message: 11:32:54.557: Read 2 from anglvel_z

But when I switch to the network context, the sample size seems double: 24 bytes (from iio_buffer_step()), and compare with local context, I get half data (e.g. I use block refill(), so in local context I could call refill 8 times in one second, but in network context, I only could call 4 times), but the sample size (from iio_buffer_step()) is double (12 -> 24). But if I still call iio_buffer_foreach_sample(), I got below print:

** Message: 11:34:36.032: Read 2 from accel_x
** Message: 11:34:36.033: Read 2 from accel_y
** Message: 11:34:36.033: Read 2 from accel_z
** Message: 11:34:36.033: Read 2 from anglvel_y
** Message: 11:34:36.034: Read 2 from anglvel_z
** Message: 11:34:36.034: Read 8 from timestamp
** Message: 11:34:36.034: Read 2 from accel_x
** Message: 11:34:36.035: Read 2 from accel_y
** Message: 11:34:36.035: Read 2 from accel_z
** Message: 11:34:36.035: Read 2 from anglvel_y
** Message: 11:34:36.036: Read 2 from anglvel_z
** Message: 11:34:36.036: Read 8 from timestamp

So it seems the data in call back is wrong. And now I only have one client connect to iiod server, so it should same as we use local context, right? Why I got such difference between local and network context?

Anyone have any suggestion? Thanks.

Best Regards,
Hermes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0