-
Notifications
You must be signed in to change notification settings - Fork 461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8201568: zForce touchscreen input device fails when closed and immediately reopened #258
Conversation
👋 Welcome back jgneff! A progress list of the required criteria for merging this PR into |
Webrevs
|
I thought I could avoid fixing this bug simply by waiting a few years, but the old devices from 2012 and 2013 where the problem occurs are still supported and still even being sold (refurbished) by the manufacturer. The Monocle EPD platform has a work-around for the bug in the method The problem does not occur on newer 2015 and 2018 devices that I tested. BackgroundThe Neonode zForce touchscreen input device almost always fails when it is opened immediately after being closed. Once it fails, no input events are received. The device driver logs the following messages to the kernel ring buffer:
This pull request reorders the initialization sequence to be "open, open, close" instead of "open, close, open" so that the input device is never actually closed. With this change, the file reference count remains above zero so the call to close it is ignored, and the device driver logs the following messages to the ring buffer:
In both cases, when the program exits or is canceled with
SummaryI decided to go ahead and submit this pull request for the following reasons:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rationale makes sense (open/open/close) instead of (open/close/open)
@jgneff This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 57 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@johanvos) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Based on my notes below, I believe this change is safe for any Linux input device driver because the driver shouldn't receive the intermediate open and close calls at all. Nonetheless, it would be reassuring if someone could try this change just once on a mainstream device, such as the Raspberry Pi with a touchscreen LCD panel. I only have six obscure ARM devices and a headless QEMU ARM virtual machine for testing. @johanvos or @dellgreen - Is that something you could test? If you think it's overkill and not worth it, that's fine, too. NotesThe Linux kernel documentation about opening and closing input devices states:
Also, the Linux Programmer's Manual for the close system call (
Running a JavaFX program with
Both devices are actually closed by the kernel when the JavaFX program ends. |
I don't have access to a Pi right now, so I can't test this (I'll be able to test in about 10 days from now though) |
Thank you, Johan. If you have the time, that would be great. Otherwise, merging this for early-access builds of JavaFX 16 should provide enough time to find any regression errors on other devices. By the way, do you know whether I would be able to use a PinePhone instead of a Raspberry Pi for testing the Monocle Linux platform ( |
I have been trying to run JavaFX on the PinePhone ever since I got it. The OS I'm using is Fedora and it is aarch64, which means I had to add that arch to build.gradle to compile it. As is the touchscreen doesn't respond correctly at all. Every touch reports as a mouse_entered, mouse_exited event. Though this is due to using the Desktop JavaFX. Is there somewhere I can find an embedded aarch64 version? Since desktop javafx/OpenJFX only runs monocle in headless according to this: https://wiki.openjdk.java.net/display/OpenJFX/Monocle |
If I had a PinePhone, I would try to get the 32-bit armhf build of JavaFX working. That's the one you build with |
I do not know of a currently supported 32-bit armhf OS for the PinePhone. Thanks for the quick reply! |
I just placed an order for a Raspberry Pi 2 Model B -- the older model with the 32-bit ARMv7-A architecture. It's the oldest, slowest, and coolest-running Raspberry Pi supported by Ubuntu, and it's also the closest match to the processors found in devices with e-paper displays. The Raspberry Pi should finally let me test changes like this to the Linux Monocle platform on which the EPD platform is based. I may eventually add a touchscreen, but I'm hoping to get by with just the mouse for now. |
@johanvos, would you mind approving this pull request again? It looks as if the ready label was removed when I merged the master branch. All of the tests I ran this week worked as expected and are described below. TestsI ran additional tests on the following devices after merging the master branch:
I ran the tests:
The workaround is the code in The test results are shown below. The system call trace was captured with the following command using the epd-javafx application. $ sudo strace -f -e trace=open,openat,close -o strace.log \
bin/run.sh --pattern=3 --loops=1 Note: In the messages below from the kernel ring buffer, the final two lines with Kobo Touch Model N905CThis device has the "command overrun" bug. Without fix, without workaroundThe system call trace shows:
The error occurs, and the touchscreen is disabled: $ dmesg | grep -i zforce
[drivers/input/touchscreen/zforce_i2c.c-425] zforce_i2c_open()
[zForce_ir_touch_recv_data-145] command Activate (0) ...
[zForce_ir_touch_recv_data-154] command Resolution (0) ...
[zForce_ir_touch_recv_data-179] command Frequency (0) ...
[drivers/input/touchscreen/zforce_i2c.c-440] zforce_i2c_close()
[drivers/input/touchscreen/zforce_i2c.c-425] zforce_i2c_open()
[zForce_ir_touch_recv_data-142] command Deactivate ...
[zForce_ir_touch_recv_data-198] command overrun (8) ...
[drivers/input/touchscreen/zforce_i2c.c-440] zforce_i2c_close()
[zForce_ir_touch_recv_data-142] command Deactivate ... With fix, without workaroundThe system call trace shows:
The error does not occur, and the touchscreen works as expected: $ dmesg | grep -i zforce
[drivers/input/touchscreen/zforce_i2c.c-425] zforce_i2c_open()
[zForce_ir_touch_recv_data-145] command Activate (0) ...
[zForce_ir_touch_recv_data-154] command Resolution (0) ...
[zForce_ir_touch_recv_data-179] command Frequency (0) ...
[drivers/input/touchscreen/zforce_i2c.c-440] zforce_i2c_close()
[zForce_ir_touch_recv_data-142] command Deactivate ... With fix, with workaroundThe system call trace shows the additional open call due to the workaround:
The error does not occur, and the touchscreen works as expected: $ dmesg | grep -i zforce
[drivers/input/touchscreen/zforce_i2c.c-425] zforce_i2c_open()
[zForce_ir_touch_recv_data-145] command Activate (0) ...
[zForce_ir_touch_recv_data-154] command Resolution (0) ...
[zForce_ir_touch_recv_data-179] command Frequency (0) ...
[drivers/input/touchscreen/zforce_i2c.c-440] zforce_i2c_close()
[zForce_ir_touch_recv_data-142] command Deactivate ... Kobo Glo HD Model N437This device does not have the "command overrun" bug. Without fix, without workaroundThe system call trace shows:
The error does not occur, and the touchscreen works as expected: $ dmesg | grep -i zforce
[drivers/input/touchscreen/zforce_i2c.c-740] zforce_i2c_open()
[zForce_ir_touch_recv_data-233] command Activate (0) ...
...
[zForce_ir_touch_recv_data-250] command Resolution (0) ...
[zForce_ir_touch_recv_data-278] command Frequency (0) ...
[zForce_ir_touch_recv_data-260] command Configuration ...
[drivers/input/touchscreen/zforce_i2c.c-756] zforce_i2c_close()
[zForce_ir_touch_recv_data-230] command Deactivate ... With fix, without workaroundThe system call trace shows:
The error does not occur, and the touchscreen works as expected: $ dmesg | grep -i zforce
[drivers/input/touchscreen/zforce_i2c.c-740] zforce_i2c_open()
[zForce_ir_touch_recv_data-233] command Activate (0) ...
...
[zForce_ir_touch_recv_data-250] command Resolution (0) ...
[zForce_ir_touch_recv_data-278] command Frequency (0) ...
[zForce_ir_touch_recv_data-260] command Configuration ...
[drivers/input/touchscreen/zforce_i2c.c-756] zforce_i2c_close()
[zForce_ir_touch_recv_data-230] command Deactivate ... With fix, with workaroundThe system call trace shows the additional open call due to the workaround:
The error does not occur, and the touchscreen works as expected: $ dmesg | grep -i zforce
[drivers/input/touchscreen/zforce_i2c.c-740] zforce_i2c_open()
[zForce_ir_touch_recv_data-233] command Activate (0) ...
...
[zForce_ir_touch_recv_data-250] command Resolution (0) ...
[zForce_ir_touch_recv_data-278] command Frequency (0) ...
[zForce_ir_touch_recv_data-260] command Configuration ...
[drivers/input/touchscreen/zforce_i2c.c-756] zforce_i2c_close()
[zForce_ir_touch_recv_data-230] command Deactivate ... Raspberry Pi 2 Model BThis device has a normal mouse rather than a touchscreen. Without fix, without workaroundThe system call trace shows:
There is no output to the kernel ring buffer, and the mouse (event0) works as expected. With fix, without workaroundThe system call trace shows:
There is no output to the kernel ring buffer, and the mouse (event0) works as expected. With fix, with workaroundThe system call trace shows:
There is no output to the kernel ring buffer, and the mouse (event0) works as expected. |
I'm unsure of the next step for this pull request. GitHub says that it's approved, but the openjdk bot removed the "Ready to be integrated" label when I merged in the master branch back in September. Do I need to wait for its re-approval before integrating it? |
It seems there was an additional merge commit, which didn't change your code, but it triggered a re-approval request that I missed. I re-approved it, so this should be ready to integrate. |
/integrate |
/sponsor |
@johanvos @jgneff Since your change was applied there have been 57 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit ebb59e9. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Fixes JDK-8201568.
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/258/head:pull/258
$ git checkout pull/258