File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change 3535
3636#include < gui/ISensorServer.h>
3737#include < gui/ISensorEventConnection.h>
38+ #include < gui/SensorEventQueue.h>
3839
3940#include < hardware/sensors.h>
4041
@@ -587,20 +588,16 @@ status_t SensorService::SensorEventConnection::sendEvents(
587588 count = numEvents;
588589 }
589590
590- if (count == 0 )
591- return 0 ;
592-
593- ssize_t size = mChannel ->write (scratch, count*sizeof (sensors_event_t ));
591+ // NOTE: ASensorEvent and sensors_event_t are the same type
592+ ssize_t size = SensorEventQueue::write (mChannel ,
593+ reinterpret_cast <ASensorEvent const *>(scratch), count);
594594 if (size == -EAGAIN) {
595595 // the destination doesn't accept events anymore, it's probably
596596 // full. For now, we just drop the events on the floor.
597597 // ALOGW("dropping %d events on the floor", count);
598598 return size;
599599 }
600600
601- // ALOGE_IF(size<0, "dropping %d events on the floor (%s)",
602- // count, strerror(-size));
603-
604601 return size < 0 ? status_t (size) : status_t (NO_ERROR);
605602}
606603
You can’t perform that action at this time.
0 commit comments