镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

printf command does not do anything #8

Open

Description

@fixedforward

Hi,

So I cloned the repo and tried to follow your instructions. I run "make" on the repo, run insmod on the .ko file, and saw the virtual touchscreen is there on /dev/input/event7. However, when I printf to this event, nothing happens and when I listen using hd, there is nothing being output (please see screenshot below). I also did not get anything when I do dmesg | grep virtual_touchscreen. Do you perhaps know why? Could you perhaps tell me what am I supposed to see on dmesg and hd everytime I run a command on the virtual touchscreen? I am using Ubuntu 20.04. Thank you!

afbeelding

Activity

  1. vi commented on Jun 2, 2021

    @vi
    Owner

    You need to issue multiple commands to /dev/virtual_touchscreen for it to actually emit some events.

    In particular, you'll probably see nothing without S 0 (sync) command.

    Note that even if you do see events in /dev/input/eventX, Xorg or other programs may seem to ignore it unless you issue correct commands into /dev/virtual_touchscreen. Use the GUI app and/or sample commands to try it before trying to make a generator of your own events.

    cat /dev/virtual_touchscreen should output a short help for possible commands.

  2. fixedforward commented on Jun 3, 2021

    @fixedforward
    Author

    Hi,

    So I followed your suggestion and created multiple events and making sure I do sync before blocks of command. However, hd still doesn't print anything. On the left console you could see that the virtual touchscreen is indeed there. What could I be doing wrong?

    afbeelding

  3. vi commented on Jun 3, 2021

    @vi
    Owner

    Syncing should come after commands, not before them.

    In your second attempt the sync command was typed incorrectly:  S0\n instead of S 0\n.

  4. fixedforward commented on Jun 3, 2021

    @fixedforward
    Author

    So I restarted my computer, ran all the required set up steps and re-did the examples with the mistakes fixed as shown below, but still I do not get any output. Is it because I am using Ubuntu 20.04, or is there a setting I forgot to unlock?

    afbeelding

  5. vi commented on Jun 3, 2021

    @vi
    Owner

    \n S 0\n seems wrong - extra space character before S. Likewise for y command.

    Try { printf 'x 200\ny 300\nd 0\nS 0' && sleep 0.2 && printf 'u 0\nS 0\n' } > /dev/virtual_touchscreen.

  6. fixedforward commented on Jun 3, 2021

    @fixedforward
    Author

    So I solved it by going into root; perhaps I could not print to evdev if I am not root. But now I am confused about another thing; as you can see I initiated a down touch on the bottom right console by moving the cursor to x 1580 annd y 830 as shown. But that console is not highlighted. Is this the problem you mentioned where the programs may ignore the touch commands? If so how could I make them recognize it?
    afbeelding

  7. vi commented on Jun 3, 2021

    @vi
    Owner

    Have just built and loaded the module into 5.10.0-6-amd64 and checked that it works:

    # hd /dev/input/event22
    00000000  3d d4 b8 60 00 00 00 00  a3 66 0a 00 00 00 00 00  |=..`.....f......|
    00000010  03 00 00 00 03 00 00 00  3d d4 b8 60 00 00 00 00  |........=..`....|
    00000020  a3 66 0a 00 00 00 00 00  03 00 01 00 03 00 00 00  |.f..............|
    00000030  3d d4 b8 60 00 00 00 00  a3 66 0a 00 00 00 00 00  |=..`.....f......|
    00000040  00 00 00 00 00 00 00 00  45 d4 b8 60 00 00 00 00  |........E..`....|
    00000050  e7 82 03 00 00 00 00 00  03 00 00 00 01 00 00 00  |................|
    00000060  45 d4 b8 60 00 00 00 00  e7 82 03 00 00 00 00 00  |E..`............|
    00000070  03 00 01 00 01 00 00 00  45 d4 b8 60 00 00 00 00  |........E..`....|
    00000080  e7 82 03 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    00000090  49 d4 b8 60 00 00 00 00  16 bb 06 00 00 00 00 00  |I..`............|
    000000a0  03 00 00 00 00 00 00 00  49 d4 b8 60 00 00 00 00  |........I..`....|
    000000b0  16 bb 06 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
    ^C
    
    # printf 's 0\nx 3\ny 3\nS 0\n' > /dev/virtual_touchscreen
    # printf 's 0\nx 3\ny 3\nS 0\n' > /dev/virtual_touchscreen
    # printf 's 0\nx 1\ny 1\nS 0\n' > /dev/virtual_touchscreen
    # printf 's 0\nx 0\ny 1\nS 0\n' > /dev/virtual_touchscreen
    

    Each time I change coordinates, I see incoming event. If I issue the command with the same coordinates, there is no event.

    Note that slot selection s 0\n and sync S 0\n are both required.

  8. fixedforward commented on Jun 3, 2021

    @fixedforward
    Author

    Yes it worked for me too now; but when I try a down touch on an area (like the unhighlighted cmd console I showed in my previous post), it did not become highlighted. How can I make the OS or other programs actually recognize my touch inputs? I attach it here again for clarity

    afbeelding

  9. vi commented on Jun 3, 2021

    @vi
    Owner

    Have you tried using the GUI program to generate source events?

    https://github.com/vi/virtual_touchscreen/releases/download/v1.0/virtual_touchscreen.jar

  10. fixedforward commented on Jun 3, 2021

    @fixedforward
    Author

    It says it can't find main class clojure.main

    afbeelding

  11. vi commented on Jun 3, 2021

    @vi
    Owner

    The java -cp clojure.jar clojure.main virtual_touchscreen.clj command line may be obsolete. I was doing it in Clojure 1.3 and this clojure.main is probably changed since than.

    Have you tried running the pre-built jar file I linked above?

    java -jar virtual_touchscreen.jar?

    Do don't need root access to run it, but you'll need to also start external program to forward events from a TCP socket to /dev/virtual_touchscreen.

  12. vi commented on Jun 3, 2021

    @vi
    Owner

    Checked that virtual_touchscreen.clj still starts with Clojure 1.10.2.

    $ clojure virtual_touchscreen.clj
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions