Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-30-2019, 05: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
Old 08-30-2019, 07:27 PM   #2
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,497
Karma: 26047188
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Never played with this myself, but a quick look at the code shows something obvious: event3 is never probed.
NiLuJe is offline   Reply With Quote
Advert
Old 08-31-2019, 07:13 PM   #3
Emilis
Junior Member
Emilis began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2019
Device: KT, PPW3
Hi, I got my kindle ppw 3 touch screen working with kvncviewer.

Content of my config.lua file

Code:
require "keys"
require "rfbkeys"

set_k3_keycodes()


client_width = 0
client_height = 0


-- globals for remembering key state
shift = false
sym = false
myx = 0
myy = 0


-- this handler will be called upon key presses (input events, actually)
function handleInput(channel, itype, code, value)
        if itype == 3 and code == 53 then myx = value end
        if itype == 3 and code == 54 then
                myy = value
                SendPointerEvent(myx, myy, 0)
        end
        if itype == 3 and code == 57 and value == -1 then
                SendPointerEvent(myx, myy, 1)
                SendPointerEvent(myx, myy, 0)
        end
end
Sorrry for mess in code. I'm a bit lazy.
Emilis is offline   Reply With Quote
Old 09-01-2019, 04:11 PM   #4
Emilis
Junior Member
Emilis began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Aug 2019
Device: KT, PPW3
Btw given config.lua was written by looking into this example.

Accidentally I found that touch input was already done in this post.
Emilis is offline   Reply With Quote
Old 09-03-2019, 07:11 PM   #5
davisrs
Junior Member
davisrs doesn't litterdavisrs doesn't litterdavisrs doesn't litter
 
Posts: 5
Karma: 228
Join Date: Nov 2017
Device: Kindle Touch


NiLuJe... You are a genius! That fixed it!
Thank you so much.


In case anyone else has the same problem running this on a kindle touch, here is how to fix it:
Open vncviewer.lua in a text editor and go to line 282
Code:
try_open_input("/dev/input/event0")
try_open_input("/dev/input/event1")
try_open_input("/dev/input/event2")
edit that section by adding:
Code:
try_open_input("/dev/input/event3")
After that was fixed, the other issue I ran into was that all my touch controls were rotated by 270 degrees and scaled to the wrong resolution. I fixed it by editing config.lua:

Code:
-- 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)
	 y = math.floor(value*600/4095)
      elseif code == 54 then
	 x = 800 - math.floor(value*800/4095)
	 print("MT Y", value)
	 if clickevent == 1 then
	    SendPointerEvent(x, y, 1)
	 end
      end
   end
end
Emilis, thank you for sharing your configuration. As it turns out, I had already seen inedible's post, but it hadn't ever work for me (until I edited vncviewer.lua). Since you have successfully used the software in the past, I do have a quick question for you and the community:

The only way I've been able to get a decent refresh rate is to use the '-dither_bw' option. This lets me get a great refresh rate (I can even watch youtube videos on a kindle now) but it comes at the cost of each individual frame looking uglier. Have you had good results without needing to use this option?
davisrs is offline   Reply With Quote
Advert
Reply

Tags
evtest, kindle touch, lua, touchsceen, vnc


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Conversion Input] KePub Input jgoguen Plugins 23 05-17-2020 04:01 PM
[Conversion Input] Microsoft Doc Input Plugin igi Plugins 76 06-28-2019 05:47 AM
Nook 1st Ed using touchscreen as mouse? (for android apps, VNC) ninja_250cc Barnes & Noble NOOK 0 05-08-2016 12:53 AM
REQ: input on Database Structure and testing a workaround input jecilop Library Management 15 12-17-2015 01:10 AM
[Input Plugin] DOCX Input SauliusP. Plugins 42 06-05-2013 05:01 AM


All times are GMT -4. The time now is 01:03 PM.


MobileRead.com is a privately owned, operated and funded community.