Can I directly communicate over usb to inputs like keyboard and mouse?

0

Set mouse or keyboard button to simulate left click and hold or rapid left click repeating in Windows?

I had this tripleClicker idea in a dream and my implementation is more like a turbo button for mice. I now I can use autokey or autohotkey. But I want to know how the software does this.

Im on linux can you help me send left click to mouse can I sent it directly to /dev/input/event3

Is there a way to emulate this signal or is this verbose. Is the actual signal hex on usb?

Event: time 1540772345.223443, type 4 (EV_MSC), code 4 (MSC_SCAN), value 90001 Event: time 1540772345.223443, type 1 (EV_KEY), code 272 (BTN_LEFT), value 0 Event: time 1540772345.223443, -------------- SYN_REPORT ------------

PS how to I get the time On my machine it says: real 0m0.000s user 0m0.000s sys 0m0.000s

This is more a timer time -a increments time -p resets Its a stopwatch command.

The goal of this is a work around in LMMS/GIMP so I dont have to try and make a paintbrush tool instead It will click repeatedly to simulate a paintbrush or stippling effect.

Punkroku

Posted 2018-10-29T00:34:21.690

Reputation: 1

@ivanivan: your link has answers which mix up various system level (old mouse protocol on /dev/input/mice, X protocol), and none I can see that answers it for /dev/event – dirkt – 2018-10-29T06:43:06.287

xdotool is by far the most convenient way to emulate keyboard and mouse input, but it uses xlib functions instead of directly interacting with /dev nodes. – Layne Bernardo – 2018-10-29T18:13:16.707

I feel like it might be easier to just edit the source code for LMMS or GIMP. I want like a right click key but for left click. I just want to click and drag instead of click click click click click click faster than I can type this. – Punkroku – 2018-10-29T22:10:55.667

Editing the source code for LMMS or GIMP is probably not easier than using xdotool and creating a small script. By the way, you can get mice which have rapid auto-click functionality: https://www.amazon.com/SPEEDLINK-Symmetrical-Optical-Gaming-Illumination/dp/B00EOTR10K

– Layne Bernardo – 2018-10-29T22:35:25.370

Answers

1

To sort out the various kernel layers: The USB layer will identify your mouse as a HID (human interface device) device, and using the HID descriptor, will automatically translate USB events into input events (what you see on /dev/input/eventX). Those input events are then read by the X driver evdev, and translated into X events (or, if you are using Wayland, something similar is done via libinput), which is then interpreted by GIMP etc.

You can just write to /dev/input/eventX to simulate an event. The format is described in the struct in the kernel source include files (include/uapi/linux/input.h and include/uapi/linux/input-event-codes.h). evtest translates it, so you also can compare to hexdump -C /dev/input/eventX.

You can also simulate an X event with various tools. You can't simulate an USB event.

The time is the time the event was produced, not the process time (what you get using time).

dirkt

Posted 2018-10-29T00:34:21.690

Reputation: 11 627

This seems closer to what I want to do. If I can abstact the keyboard and use midi signals translated to keyboard presses I can create keyboard just for passwords perhaps. Do you think it would still work or do keyloggers work at the higher level input form. Thanks for the method of viewing hexdump I thought I had to > or | to it. – Punkroku – 2018-10-29T22:14:24.247

include/uapi/linux/input.h and include/uapi/linux/input-event-codes.h was this like the su !! injection password? Well SUE ME! – Punkroku – 2018-10-29T22:16:18.750

If you want to translate MIDI signals to keyboard presses, have look at uinput, and just create your own input layer device instead of hijacking an existing one. Much cleaner. No, you can't use that to circumvent keyloggers. Actually, nothing works to circumvent keyloggers, because the application must see the key events, and so can the keylogger. – dirkt – 2018-10-30T06:56:36.430

how about sending ctrl c and win u +u or alt f4 to keyloggers? where can I find uinput resources? – Punkroku – 2018-11-04T07:32:58.960

>

  • Why should the key make any differences? 2) Getting started with uinput
  • – dirkt – 2018-11-04T07:55:01.887

    Thanks @dirkt && perhaps the keylogger will break on ctrl c or ctrl q in a password. Or perhaps putting an arrow key will offset the passwords and overwrite a character? – Punkroku – 2018-11-04T08:03:56.793

    Why not try it with evtest, if you don't believe me? – dirkt – 2018-11-04T08:08:09.510