xiaoxiang781216 edited a comment on pull request #2039:
URL: https://github.com/apache/incubator-nuttx/pull/2039#issuecomment-714246971


   
   
   > Where is this wtgahrs.c file? It does not seem to be part of this PR. 
Maybe I'm missing something.
   > 
   > Regarding the sensor model itself, it is difficult for me to evaluate how 
well it maps to existing sensors. I think there's a risk of this being too 
restrictive and it is something that you will only find out when you try to 
look at various drivers and see if they all can work the same way or their 
behaviour would change.
   > 
   > That said, we could merge this and consider it a feature that needs more 
evaluation before fully embracing it (and porting all drivers to it). I 
wouldn't want to have two sets of drivers: those that work with this interface 
and a lot of others that do not. Maybe as you say, it is a matter of slowly 
evolving this into something that considers all scenarios.
   > 
   > Regarding the buffer, there are two points here. First, I think that for 
some drivers it is better to have the option of having no _extra_ buffer at 
all. The posix read() will supply a buffer where the driver can directly write 
into. I don't think it makes sense for all cases to have an intermediate 
buffer. In that case, I would expect the intermediate buffer be skipped. 
Second, consider adding support for dropping old values when the queue is full. 
This came up recently with the ADC driver: most times you care more about last 
N values than first N values until buffer is full.
   
   Here, it's the plan for the new patch:
   
   1. Add read_sensor callback to sensor_lowerhalf_s
   2. If lowerhalf implement this callback, upperhalf skip all intermediate 
buffer stuff
   3. upperhalf's read will call the new callback directly in this case
   
   On the other hand, the current implelmentation(buffer + push_event) will 
activate If read_sensor is NULL. So the driver writer can select one approach 
which is more suitable for his case, but the userspace always use the same 
method to access the sensor regardless wether the buffer exist or not.
   


----------------------------------------------------------------
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.

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


Reply via email to