Hi, thanks for the reply, i added the patches manually as they were in
the patch code because the didn't apply clean. and i also checked if
the needed .so were in /system/lib and yes, all the files that
appeared in the error at logcat were in the SD card.




this was the patch for InputReader.h:

--- a/services/input/InputReader.h
+++ b/services/input/InputReader.h
@@ -1134,6 +1134,9 @@ protected:
                 *outSize += sizeBias;
             }
         }
+
+        // 5-point calibration parameters
+        int fiveCal[7];
     } mCalibration;

     // Raw pointer axis information from the driver.



And this is how i applied the patch on the file at the code segment
that as it was in the patch in class TouchInputMapper : public
InputMapper { :


        PressureCalibration pressureCalibration;
        bool havePressureScale;
        float pressureScale;

        // Orientation
        enum OrientationCalibration {
            ORIENTATION_CALIBRATION_DEFAULT,
            ORIENTATION_CALIBRATION_NONE,
            ORIENTATION_CALIBRATION_INTERPOLATED,
            ORIENTATION_CALIBRATION_VECTOR,
        };

        OrientationCalibration orientationCalibration;

        // Distance
        enum DistanceCalibration {
            DISTANCE_CALIBRATION_DEFAULT,
            DISTANCE_CALIBRATION_NONE,
            DISTANCE_CALIBRATION_SCALED,
        };

        DistanceCalibration distanceCalibration;
        bool haveDistanceScale;
        float distanceScale;

        inline void applySizeScaleAndBias(float* outSize) const {
            if (haveSizeScale) {
                *outSize *= sizeScale;
            }
            if (haveSizeBias) {
                *outSize += sizeBias;
            }
        }

        // 5-point calibration parameters
        int fiveCal[7];
    } mCalibration;

    // Raw pointer axis information from the driver.
    RawPointerAxes mRawPointerAxes;

    // Raw pointer sample data.
    RawPointerData mCurrentRawPointerData;
    RawPointerData mLastRawPointerData;

    // Cooked pointer sample data.
    CookedPointerData mCurrentCookedPointerData;
    CookedPointerData mLastCookedPointerData;





This was the patch for InputReader.cpp:



--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -3121,6 +3121,16 @@ void TouchInputMapper::parseCalibration() {

     out.haveDistanceScale =
in.tryGetProperty(String8("touch.distance.scale"),
             out.distanceScale);
+
+    // Get 5-point calibration parameters
+    FILE *file = fopen("/data/system/tslib/pointercal", "r");
+    int *p = out.fiveCal;
+    if (file) {
+        fscanf(file, "%d %d %d %d %d %d %d", &p[0], &p[1], &p[2],
&p[3], &p[4], &p[5], &p[6]);
+        fclose(file);
+    } else {
+        p[6] = 0;
+    }
 }

 void TouchInputMapper::resolveCalibration() {
@@ -3854,33 +3864,47 @@ void TouchInputMapper::cookPointerData() {
             distance = 0;
         }

+        float x_temp = float(in.x - mRawPointerAxes.x.minValue);
+        float y_temp = float(in.y - mRawPointerAxes.y.minValue);
+        float x_cal, y_cal;
+        int *p = mCalibration.fiveCal;
+        if (p[6]) {
+            // Apply 5-point calibration algorithm
+            x_cal = (x_temp * p[0] + y_temp * p[1] + p[2] ) / p[6];
+            y_cal = (x_temp * p[3] + y_temp * p[4] + p[5] ) / p[6];
+            LOGV("5cal: x_temp=%f y_temp=%f x_cal=%f y_cal=%f",
x_temp, y_temp, x_cal, y_cal);
+        } else {
+            x_cal = x_temp * mXScale;
+            y_cal = y_temp * mYScale;
+        }
+
         // X and Y
         // Adjust coords for surface orientation.
         float x, y;
         switch (mSurfaceOrientation) {
         case DISPLAY_ORIENTATION_90:
-            x = float(in.y - mRawPointerAxes.y.minValue) * mYScale;
-            y = float(mRawPointerAxes.x.maxValue - in.x) * mXScale;
+            x = y_cal;
+            y = mSurfaceWidth - x_cal;
             orientation -= M_PI_2;
             if (orientation < - M_PI_2) {
                 orientation += M_PI;
             }
             break;
         case DISPLAY_ORIENTATION_180:
-            x = float(mRawPointerAxes.x.maxValue - in.x) * mXScale;
-            y = float(mRawPointerAxes.y.maxValue - in.y) * mYScale;
+            x = mSurfaceWidth - x_cal;
+            y = mSurfaceHeight - y_cal;
             break;
         case DISPLAY_ORIENTATION_270:
-            x = float(mRawPointerAxes.y.maxValue - in.y) * mYScale;
-            y = float(in.x - mRawPointerAxes.x.minValue) * mXScale;
+            x = mSurfaceHeight - y_cal;
+            y = x_cal;
             orientation += M_PI_2;
             if (orientation > M_PI_2) {
                 orientation -= M_PI;
             }
             break;
         default:
-            x = float(in.x - mRawPointerAxes.x.minValue) * mXScale;
-            y = float(in.y - mRawPointerAxes.y.minValue) * mYScale;
+            x = x_cal;
+            y = y_cal;
             break;
         }






And this is how i applied the patch:

-> for void TouchInputMapper::parseCalibration() {:



    // Distance
    out.distanceCalibration =
Calibration::DISTANCE_CALIBRATION_DEFAULT;
    String8 distanceCalibrationString;
    if (in.tryGetProperty(String8("touch.distance.calibration"),
distanceCalibrationString)) {
        if (distanceCalibrationString == "none") {
            out.distanceCalibration =
Calibration::DISTANCE_CALIBRATION_NONE;
        } else if (distanceCalibrationString == "scaled") {
            out.distanceCalibration =
Calibration::DISTANCE_CALIBRATION_SCALED;
        } else if (distanceCalibrationString != "default") {
            ALOGW("Invalid value for touch.distance.calibration:
'%s'",
                    distanceCalibrationString.string());
        }
    }

    out.haveDistanceScale =
in.tryGetProperty(String8("touch.distance.scale"),
            out.distanceScale);

    // Get 5-point calibration parameters
    FILE *file = fopen("/data/system/tslib/pointercal", "r");
    int *p = out.fiveCal;
    if (file) {
        fscanf(file, "%d %d %d %d %d %d %d", &p[0], &p[1], &p[2],
&p[3], &p[4], &p[5], &p[6]);
        fclose(file);
    } else {
        p[6] = 0;
    }
}

void TouchInputMapper::resolveCalibration() {
    // Size
    if (mRawPointerAxes.touchMajor.valid ||
mRawPointerAxes.toolMajor.valid) {
        if (mCalibration.sizeCalibration ==
Calibration::SIZE_CALIBRATION_DEFAULT) {
            mCalibration.sizeCalibration =
Calibration::SIZE_CALIBRATION_GEOMETRIC;
        }
    } else {
        mCalibration.sizeCalibration =
Calibration::SIZE_CALIBRATION_NONE;
    }








-> at  void TouchInputMapper::cookPointerData() {:


     // Distance
        float distance;
        switch (mCalibration.distanceCalibration) {
        case Calibration::DISTANCE_CALIBRATION_SCALED:
            distance = in.distance * mDistanceScale;
            break;
        default:
            distance = 0;
        }

        float x_temp = float(in.x - mRawPointerAxes.x.minValue);
        float y_temp = float(in.y - mRawPointerAxes.y.minValue);
        float x_cal, y_cal;
        int *p = mCalibration.fiveCal;
        if (p[6]) {
            // Apply 5-point calibration algorithm
            x_cal = (x_temp * p[0] + y_temp * p[1] + p[2] ) / p[6];
            y_cal = (x_temp * p[3] + y_temp * p[4] + p[5] ) / p[6];
            LOGV("5cal: x_temp=%f y_temp=%f x_cal=%f y_cal=%f",
x_temp, y_temp, x_cal, y_cal);
        } else {
            x_cal = x_temp * mXScale;
            y_cal = y_temp * mYScale;
        }


        // X and Y
        // Adjust coords for surface orientation.
        float x, y;
        switch (mSurfaceOrientation) {
        case DISPLAY_ORIENTATION_90:

            x = y_cal;
            y = mSurfaceWidth - x_cal;

            orientation -= M_PI_2;
            if (orientation < - M_PI_2) {
                orientation += M_PI;
            }
            break;
        case DISPLAY_ORIENTATION_180:

            x = mSurfaceWidth - x_cal;
            y = mSurfaceHeight - y_cal;

            break;
        case DISPLAY_ORIENTATION_270:

            x = mSurfaceHeight - y_cal;
            y = x_cal;

            orientation += M_PI_2;
            if (orientation > M_PI_2) {
                orientation -= M_PI;
            }
            break;
        default:

            x = x_cal;
            y = y_cal;

            break;
        }

        // Write output coords.
        PointerCoords& out =
mCurrentCookedPointerData.pointerCoords[i];
        out.clear();
        out.setAxisValue(AMOTION_EVENT_AXIS_X, x);
        out.setAxisValue(AMOTION_EVENT_AXIS_Y, y);
        out.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pressure);






 Best regards.





On 18 abr, 02:03, Alvin Wong <[email protected]> wrote:
> Hi there,
>
> Can you provide more information, like how you've patched the files?
> And had you done a CLEAN build after the patch?
>
> Regards,
> Alvin Wong
>
> On 4月18日, 上午12時07分, olivia mckenzy <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi, i have been trying to port tslib to Android ICS and i found a
> > patch, so i applied it on InputReader.h and InputReader.cpp, after
> > that i make a build, and flash the SD card to run on Pandaboard, the
> > O.S. crashes, and it only shows the boot logo, this is what i get
> > through the serial port (it is shown continuously):
>
> > [   30.904541] request_suspend_state: wakeup (0->0) at 30899322512
> > (1970-01-02 00:00:06.500244140 UTC)
> > [   30.921997] init: untracked pid 178 exited
> > [   30.929565] init: untracked pid 179 exited
> > ls
>
> > and this is what i get through logcat (on the serial port of
> > Pandaboard):
>
> > D/dalvikvm(   98): GC_EXPLICIT freed 14K, 2% free 6453K/6531K, paused
> > 0ms+3ms
> > D/dalvikvm(   98): GC_EXPLICIT freed 6K, 2% free 6447K/6531K, paused
> > 0ms+0ms
> > D/dalvikvm(   98): GC_EXPLICIT freed <1K, 2% free 6447K/6531K, paused
> > 1ms+0ms
> > I/dalvikvm(   98): System server process 165 has been created
> > I/Zygote  (   98): Accepting command socket connections
> > D/SystemClock(  165): Setting time of day to sec=86400
> > W/SystemServer(  165): System clock is before 1970; setting to 1970.
> > D/AndroidRuntime(  165): Shutting down VM
> > W/dalvikvm(  165): threadid=1: thread exiting with uncaught exception
> > (group=0x40a051f8)
> > E/AndroidRuntime(  165): *** FATAL EXCEPTION IN SYSTEM PROCESS: main
> > E/AndroidRuntime(  165): java.lang.UnsatisfiedLinkError: Cannot load
> > library: link_image[1936]:    98 could not load needed library
> > 'libsystem_server.so' for
> > 'libandroid_servers.so' (link_image[1936]:    98 could not load needed
> > library 'libinput.so' for
> > 'libsystem_server.so' (reloc_library[1285]:    98 cannot locate
> > '_ZN8SkCanvasC1Ev'...
> > E/AndroidRuntime(  165): ))
> > E/AndroidRuntime(  165):        at
> > java.lang.Runtime.loadLibrary(Runtime.java:391)
> > E/AndroidRuntime(  165):        at java.lang.System.loadLibrary(System.java:
> > 535)
> > E/AndroidRuntime(  165):        at
> > com.android.server.SystemServer.main(SystemServer.java:819)
> > E/AndroidRuntime(  165):        at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > E/AndroidRuntime(  165):        at
> > java.lang.reflect.Method.invoke(Method.java:511)
> > E/AndroidRuntime(  165):        at com.android.internal.os.ZygoteInit
> > $MethodAndArgsCaller.run(ZygoteInit.java:784)
> > E/AndroidRuntime(  165):        at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
> > E/AndroidRuntime(  165):        at dalvik.system.NativeStart.main(Native
> > Method)
> > I/Process (  165): Sending signal. PID: 165 SIG: 9
> > E/AndroidRuntime(  165): Error reporting crash
> > E/AndroidRuntime(  165): java.lang.NullPointerException
> > E/AndroidRuntime(  165):        at com.android.internal.os.RuntimeInit
> > $UncaughtHandler.uncaughtException(RuntimeInit.java:72)
> > E/AndroidRuntime(  165):        at
> > java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
> > E/AndroidRuntime(  165):        at
> > java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
> > E/AndroidRuntime(  165):        at dalvik.system.NativeStart.main(Native
> > Method)
> > I/Zygote  (   98): Exit zygote because system server (165) has
> > terminated
> > I/ServiceManager(   91): service 'media.audio_policy' died
> > I/ServiceManager(   91): service 'media.audio_flinger' died
> > I/ServiceManager(   91): service 'media.player' died
> > I/ServiceManager(   91): service 'media.camera' died
> > I/Netd    (  179): Netd 1.0 starting
> > D/AndroidRuntime(  180):
> > D/AndroidRuntime(  180): >>>>>> AndroidRuntime START
> > com.android.internal.os.ZygoteInit <<<<<<
> > D/AndroidRuntime(  180): CheckJNI is ON
> > I/        (  178): ServiceManager: 0xf958
> > I/AudioFlinger(  178): Loaded primary audio interface from Default
> > audio HW HAL (audio)
> > I/AudioFlinger(  178): Using 'Default audio HW HAL' (audio.primary) as
> > the primary audio interface
> > I/CameraService(  178): CameraService started (pid=178)
> > I/AudioFlinger(  178): AudioFlinger's thread 0x107c8 ready to run
> > W/AudioFlinger(  178): Thread AudioOut_1 cannot connect to the power
> > manager service
> > W/AudioFlinger(  178): Thread AudioOut_1 cannot connect to the power
> > manager service
> > I/AudioPolicyService(  178): Loaded audio policy from LEGACY Audio
> > Policy HAL (audio_policy)
> > I/ethernet(  180): Loading ethernet jni class
> > I/SamplingProfilerIntegration(  180): Profiling disabled.
> > I/Zygote  (  180): Preloading classes...
> > D/dalvikvm(  180): GC_EXPLICIT freed 36K, 84% free 409K/2560K, paused
> > 1ms+6ms
> > D/dalvikvm(  180): GC_EXPLICIT freed 4K, 82% free 474K/2560K, paused
> > 8ms+0ms
>
> > if someone could help me, it would be really great. Thanks in advanced.

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to