KK2版本多个APK作用gsensor上报速率问题
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
KK2版本上两个不同的APK同时需要作用gsensor,设置的delay值不同,一个是200ms,一个是
66ms,但是gsensor的实际上报值并不总是66ms。
[SOLUTION]
在KK2.MP13上SensorDevice.cpp中:
if (halVersion >= SENSORS_DEVICE_API_VERSION_1_1) {
if (flags & SENSORS_BATCH_DRY_RUN) {
return mSensorDevice->batch(mSensorDevice, handle, flags, samplingPeriodNs
, maxBatchReportLatencyNs);
} else {
// Call h/w with dry run to see if the given parameters are feasible or
not. Return if
// there is an error.
status_t errDryRun(NO_ERROR);
errDryRun = mSensorDevice->batch(mSensorDevice, handle, flags |
SENSORS_BATCH_DRY_RUN, samplingPeriodNs, maxBatchReportLatencyNs);
该batch最终会调用err = mSensors[hwmsen]->setDelay(handle, ns)通过ioctl作用
驱动
这会对驱动设置一次delay值,若是有多个应用作用于同一个sensor
,会导致驱动层delay值不同,并非最小值。
• 针对该类问题,在KK2一些比较老的版本需要patch
Patch信息:
[Patch] ALPS01829985
KK2版本上两个不同的APK同时需要作用gsensor,设置的delay值不同,一个是200ms,一个是
66ms,但是gsensor的实际上报值并不总是66ms。
[SOLUTION]
在KK2.MP13上SensorDevice.cpp中:
if (halVersion >= SENSORS_DEVICE_API_VERSION_1_1) {
if (flags & SENSORS_BATCH_DRY_RUN) {
return mSensorDevice->batch(mSensorDevice, handle, flags, samplingPeriodNs
, maxBatchReportLatencyNs);
} else {
// Call h/w with dry run to see if the given parameters are feasible or
not. Return if
// there is an error.
status_t errDryRun(NO_ERROR);
errDryRun = mSensorDevice->batch(mSensorDevice, handle, flags |
SENSORS_BATCH_DRY_RUN, samplingPeriodNs, maxBatchReportLatencyNs);
该batch最终会调用err = mSensors[hwmsen]->setDelay(handle, ns)通过ioctl作用
驱动
这会对驱动设置一次delay值,若是有多个应用作用于同一个sensor
,会导致驱动层delay值不同,并非最小值。
• 针对该类问题,在KK2一些比较老的版本需要patch
Patch信息:
[Patch] ALPS01829985
谢谢分享
