• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


コミットメタ情報

リビジョンe789da8eb2ac19413e735488bb8e48502beffe59 (tree)
日時2014-08-27 19:19:17
作者Chih-Wei Huang <cwhuang@linu...>
コミッターChih-Wei Huang

ログメッセージ

InputReader: read the pointercal from TSCalibration2

Watch the pointercal and reload it on changed.

変更サマリ

差分

--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -2757,6 +2757,19 @@ void TouchInputMapper::configure(nsecs_t when,
27572757 configureSurface(when, &resetNeeded);
27582758 }
27592759
2760+ if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_ALIAS)) {
2761+ // Get 5-point calibration parameters
2762+ int *p = mCalibration.fiveCal;
2763+ p[6] = 0;
2764+ if (FILE *file = fopen("/data/misc/tscal/pointercal", "r")) {
2765+ if (fscanf(file, "%d %d %d %d %d %d %d", &p[0], &p[1], &p[2], &p[3], &p[4], &p[5], &p[6]) == 7) {
2766+ p[0] *= mXScale, p[1] *= mYScale, p[3] *= mXScale, p[4] *= mYScale;
2767+ ALOGD("pointercal loaded ok");
2768+ }
2769+ fclose(file);
2770+ }
2771+ }
2772+
27602773 if (changes && resetNeeded) {
27612774 // Send reset, unless this is the first time the device has been configured,
27622775 // in which case the reader will call reset itself after all mappers are ready.
@@ -3479,16 +3492,6 @@ void TouchInputMapper::parseCalibration() {
34793492 coverageCalibrationString.string());
34803493 }
34813494 }
3482-
3483- // Get 5-point calibration parameters
3484- FILE *file = fopen("/data/system/tslib/pointercal", "r");
3485- int *p = out.fiveCal;
3486- if (file) {
3487- fscanf(file, "%d %d %d %d %d %d %d", &p[0], &p[1], &p[2], &p[3], &p[4], &p[5], &p[6]);
3488- fclose(file);
3489- } else {
3490- p[6] = 0;
3491- }
34923495 }
34933496
34943497 void TouchInputMapper::resolveCalibration() {
--- a/services/java/com/android/server/input/InputManagerService.java
+++ b/services/java/com/android/server/input/InputManagerService.java
@@ -51,6 +51,7 @@ import android.hardware.input.KeyboardLayout;
5151 import android.os.Binder;
5252 import android.os.Bundle;
5353 import android.os.Environment;
54+import android.os.FileObserver;
5455 import android.os.Handler;
5556 import android.os.IBinder;
5657 import android.os.Looper;
@@ -241,6 +242,19 @@ public class InputManagerService extends IInputManager.Stub
241242 /** Whether to use the dev/input/event or uevent subsystem for the audio jack. */
242243 final boolean mUseDevInputEventForAudioJack;
243244
245+ private class TscalObserver extends FileObserver {
246+ public TscalObserver() {
247+ super("/data/misc/tscal/pointercal", CLOSE_WRITE);
248+ }
249+
250+ @Override
251+ public void onEvent(int event, String path) {
252+ Slog.i(TAG, "detect pointercal changed");
253+ reloadDeviceAliases();
254+ }
255+ }
256+ private final TscalObserver mTscalObserver = new TscalObserver();
257+
244258 public InputManagerService(Context context, Handler handler) {
245259 this.mContext = context;
246260 this.mHandler = new InputManagerHandler(handler.getLooper());
@@ -250,6 +264,7 @@ public class InputManagerService extends IInputManager.Stub
250264 Slog.i(TAG, "Initializing input manager, mUseDevInputEventForAudioJack="
251265 + mUseDevInputEventForAudioJack);
252266 mPtr = nativeInit(this, mContext, mHandler.getLooper().getQueue());
267+ mTscalObserver.startWatching();
253268 }
254269
255270 public void setWindowManagerCallbacks(WindowManagerCallbacks callbacks) {