Poll Wacom input from "libinput debug-events" in Bash
Hey,
I am making a Bash shell script to grab input from libinput. There's a few reasons why I am doing it this way:
Using Python with python-libinput does not work. I installed version 0.1.0 with pip, and it complains about "ContextType" not existing. So that's a no-go.
I am trying to get away from my dependence on Xorg-related stuff, such as xsetwacom and xserver-input-wacom, and do things that are more compatible with Wayland.
Both methods above do not have support for the four different modes when you press the center ring button on the ExpressKey pad. I plan to eventually support all of these events.
Without explaining my entire plan of this script, I figured I could ask the question that's harder for me to understand, and figure out the rest as I go along.
I want to poll the outputs from "libinput debug-events" in an infinite loop Bash script that will run in the background. This polling will happen, say, every 1 second.
This pseudocode down below can help explain what I am looking to do to start out my script:
My big problem is figuring out how to do this.
The thing is, "libinput debug-devices" works a lot like showkey or xev, but not exactly. For some reason, stdin for "TABLET_PAD_BUTTON" is "frozen" until I move the mouse around. Why this is, I have no idea. Regardless to say, I feel like I may be overcomplicating my problem, or I just don't really see a clear cut solution. Doing it this way just doesn't work right, as it is.
The libinput binary program will need to somehow exit after a period of time, because by default it is left running, so some sort of control implementation needs to exist there. Also, I notice that when it loops back to "OUTPUT=xyz" the existing variable data should be replaced by new input data again, which is great. That's exactly how it should work in that case.
Finally, this is a script that needs to run in the background (like a daemon process), and also accept input from libinput/udev devices at all times. And I'm not sure if Bash is powerful enough to tell the libinput binary to do that, is the thing.... If this really needs to be written in C, then perhaps there's no good solution here, and the thread can be closed if that's the case.
Anybody have any idea how I could approach this problem, or could even possibly provide a good bash script solution? Thank you very much in advance!
Last edited by mrjpaxton; 10-12-2019 at 01:55 AM..
Hi
how to check input is "empty" and "numeric" in ksh?
e.g:
./myscript.ksh k
output show: invalid number input
./myscript.ksh
output show: no input
./myscript.ksh 10
output show: input is numeric (6 Replies)
When I debug vmlinux with gdb, after it connect to the target, I got below output:
usbcore.ko: No such file or directory.
Error while mapping shared library sections:
ohci_hcd.ko: No such file or directory.
Symbol file not found for usbcore.ko
Symbol file not found for ohci_hcd.ko
Symbol... (2 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi All,
I'm completely new to bash scripting and still learning my way through albeit vey slowly.
I need to know where to insert my server names', my ip address numbers through out the script alas to no avail.
I'm also searching on how to save .sh (bash shell) script properly.... (25 Replies)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
I've found this script part on the stackoverflow:
if ; then
sudo bash "$0" "$@";
exit "$?";
fi
I realized that sudo bash "$0" "$@"; is the only needed for me.
But the strange thing happens when I move this line outside the IF statement:
sudo bash "$0" "$@"; stops the... (9 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)