OnePlusOSS / android_kernel_oneplus_msm8996

Other
146 stars 150 forks source link

Oneplus 3T: Please fix broken off screen gestures #21

Open dustin84 opened 7 years ago

qwtaming commented 7 years ago

1st you must open the gestures BLACK_ENBALE_PATH = "/proc/touchpanel/gesture_enable"; FileUtils.writeIntLine(BLACK_ENBALE_PATH, mBlackKeySettingState); the every bit is for each function: mDoubleScreenOn = getOffset(mBlackKeySettingState, 7) == 1; mStartCamera = getOffset(mBlackKeySettingState, 6) == 1; mMusic_control = getOffset(mBlackKeySettingState, 5) == 1; mMusic_prev = getOffset(mBlackKeySettingState, 4) == 1; mMusic_next = getOffset(mBlackKeySettingState, 3) == 1; mMusic_pause = getOffset(mBlackKeySettingState, 2) == 1; mMusic_play = getOffset(mBlackKeySettingState, 1) == 1; mStartFlash = getOffset(mBlackKeySettingState, 0) == 1; 2sec you need too register listen keyevent process

define KEY_DOUBLE_TAP 249 // double tap to wake

define KEY_GESTURE_CIRCLE 250 // draw circle to lunch camera

define KEY_GESTURE_TWO_SWIPE 251 // swipe two finger vertically to play/pause

define KEY_GESTURE_V 252 // draw v to toggle flashlight

define KEY_GESTURE_LEFT_V 253 // draw left arrow for previous track

define KEY_GESTURE_RIGHT_V 254 // draw right arrow for next track

dustin84 commented 7 years ago

No. I'm not jumping through hoops that may or may not work. I have tried something similar and it didn't work. The code is broken and needs to be fixed. If devs on XDA can fix it, I don't see why OP can't.

qwtaming commented 7 years ago

OP offer two methodes open gesture. First u can open gesture by default in file kernel/msm-4.4/drivers/input/touchscreen/synaptics_driver_s3320.c .Second u can add the switch into the setting. OP use the second. u can banding which app too open,example v open flashlight or other app. so OP no too banding whith it. It‘s easy to change and use it.

dustin84 commented 7 years ago

You can change any file you want or add it to the settings, but they won't work with a broken kernel. And the kernel is broken because the source is broken.

qwtaming commented 7 years ago

The kernel is ok. Beforce release have test.I think you problem is no enable the gestrure.

dustin84 commented 7 years ago

It's broken. If you don't believe me go find any dev on XDA and ask them if it's broken. They will tell you it is. Or build it from source yourself, flash it to 3.5.3 or 3.5.4, and see for yourself.

brucechiu1113 commented 7 years ago

@dustin84 Dev's solution for this issue is: http://pastebin.com/0Enek94f , right? If so, we could look into it for detailed information.

dustin84 commented 7 years ago

Yes, I think that is the same fix as this: https://github.com/engstk/op3t/commit/1f8a6d00b9371d6aa1c445996e9d9f216f6cbcfb The one I linked is the one I cherry-picked to fix it but I believe they are the same.

amartinz commented 7 years ago

Edit: scratch that, key handler uses scan code, overlooked that. still somehow it does not fully like to work.

My fault was, it checked if CM setup wizard completed but i do not ship it...


on my device, i get the proper scan code, but it should get it as key code instead.

oneplus3:/ # getevent -l                                                   
add device 1: /dev/input/event7
  name:     "msm8996-tasha-mtp-snd-card Button Jack"
add device 2: /dev/input/event6
  name:     "msm8996-tasha-mtp-snd-card Headset Jack"
add device 3: /dev/input/event2
  name:     "fpc1020"
add device 4: /dev/input/event0
  name:     "qpnp_pon"
could not get driver version for /dev/input/mice, Not a typewriter
add device 5: /dev/input/event1
  name:     "tri-state-key"
add device 6: /dev/input/event4
  name:     "gpio-keys"
add device 7: /dev/input/event5
  name:     "synaptics"
add device 8: /dev/input/event3
  name:     "synaptics,s3320"
/dev/input/event3: EV_SYN       0004                 00000072            
/dev/input/event3: EV_SYN       0005                 0dcad92e            
/dev/input/event3: EV_SYN       SYN_REPORT           00000000            
/dev/input/event3: EV_KEY       00fc                 DOWN                
/dev/input/event3: EV_SYN       SYN_REPORT           00000000            
/dev/input/event3: EV_KEY       00fc                 UP                  
/dev/input/event3: EV_SYN       SYN_REPORT           00000000 

i did the (V) gesture, 0xFC -> 252

but the key handler at CM / Lineage based roms expects a key code, which in this case is then 0x00 :(

12-30 21:23:50.130  1278  1601 D InputDispatcher: notifyKey - eventTime=217835621000, deviceId=8, source=0x101, policyFlags=0x2, action=0x0, flags=0x8, keyCode=0x0, scanCode=0xfc, metaState=0x0, downTime=217835621000
12-30 21:23:50.135  1278  1600 D InputDispatcher: dispatchKey - eventTime=217835621000, deviceId=8, source=0x101, policyFlags=0x2000002, action=0x0, flags=0x48, keyCode=0x0, scanCode=0xfc, metaState=0x0, repeatCount=0, downTime=217835621000
12-30 21:23:50.135  1278  1601 D InputDispatcher: notifyKey - eventTime=217835652000, deviceId=8, source=0x101, policyFlags=0x2, action=0x1, flags=0x8, keyCode=0x0, scanCode=0xfc, metaState=0x0, downTime=217835621000
12-30 21:23:50.135  1278  1600 D InputDispatcher: Dropped event because policy consumed it.
12-30 21:23:50.137  1278  1600 D InputDispatcher: dispatchKey - eventTime=217835652000, deviceId=8, source=0x101, policyFlags=0x2000002, action=0x1, flags=0x48, keyCode=0x0, scanCode=0xfc, metaState=0x0, repeatCount=0, downTime=217835621000
12-30 21:23:50.137  1278  1600 D InputDispatcher: Dropped event because policy consumed it.

so i created a custom key layout for the synaptics driver synaptics_s3320.kl which goes into /system/usr/keylayout/

key 250   TV_INPUT_COMPONENT_2 VIRTUAL
key 251   TV_INPUT_VGA_1 VIRTUAL
key 252   TV_AUDIO_DESCRIPTION VIRTUAL
key 253   TV_AUDIO_DESCRIPTION_MIX_UP VIRTUAL
key 254   TV_AUDIO_DESCRIPTION_MIX_DOWN VIRTUAL

These key codes map to 250, 251 ... and so on.


Using that, it allows to detect those keys. I get the haptic feedback vibration BUT it does not do anything else

adb shell dumpsys input

...

  Device 7: synaptics
    Generation: 6
    IsExternal: false
    HasMic:     false
    Sources: 0x00000101
    KeyboardType: 1
    Keyboard Input Mapper:
      Parameters:
        HasAssociatedDisplay: true
        OrientationAware: true
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 0
  Device 8: synaptics,s3320
    Generation: 20
    IsExternal: false
    HasMic:     false
    Sources: 0x00001103
    KeyboardType: 1
    Motion Ranges:
      X: source=0x00001002, min=0.000, max=1079.000, flat=0.000, fuzz=0.000, resolution=0.000
      Y: source=0x00001002, min=0.000, max=1919.000, flat=0.000, fuzz=0.000, resolution=0.000
      PRESSURE: source=0x00001002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000
      SIZE: source=0x00001002, min=0.000, max=1.000, flat=0.000, fuzz=0.000, resolution=0.000
      TOUCH_MAJOR: source=0x00001002, min=0.000, max=2202.907, flat=0.000, fuzz=0.000, resolution=0.000
      TOUCH_MINOR: source=0x00001002, min=0.000, max=2202.907, flat=0.000, fuzz=0.000, resolution=0.000
      TOOL_MAJOR: source=0x00001002, min=0.000, max=2202.907, flat=0.000, fuzz=0.000, resolution=0.000
      TOOL_MINOR: source=0x00001002, min=0.000, max=2202.907, flat=0.000, fuzz=0.000, resolution=0.000
    Keyboard Input Mapper:
      Parameters:
        HasAssociatedDisplay: true
        OrientationAware: true
        HandlesKeyRepeat: false
      KeyboardType: 1
      Orientation: 0
      KeyDowns: 0 keys currently down
      MetaState: 0x0
      DownTime: 217835621000
    Touch Input Mapper:
      Parameters:
        GestureMode: multi-touch
        DeviceType: touchScreen
        AssociatedDisplay: hasAssociatedDisplay=true, isExternal=false
        OrientationAware: true
      Raw Touch Axes:
        X: min=0, max=1079, flat=0, fuzz=0, resolution=0
        Y: min=0, max=1919, flat=0, fuzz=0, resolution=0
        Pressure: unknown range
        TouchMajor: min=0, max=255, flat=0, fuzz=0, resolution=0
        TouchMinor: min=0, max=255, flat=0, fuzz=0, resolution=0
        ToolMajor: unknown range
        ToolMinor: unknown range
        Orientation: unknown range
        Distance: unknown range
        TiltX: unknown range
        TiltY: unknown range
        TrackingId: min=0, max=65535, flat=0, fuzz=0, resolution=0
        Slot: min=0, max=9, flat=0, fuzz=0, resolution=0
      Calibration:
        touch.size.calibration: geometric
        touch.pressure.calibration: none
        touch.orientation.calibration: none
        touch.distance.calibration: none
        touch.coverage.calibration: none
      Affine Transformation:
        X scale: 1.000
        X ymix: 0.000
        X offset: 0.000
        Y xmix: 0.000
        Y scale: 1.000
        Y offset: 0.000
      Viewport: displayId=0, orientation=0, logicalFrame=[0, 0, 1080, 1920], physicalFrame=[0, 0, 1080, 1920], deviceSize=[1080, 1920]
      SurfaceWidth: 1080px
      SurfaceHeight: 1920px
      SurfaceLeft: 0
      SurfaceTop: 0
      SurfaceOrientation: 0
      Translation and Scaling Factors:
        XTranslate: 0.000
        YTranslate: 0.000
        XScale: 1.000
        YScale: 1.000
        XPrecision: 1.000
        YPrecision: 1.000
        GeometricScale: 1.000
        PressureScale: 0.000
        SizeScale: 0.004
        OrientationScale: 0.000
        DistanceScale: 0.000
        HaveTilt: false
        TiltXCenter: 0.000
        TiltXScale: 0.000
        TiltYCenter: 0.000
        TiltYScale: 0.000
      Last Raw Button State: 0x00000000
      Last Raw Touch: pointerCount=0
      Last Cooked Button State: 0x00000000
      Last Cooked Touch: pointerCount=0
      Stylus Fusion:
        ExternalStylusConnected: false
        External Stylus ID: -1
        External Stylus Data Timeout: 9223372036854775807
      External Stylus State:
        When: 9223372036854775807
        Pressure: 0.000000
        Button State: 0x00000000
        Tool Type: 0
  Configuration:
    ExcludedDeviceNames: []
    VirtualKeyQuietTime: 0.0ms
    PointerVelocityControlParameters: scale=1.000, lowThreshold=500.000, highThreshold=3000.000, acceleration=3.000
    WheelVelocityControlParameters: scale=1.000, lowThreshold=15.000, highThreshold=50.000, acceleration=4.000
    PointerGesture:
      Enabled: true
      QuietInterval: 100.0ms
      DragMinSwitchSpeed: 50.0px/s
      TapInterval: 150.0ms
      TapDragInterval: 300.0ms
      TapSlop: 20.0px
      MultitouchSettleInterval: 100.0ms
      MultitouchMinDistance: 15.0px
      SwipeTransitionAngleCosine: 0.3
      SwipeMaxWidthRatio: 0.2
      MovementSpeedRatio: 0.8
      ZoomSpeedRatio: 0.3

...

While on another device, using the same zip to install the rom, everything works without doing any changes.

Using the above patches linked here do not show any difference too.

maddalakum commented 7 years ago

Can any one help the how exactly fix this issue

dustin84 commented 7 years ago

@maddalakum I have submitted a pull request. Just look there.

maddalakum commented 7 years ago

Can you please tell this path didnt exist

/android/kernel/drivers/input/touchscreen/synaptic_s3320.c

dorimanx commented 7 years ago

Try drivers/input/touchscreen/synaptics_driver_s3320.c