Szybet / sanki

small anki app rewritten for e-readers, with focus on InkBox support, written in Qt5 & C++
GNU General Public License v3.0
41 stars 1 forks source link

No touch input on Libra 2 #3

Open BHSPitMonkey opened 11 months ago

BHSPitMonkey commented 11 months ago

This project looks pretty cool! I just tried to run the latest Nickel release on my Kobo Libra 2, and though the main window appears and looks normal, the app doesn't respond to touch inputs. The clock still updates, so I don't think it's a crash/hang.

Szybet commented 11 months ago

Weird, should be working https://github.com/Kobo-InkBox/qt5-kobo-platform-plugin/blob/c4c41a4e6ec631baba31dbd3caf136a9ac284001/src/kobodevicedescriptor.cpp#L179-L186C3

Hmm Try running in a remote shell ( Koreader has a SSH server ) LD_LIBRARY_PATH="/mnt/onboard/.adds/qt-linux-5.15.2-kobo/lib/:/mnt/onboard/.adds/sanki/lib/:/lib/" QT_QPA_PLATFORM="kobo:debug:motiondebug" LC_ALL="en_US" QT_PLUGIN_PATH="/mnt/onboard/.adds/qt-linux-5.15.2-kobo/plugins/" DEBUG=true XDG_CONFIG_HOME="/mnt/onboard/.adds/sanki/" XDG_RUNTIME_DIR="/mnt/onboard/.adds/sanki/" /mnt/onboard/.adds/sanki/sanki.bin

BHSPitMonkey commented 11 months ago

When launched that way, I get the following output:

Debug logs are enabled
Installing custom message handler
Debug: "Sanki started"
Debug: "Motion debug enabled. Debug information for screen and mouse will be printed"
[FBInk] Detected a Kobo Libra 2 (388 => Io @ Mark 9)
[FBInk] Enabled Kobo Mark 7 quirks
[FBInk] Clock tick frequency appears to be 100 Hz
[FBInk] Screen density set to 300 dpi
[FBInk] Variable fb info: 1264x1680, 8bpp @ rotation: 1 (Clockwise, 90°)
[FBInk] Fixed fb info: ID is "mxc_epdc_fb", length of fb mem: 9175040 bytes & line length: 1280 bytes
[FBInk] Canonical rotation: 0 (Upright, 0°)
[FBInk] Fontsize set to 32x32 (IBM (Default) base glyph size: 8x8)
[FBInk] Line length: 39 cols, Page size: 52 rows
[FBInk] Vertical fit isn't perfect, shifting rows down by 8 pixels
[FBInk] Pen colors set to #000000 for the foreground and #FFFFFF for the background
Updating bitdepth from 8bpp to 8bpp
Updating grayscale value from 1 to 1
Updating rotation from 1 (Clockwise, 90°) to 1 (Clockwise, 90°)
Bitdepth is now 8bpp (grayscale: 1) @ rotate: 1 (Clockwise, 90°)
Debug: "Screen info: 1264 1680 rotation: 1 rotation canonical: 0 bpp: 8"
Debug: "Allocated screen buffer. Stride: 1280 buffer size: 9175040"
Debug: "device: "io" 388 
 screen: 1264 1680 dpi: 300"
Warning: "kobofb: Finished initialization." (:0, )
Debug: "Running platform: ereader"
Debug: "Device model detected: "KoboLibra2""
Debug: "Screen size is x: 1264 y: 1680"
Debug: "Applied stylesheet for ereader"
Debug: "App is a Nickel app"
Debug: "Main config path is QDir( "/mnt/onboard/.adds/sanki" , nameFilters = { "*" },  QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( Dirs|Files|Drives|AllEntries ) )"
Debug: "Directory "/mnt/onboard/.adds/sanki" Already exists"
Debug: "Deck storage path is QDir( "/mnt/onboard/.adds/sanki/decks" , nameFilters = { "*" },  QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( Dirs|Files|Drives|AllEntries ) )"
Debug: "Directory "/mnt/onboard/.adds/sanki/decks" Already exists"
Debug: "Session saves path is QDir( "/mnt/onboard/.adds/sanki/sessions" , nameFilters = { "*" },  QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( Dirs|Files|Drives|AllEntries ) )"
Debug: "Directory "/mnt/onboard/.adds/sanki/sessions" Already exists"
Debug: "Setting waveform mode"
Debug: "Reset grid called"
Debug: "Setting ereader sizes for grid item spacer"
Debug: "current row: 0 column: 0"
Debug: "current row: 0 column: 1"
Debug: "current row: 1 column: 0"
Debug: "current row: 1 column: 1"
Debug: "2 2"
waveform_mode is now 0x6 (REAGL)
Debug: "Painted region QRegion(0,0 706x601) in 15 ms"
waveform_mode is now 0x2 (GC16)
Debug: "Painted region QRegion(0,0 1264x1680) in 27 ms"
waveform_mode is now 0x6 (REAGL)
Debug: "Painted region QRegion(664,8 594x52) in 4 ms"

The window appears on the device as expected, still not frozen (clock updates still happen), but this time if I touch the screen the window disappears and I'm back to seeing (and interacting with) Koreader instead. In this state, I'm still getting a partial update from Sanki near the top of the screen when the time changes:

image

but all touch events go to Koreader, and nothing new is output in the terminal where the command is running (except for a few more waveform_mode and Painted region updates).

Szybet commented 11 months ago

Turn off koreader, kill it from the terminal from htop, then launch sanki and touch the screen a few times for logs

Koreader is grabbing the input device for himself :-(

BHSPitMonkey commented 11 months ago

That seems to put me into a similar state as when I launch Sanki from NickelMenu (i.e. Sanki is visible, but touches anywhere on the screen do nothing)

Szybet commented 11 months ago

Well, any logs then?

Szybet commented 11 months ago

Screenshot_20231019-113439_GitHub.png

Try also with these arguments rnabled as true, should give some more logs

BHSPitMonkey commented 11 months ago

After adding QT_QPA_EVDEV_DEBUG=true, I get:

[root@kobo ~]# QT_QPA_EVDEV_DEBUG=true LD_LIBRARY_PATH="/mnt/onboard/.adds/qt-linux-5.15.2-kobo/lib/:/mnt/onboard/.adds/sanki/lib/:/lib/" QT_QPA_PLATFORM="kobo:debug
:motiondebug" LC_ALL="en_US" QT_PLUGIN_PATH="/mnt/onboard/.adds/qt-linux-5.15.2-kobo/plugins/" DEBUG=true XDG_CONFIG_HOME="/mnt/onboard/.adds/sanki/" XDG_RUNTIME_DIR
="/mnt/onboard/.adds/sanki/" /mnt/onboard/.adds/sanki/sanki.bin
Debug logs are enabled
Installing custom message handler
Debug: "Sanki started"
Debug: "Motion debug enabled. Debug information for screen and mouse will be printed"
[FBInk] Detected a Kobo Libra 2 (388 => Io @ Mark 9)
[FBInk] Enabled Kobo Mark 7 quirks
[FBInk] Clock tick frequency appears to be 100 Hz
[FBInk] Screen density set to 300 dpi
[FBInk] Variable fb info: 1264x1680, 8bpp @ rotation: 1 (Clockwise, 90°)
[FBInk] Fixed fb info: ID is "mxc_epdc_fb", length of fb mem: 9175040 bytes & line length: 1280 bytes
[FBInk] Canonical rotation: 0 (Upright, 0°)
[FBInk] Fontsize set to 32x32 (IBM (Default) base glyph size: 8x8)
[FBInk] Line length: 39 cols, Page size: 52 rows
[FBInk] Vertical fit isn't perfect, shifting rows down by 8 pixels
[FBInk] Pen colors set to #000000 for the foreground and #FFFFFF for the background
Updating bitdepth from 8bpp to 8bpp
Updating grayscale value from 1 to 1
Updating rotation from 1 (Clockwise, 90°) to 1 (Clockwise, 90°)
Bitdepth is now 8bpp (grayscale: 1) @ rotate: 1 (Clockwise, 90°)
Debug: "Screen info: 1264 1680 rotation: 1 rotation canonical: 0 bpp: 8"
Debug: "Allocated screen buffer. Stride: 1280 buffer size: 9175040"
Debug: "evdevtouch: Adding device at /dev/input/event1"
Debug: "device: "io" 388 
 screen: 1264 1680 dpi: 300"
Warning: "kobofb: Finished initialization." (:0, )
Debug: ""swapxy:hw_range_x_max=1680:hw_range_y_max=1264:screenwidth=1264:screenheight=1680:screenrotation=0""
Debug: "evdevtouch: Using device /dev/input/event1"
Debug: "evdevtouch: /dev/input/event1: Protocol type A (single), filtered=no"
Debug: "evdevtouch: /dev/input/event1: min X: -2147483648 max X: 2147483647"
Debug: "evdevtouch: overwriting touch x max: 1680"
Debug: "evdevtouch: /dev/input/event1: min Y: -2147483648 max Y: 2147483647"
Debug: "evdevtouch: overwriting touch y max: 1264"
Debug: "evdevtouch: /dev/input/event1: min pressure: 0 max pressure: 0"
Debug: "evdevtouch: /dev/input/event1: device name: kx122-accel"
Debug: "Running platform: ereader"
Debug: "Device model detected: "KoboLibra2""
Debug: "Screen size is x: 1264 y: 1680"
Debug: "Applied stylesheet for ereader"
Debug: "App is a Nickel app"
Debug: "Main config path is QDir( "/mnt/onboard/.adds/sanki" , nameFilters = { "*" },  QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( Dirs|Files|Drives|AllEntries ) )"
Debug: "Directory "/mnt/onboard/.adds/sanki" Already exists"
Debug: "Deck storage path is QDir( "/mnt/onboard/.adds/sanki/decks" , nameFilters = { "*" },  QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( Dirs|Files|Drives|AllEntries ) )"
Debug: "Directory "/mnt/onboard/.adds/sanki/decks" Already exists"
Debug: "Session saves path is QDir( "/mnt/onboard/.adds/sanki/sessions" , nameFilters = { "*" },  QDir::SortFlags( Name | IgnoreCase ) , QDir::Filters( Dirs|Files|Drives|AllEntries ) )"
Debug: "Directory "/mnt/onboard/.adds/sanki/sessions" Already exists"
Debug: "Setting waveform mode"
Debug: "Reset grid called"
Debug: "evdevtouch: Updating QInputDeviceManager device count: 1 touch devices, 0 pending handler(s)"
Debug: "Setting ereader sizes for grid item spacer"
Debug: "current row: 0 column: 0"
Debug: "current row: 0 column: 1"
Debug: "current row: 1 column: 0"
Debug: "current row: 1 column: 1"
Debug: "2 2"
waveform_mode is now 0x6 (REAGL)
Debug: "Painted region QRegion(0,0 706x601) in 15 ms"
waveform_mode is now 0x2 (GC16)
Debug: "Painted region QRegion(0,0 1264x1680) in 31 ms"

But still no further output when touching.

With the addition of QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/event0:rotate=0 (instead of event1), I actually start getting output when touching the screen, and I'm even able to interact with the UI a bit -- but I can't reliably make the selections I'm trying to make.

Here's some samples:

Touching near the top-left:

Debug: "Contact state: Qt::TouchPointReleased"
Debug: "EV_SYN SYN_REPORT"
Debug: "Adding touch point: 1 -1"
Debug: "Touchpoint raw position: QPointF(67,55)"
Debug: "Touchpoint normal position: QPointF(0.039881,0.0435127)"
Debug: "Touchpoint transformed normal position: QPointF(0.039881,0.0435127)"
Debug: "Screen rect: QRect(0,0 1264x1680)"
Debug: "Registering touch point: TouchPoint(1 @QRectF(46.3696,69.0578 8x8) normalized QPointF(0.039881,0.0435127) press 0 vel QVector2D(0, 0) state 8 Qt::TouchPointReleased"
Debug: "Contact state: Qt::TouchPointState(0)"

Near top-right:

Debug: "Touchpoint raw position: QPointF(60,1187)"
Debug: "Touchpoint normal position: QPointF(0.0357143,0.939082)"
Debug: "Touchpoint transformed normal position: QPointF(0.0357143,0.939082)"
Debug: "Screen rect: QRect(0,0 1264x1680)"
Debug: "Registering touch point: TouchPoint(1 @QRectF(41.1071,1572.72 8x8) normalized QPointF(0.0357143,0.939082) press 0 vel QVector2D(0, 0) state 8 Qt::TouchPointReleased"

Near lower-left:

Debug: "Touchpoint raw position: QPointF(1631,51)"
Debug: "Touchpoint normal position: QPointF(0.970833,0.0403481)"
Debug: "Touchpoint transformed normal position: QPointF(0.970833,0.0403481)"
Debug: "Screen rect: QRect(0,0 1264x1680)"
Debug: "Registering touch point: TouchPoint(1 @QRectF(1222.16,63.7445 8x8) normalized QPointF(0.970833,0.0403481) press 0 vel QVector2D(0, 0) state 8 Qt::TouchPointReleased"

Near lower-right:

Debug: "Touchpoint raw position: QPointF(1637,1189)"
Debug: "Touchpoint normal position: QPointF(0.974405,0.940665)"
Debug: "Touchpoint transformed normal position: QPointF(0.974405,0.940665)"
Debug: "Screen rect: QRect(0,0 1264x1680)"
Debug: "Registering touch point: TouchPoint(1 @QRectF(1226.67,1575.38 8x8) normalized QPointF(0.974405,0.940665) press 0 vel QVector2D(0, 0) state 8 Qt::TouchPointReleased"
Szybet commented 11 months ago

Interesting. Try some arguments with rotation and swapping the axes. As you can see they are unconfigured in some way resulting in some madness.

Im top right you should get max x and 0 y values in pixels ( it goes (x, y)). In bottom left (0, max y) and bottom right ( max x, max y)