-
Notifications
You must be signed in to change notification settings - Fork 1.5k
driver/sensors[1]: enhance sensor driver #6704
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
Conversation
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
1.Simplify buffer opeations to avoid frequent resize for batch and no-batch mode. 2.When sensor event is first generated, the buffer is initialized. 3.Remove and merge batch_number to buffer_number when device support batch mode. Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
1. change unsigned int to unsigned long Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
1.cmd:SNIOC_REGISTER with struct sensor_reginfo_s to register user sensor 2.cmd:SNIOC_UNREGISTER to unregister user sensor Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
1.Allow multi users to access the same sensor device simultaneously. 2.Get real state of sensor device by cmd SNIOC_GET_STATE for users. 3.Get update state since last read by poll without timeout for users. 4.Sensor device will be activated when first user open and will close when last user closed. 5.When multi users to access device, driver always set the minimum sampling interval and latency to the sensor device and allow downsampled for users above the minimum sampling interval. 6.The circbuffer will overwrite old data when buffer is full, so if users don't read data soon, data will be lost, and the oldest data in circbuffer are returned to the users. 7.Always read the last data in the circbuffer as initial value for new users when the sensor device has not yet generated new data. 8.when user uses poll, if subscription interval is satisfied, the POLLIN events is returned for each users. 9.When new user generate or the state of sensor device changed, the POLLPRI will notify to all users. 10.Support multi advertisers to subscribe their own data as loop test. Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
|
@acassis this PR depends on sensortest change apache/nuttx-apps#1228. |
| static int usensor_open(FAR struct file *filep) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| static int usensor_close(FAR struct file *filep) | ||
| { | ||
| return 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.
I think those are not needed
| static ssize_t usensor_read(FAR struct file *filep, FAR char *buffer, | ||
| size_t buflen) | ||
| { | ||
| return buflen; |
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.
I think 0 should be returned instead
|
Hello: |
|
For usensor case, the data is provided by orb publisher and consumed by orb subscriber. The sensor upper half does all required functionality(FIFO, file operation etc), that's why the sensor lower half is empty. |
|
@xiaoxiang781216 Thanks so much for your explanation! I think i misread the role of |
|
Yes, the old sensor developed before the new sensor driver framework need rewrite to integrate with uORB. |
|
got it, Thank you for your reply |
Summary
Impact
This PR is a part of #6653.
Testing
Vela CI