View Single Post
Old 08-30-2019, 04:30 PM   #1
davisrs
Junior Member
davisrs doesn't litterdavisrs doesn't litterdavisrs doesn't litter
 
Posts: 5
Karma: 228
Join Date: Nov 2017
Device: Kindle Touch
Question Help: VNC touchscreen input



I have a jailbroken Kindle Touch onto which I've downloaded hawhill's Kindle VNC viewer (native app, GPLv2). I've managed to get most things working but I'm unable to get touchscreen input to be detected when the app is running.

My lua config script does detect when I push the home button and exit the app as intended, but nothing is happening if I tap the touchscreen.

However if I run evtest on the kindle, I can see that there are touch events being generated. I imagine there must be a typo in my config file but I'm not familiar with Lua. I've tried everything I can think of and would really appreciate help fixing this bug.

On Linux (raspberry pi 3) I run the following in the terminal:
Code:
sudo ifconfig usb0 192.168.15.2
x11vnc -clip 800x600+0+0 -usepw &
ssh root@kindletouch-usb0
On kindle I run:
Code:
stop lab126_gui
cd /mnt/us/extensions/kvncviewer/
lipc-get-prop com.lab126.powerd preventScreenSaver
lipc-set-prop com.lab126.powerd preventScreenSaver 1
./luajit vncviewer.lua -password <PASSWORD> -config config_touch_v2.lua -rotateFB270 -waitRefresh 40 -refreshFullAfterPixels 5 -dither_bw -medium 192.168.15.2:1
start lab126_gui
lipc-set-prop com.lab126.powerd preventScreenSaver 0
Content of my config.lua file (config_touch_v2.lua):
Code:
require "keys"
require "rfbkeys"

-- comment out the following line on a KDX
set_k3_keycodes()


-- variables client_width and client_height will be available when handleInput() is called
client_width = 0
client_height = 0

--[[
   you have also the following API functions:

   Quit( [status] )
      will quit the application. optional: return code (must be positive)

   SendKeyEvent( keyCode, pressed )
      sends a key event to the rfb server. "pressed" is a bool value
      telling whether the key was pressed (true) or released (false)

   SendPointerEvent( x, y, buttonMask )
      sends a pointer event to the rfb server
]]--


-- globals for remembering key state
shift = false
sym = false

--touchscreen
clickevent = 0
x, y = 0, 0

-- this handler will be called upon key presses (input events, actually)
function handleInput(channel, itype, code, value)
   print("input:", "ch=", channel, "itype=", itype, "code=", code, "value=", value)
   --touch
   if itype == 1 then
      if code == 102 then
	 print("pushed menu button")
	 Quit()
      end
   elseif itype == 3 then
      if code == 57 then
	 print("MT Tracking ID", value)
	 clickevent = value + 1
	 if x and y then
	    SendPointerEvent(x, y, 0)
	 end
      elseif code == 53 then
	 print("MT X", value)
	 x = value
      elseif code == 54 then
	 print("MT Y", value)
	 y = value
	 if clickevent == 1 then
	    SendPointerEvent(x, y, 1)
	 end
      end
   end
end
evtest results on kindle:
Code:
[root@kindle kvncviewer]# stop lab126_gui
[root@kindle kvncviewer]# evtest /dev/input/event3 
Input driver version is 1.0.0
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "zforce"
Supported events:
  Event type 0 (Sync)
  Event type 1 (Key)
    Event code 0 (Reserved)
    Event code 1 (Esc)
    Event code 325 (ToolFinger)
    Event code 330 (Touch)
    Event code 333 (Tool Doubletap)
    Event code 334 (Tool Tripletap)
  Event type 3 (Absolute)
    Event code 0 (X)
      Value      0
      Min        0
      Max     4095
    Event code 1 (Y)
      Value      0
      Min        0
      Max     4095
    Event code 47 (MT Slot)
      Value      0
      Min        0
      Max        1
    Event code 53 (MT X)
      Value      0
      Min        0
      Max     4095
    Event code 54 (MT Y)
      Value      0
      Min        0
      Max     4095
    Event code 57 (MT Tracking ID)
      Value      0
      Min        0
      Max      255
Event: time 1428263857.131751, type 3 (Absolute), code 57 (MT Tracking ID), value 0
Event: time 1428263857.131814, type 3 (Absolute), code 53 (MT X), value 1805
Event: time 1428263857.131828, type 3 (Absolute), code 54 (MT Y), value 2089
Event: time 1428263857.132372, type 1 (Key), code 330 (Touch), value 1
Event: time 1428263857.132384, type 1 (Key), code 325 (ToolFinger), value 1
Event: time 1428263857.132401, -------------- Report Sync ------------
Event: time 1428263857.147612, type 3 (Absolute), code 57 (MT Tracking ID), value -1
Event: time 1428263857.148175, type 1 (Key), code 330 (Touch), value 0
Event: time 1428263857.148187, type 1 (Key), code 325 (ToolFinger), value 0
Event: time 1428263857.148199, -------------- Report Sync ------------
davisrs is offline   Reply With Quote