Tiny Core Linux

Tiny Core Extensions => TCE News => Topic started by: Rich on January 30, 2021, 10:18:41 PM

Title: AutoCursor extension submitted
Post by: Rich on January 30, 2021, 10:18:41 PM
I recently came across this:
... On Ubuntu (on Unity desktop), you can even have a touchscreen and a mouse connected simultaneously and when moving the mouse, the cursor appears and when touching the touchscreen, the cursor disappears, and it reappears again when using the mouse (and so on), so the cursor is being dynamically hidden or shown depending on what kind of input device is currently in use.

That being said: Any idea how this could also be achieved in Tiny Core Linux?
That piqued my interest, so I decided to take a crack at it.

AutoCursor has been added to the TC10 x86 and x86_64 repositories. It's only dependency is libXfixes. Here's the .info file:
http://tinycorelinux.net/10.x/x86/tcz/AutoCursor.tcz.info

This is the usage message:
Code: [Select]
tc@E310:~/C_Programs/AutoCursor$ ./AutoCursor

AutoCursor version 0.10 Jan 30 2021 22:13:00
Copyright Richard A. Rost Jan 25,2021

AutoCursor controls cursor visibility based on device
events, such as mouse, keyboard, touch screen, etc.

Usage: AutoCursor [-sN] [-hN] [-i] [-e] [-S file] [-L file]

        -s N    Show cursor when event N occurs.
        -h N    Hide cursor when event N occurs.
        -i      Initial state of cursor is hidden.
        -e      Display list of available events.
        -S file Save event settings to file.
        -L file Load event settings from file.

Example: AutoCursor -i -s5 -h1 -h3 -s2 -S ~/.cursor.conf

Starts with cursor hidden.
Shows cursor when events 5 or 2 occur.
Hides cursor when events 1 or 3 occur.
Saves the event settings (but not -i) to a file.

tc@E310:~/C_Programs/AutoCursor$

The first thing to do is scan the  /dev/input/  directory and get a list of events and their descriptions:
Code: [Select]
tc@E310:~/C_Programs/AutoCursor$ sudo ./AutoCursor -e
Event#  Input device name
0:      "Power Button"
1:      "Power Button"
2:      "Logitech USB-PS/2 Optical Mouse"
3:      "PC Speaker"
4:      "DELL DELL USB Keyboard"
5:      "HDA Intel Mic"
6:      "HDA Intel Line"
7:      "HDA Intel Line Out"
8:      "HDA Intel Front Headphone"
tc@E310:~/C_Programs/AutoCursor$

To hide the cursor when typing, show the cursor when using the mouse, and create a settings file:
Code: [Select]
sudo ./AutoCursor -h4 -s2 -S ~/.cursor.conf &
This is what the settings file looks like:
Code: [Select]
tc@E310:~/C_Programs/AutoCursor$ cat ~/.cursor.conf
s:"Logitech USB-PS/2 Optical Mouse"
h:"DELL DELL USB Keyboard"
tc@E310:~/C_Programs/AutoCursor$

Although I haven't tried it under TC11 or higher, I have no reason to believe it won't work. I did copy the 32 bit binary to
my TC4 machine and it ran without any issues.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 30, 2021, 10:46:14 PM
Hi, Rich!

Your AutoCursor is just a tasty candy! May I take one more, please? :)
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 06:00:43 AM
Hi, Rich!

AutoCursor is overwhelmingly convenient. I vote for updating Xorg-7.7.tcz.info and adding
Code: [Select]
        Recommended: AutoCursor.tcz
line to the Comments section.

This bothering cursor made me avoid X, now I feel it's fun :)

Best regards!

PS

there is typo in http://tinycorelinux.net/10.x/x86/tcz/AutoCursor.tcz..info - doubled point, and You didn't mentioned in the info file, were we can obtain the sources. Isn't it GPLv2 ;) ?
Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 06:16:40 AM
Hi jazzbiker
... AutoCursor is overwhelmingly convenient. ...
Glad you like it.

Quote
... there is typo in http://tinycorelinux.net/10.x/x86/tcz/AutoCursor.tcz..info - doubled point ...
Oops. :-[ Thanks, fixed. :)

Quote
... You didn't mentioned in the info file, were we can obtain the sources. ...
The source package can be found here:
http://tinycorelinux.net/10.x/x86/tcz/src/AutoCursor/

Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 06:43:24 AM
If there are any Raspberry Pi users running a GUI who are interested in this, here are the build instructions:

Code: [Select]
wget http://tinycorelinux.net/10.x/x86/tcz/src/AutoCursor/AutoCursor-source-v0.31.tar.gz
tar xf AutoCursor-source-v0.1.tar.gz
cd AutoCursor
./CompileAutoCursor

The  CompileAutoCursor  script will download and install extensions that are required to build this package.
The  CompileAutoCursor  script will not alter your  onboot.lst  file.

When it completes, copy  AutoCursor.tcz, AutoCursor.tcz.dep, and AutoCursor.tcz.md5.txt  to your  tce/optional  directory. Then:
Code: [Select]
tce-load -i AutoCursor
You will also find an  AutoCursor-armv.tar.gz.bfe  or  AutoCursor-aarch64.tar.gz.bfe  file has been created. It contains
all the extension files and a source package.

Now you can submit it to the repository. Attach the  AutoCursor  file with the  .bfe  extension  it to a brief email that says:
Quote
Attached is AutoCursor for TC12.
AutoCursor-armv.tar.gz.bfe contains the extension and the source tarball.
Adjust the TC version and filename as required.

The instructions for emailing the extension are here:
https://www.linuxsecrets.com/tinycorelinux-wiki/wiki:creating_extensions.html#submitting
Use the  tcesubmit  email address, not the  picoresubmit  address.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 07:15:23 AM
Events are named - that's great for nomadic TinyCore install! Thanks again!
Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 07:18:12 AM
Hi jazzbiker
Those event names come from peripherals, so they will differ from machine to machine.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 07:44:05 AM
Quote from: Rich link=http://tinycorelinux.net/10.x/x86/tcz/AutoCursor.tcz.info
      If a mouse was included in your saved settings and is not present
      when you boot, we just move on to the next setting in the file.
On the new machine:
Code: [Select]
AutoCursor -hX -sY -S AutoCursor.conf.new; cat AutoCursor.conf.new >> ~/.config/AutoCursor.conf
Voila! all birds are trapped in our cages.
Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 08:28:10 AM
Hi jazzbiker
The  -s  and  -h  can be used multiple times. So you can us multiple events to hide (keyboard, touchscreen) and multiple
events to show (mouse, touchpad).

If you just want to hide the cursor:
Code: [Select]
sudo AutoCursor -i
I don't know why someone would want to do this, but I figured eventually someone will try to use  -S  and  -L  in the
same command. So rather than testing for it and throwing an error, it was easier to just make it so it works:
Code: [Select]
sudo AutoCursor -hX -sY -sZ -hW -S AutoCursor.conf.new -L ~/.config/AutoCursor.confThis says hide the cursor for events  X  and  W , show the cursor for events  Y  and  Z , save the settings in
AutoCursor.conf.new , but run using the settings from  ~/.config/AutoCursor.conf.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 08:54:53 AM
Hi, Rich!
I meant that if AutoCursor.conf includes descriptions of all the devices on all possible host machines, on one particular machine only devices actually present will be enqued. Is this wrong statement?
Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 09:15:59 AM
Hi jazzbiker
... Voila! all birds are trapped in our cages.

Here's an explanation of how the settings work that may prove useful.

These are the events listed on one of my machines:
Code: [Select]
tc@E310:~/C_Programs/AutoCursor$ sudo ./AutoCursor -e
Event#  Input device name
0:      "Power Button"
1:      "Power Button"
2:      "Logitech USB-PS/2 Optical Mouse"
3:      "PC Speaker"
4:      "DELL DELL USB Keyboard"
5:      "HDA Intel Mic"
6:      "HDA Intel Line"
7:      "HDA Intel Line Out"
8:      "HDA Intel Front Headphone"
tc@E310:~/C_Programs/AutoCursor$

This is the settings file from that machine:
Code: [Select]
tc@E310:~/C_Programs/AutoCursor$ cat cursor.conf
s:"Logitech USB-PS/2 Optical Mouse"
h:"DELL DELL USB Keyboard"
tc@E310:~/C_Programs/AutoCursor$

The program does a case sensitive substring search for the  settings string  in the  events string.
Any copy and paste section of the event string will work. In other words, this would work too:
Code: [Select]
s:"Mouse"
h:"Keyboard"

If all of your machines report  Mouse  and  Keyboard , That is all you would need. If one of your machines reports
keyboard , you could do this:
Code: [Select]
s:"Mouse"
h:"Keyboard"
h:"keyboard"

If I did this:
Code: [Select]
h:"HDA"My cursor would disappear anytime one of those 4 audio devices generated an event.

Summary:
You only need enough of the string to uniquely identify the event of interest.
You need the quotation marks.

...  on one particular machine only devices actually present will be enqued. ...
Correct.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 09:52:00 AM
Hi, Rich!

Seems, that trick with substrings doesn't works.
Code: [Select]
tc@box:/tmp$ sudo AutoCursor -e
Event#  Input device name
0:      "Lid Switch"
1:      "Sleep Button"
2:      "Power Button"
3:      "AT Translated Set 2 keyboard"
4:      "YSPRINGTECH USB OPTICAL MOUSE"
5:      "PC Speaker"
6:      "Video Bus"
7:      "HDA Intel MID Mic"
8:      "HDA Intel MID Headphone"

This config works:
Code: [Select]
tc@box:/tmp$ cat ~/.config/autocursor.conf
h:"AT Translated Set 2 keyboard"
s:"YSPRINGTECH USB OPTICAL MOUSE"

while this don't:
Code: [Select]
tc@box:/tmp$ cat ~/.config/autocursor.conf.test
h:"keyboard"
s:"MOUSE"

You really use
Code: [Select]
       {       // Only return entries starting with EVENTstr.
                if(strncmp(EVENTstr, entity->d_name, EVENTstrlen) == 0)
in  BuildEventlist(void).

It's absolutely ok to use full names, as they are written by AutoCursor.
Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 11:28:44 AM
Hi jazzbiker
Seems, that trick with substrings doesn't works. ...
You are correct. I use the quote mark for locating the description but neglected to omit it as a search term. Updated
extensions posted to TC10 x86 and x86_64. It now works as described in reply #10. Please update your copy.

Quote
... You really use
Code: [Select]
       {       // Only return entries starting with EVENTstr.
                if(strncmp(EVENTstr, entity->d_name, EVENTstrlen) == 0)
in  BuildEventlist(void). ...
That section of code searches  /dev/input/  for  event*.  We don't care about other entries (mice. mouse0, etc.).
The search for a match is done in  LoadSettings(char *fullname, int *fdmax)

Quote
... It's absolutely ok to use full names, as they are written by AutoCursor.
Yes, it is. But I also wanted to allow for a little more flexibility if required.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 12:38:01 PM
Hi, Rich!

Yes, works great!
Code: [Select]
tc@box:~$ cat ~/.autocursor.conf
h:"keyboard"
h:"Keyboard"
h:"KEYBOARD"
s:"mouse"
s:"Mouse"
s:"MOUSE"

Thanks for update!
Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 01:56:18 PM
Hi jazzbiker
Here's the output from an ASUS netbook with touchscreen, touchpad, and Bluetooth keyboard. In addidtion, there is a USB
mouse and keyboard plugged in:
Code: [Select]
Event# Input device name
0: "Lid Switch"
1: "Sleep Button"
2: "PC Speaker"
3: "SYNA7508:00 06CB:11E5 Pen"
4: "SYNA7508:00 06CB:11E5"
5: "Asus WMI hotkeys"
6: "PixArt HP USB Optical Mouse"
7: "Chicony HP Elite USB Keyboard"
8: "Chicony HP Elite USB Keyboard System Control"
9: "Chicony HP Elite USB Keyboard Consumer Control"
10: "Video Bus"
11: "bytcr-rt5640 Headset"
12: "Intel HDMI/DP LPE Audio HDMI/DP,pcm=0"
13: "Intel HDMI/DP LPE Audio HDMI/DP,pcm=1"
14: "Broadcom Bluetooth Wireless  Keyboard                        "
15: "Broadcom Bluetooth Wireless  Keyboard                        "
16: "Broadcom Bluetooth Wireless  Keyboard                        "
17: "Asus TouchPad"
18: "Broadcom Bluetooth Wireless  Keyboard                        "
19: "Broadcom Bluetooth Wireless  Keyboard                        "

This hides for the touchscreen and 2 keyboards, and shows for the mouse and touchpad:
Code: [Select]
sudo ./AutoCursor -s6 -h4 -s17 -h14 -h7
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 02:24:16 PM
Hi, Rich!

Now AutoCursor works without any issues. Any configuration of hiding and showing devices can be described and provided. But if some time You will be in the mood to introduce some changes into it, I have the proposal for You.

Now the sequence of actions is the following:
1. Processing "h" and "s" parameters, catching "L" and "S" names.
2. Saving supplied "h" and "s" values in the "S" name.
3. If present, load "L" name and, thereby, forgetting supplied int the command line values.

I think, sometimes it would be convenient to change the sequence:
1. as before
2. Loading, if present, "L" file and appending values in it to the existing list of command line "h" and "s" values.
3. If needed, save the resulting list to the "S" file.

What can You say about?
Title: Re: AutoCursor extension submitted
Post by: Rich on January 31, 2021, 10:22:53 PM
Hi jazzbiker
I'm not going to check for and support every possible combination of load, save, and command line switches.
This is a utility that typically would get run once or twice to set it up, and then launched automatically from ~/.X.d.
I did make 2 changes. I adjusted file permissions to 666 when saving settings. This way you don't need to be root to edit it.
I added a  -A  switch that will cause the program to  append  rather than  overwrite  when saving settings.

This will append the command line settings to AutoCursor.conf but run with the command line settings.
Code: [Select]
sudo AutoCursor -hX -sY -A -S AutoCursor.conf
This will append the command line settings to AutoCursor.conf and then load AutoCursor.conf.
Code: [Select]
sudo AutoCursor -hX -sY -A -S AutoCursor.conf -L ~/.config/AutoCursor.conf
The updated extension has been posted.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on January 31, 2021, 11:13:50 PM
I added a  -A  switch that will cause the program to  append  rather than  overwrite  when saving settings.

Hi, Rich!

Thanks for update! Now AutoCursor became even more convenient!
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on February 01, 2021, 04:40:47 AM
Hi, Rich!

Device properties (ID_INPUT_MOUSE, ID_INPUT_KEYBOARD, ID_INPUT_TOUCHPAD, ID_INPUT_TOUCHSCREEN) can be quered with
Code: [Select]
udevadm info -q property -p /sys/class/input/eventX | grep -q ID_INPUT_MOUSE

device names can be read with
Code: [Select]
cat /sys/class/input/eventX/device/name
and probably .conf file for AutoCursor can be produced according to this information.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on February 02, 2021, 03:26:18 PM
Hi, Rich and AutoCursor users!

        I'm attaching the script for auto-configuring AutoCursor. Its main purpose is nomadic use, of course, allowing avoid manual configuring on the newly visited machine. Script is very simple, no options, help or versions, the only command line parameter possible is the path to configuration file. Of course, it can be omitted in favour of default ~/.autocursor.conf. If devices found are already described in the existing configuration file, they are leaved unchanged. If some device is not yet present, the description with appropriate AutoCursor command (h or s) is appended.
        I have no touchscreen to test with TinyCore, so if anyone is able to test the script it will be interesting to know about the results, whether the "h" command will be assigned to it in the configuration file.

Regards!
Title: Re: AutoCursor extension submitted
Post by: Rich on February 03, 2021, 12:01:45 PM
Hi jazzbiker
... I have no touchscreen to test with TinyCore, so if anyone is able to test the script it will be interesting to know about the results, whether the "h" command will be assigned to it in the configuration file.
I ran it on the netbook I mentioned in reply#14:
Code: [Select]
s: "Asus TouchPad"
h: "Chicony HP Elite USB Keyboard"
h: "Broadcom Bluetooth Wireless  Keyboard                        "
s: "PixArt HP USB Optical Mouse"
h: "SYNA7508:00 06CB:11E5"
The last entry is the touchscreen.

On another note, there are many ways to accomplish the same task under Linux. In that spirit, I'd like to offer you
an awk free version of your event loop in the attached file.

Awk can be a very powerful tool for quickly searching and manipulating text. I used it myself here:
http://forum.tinycorelinux.net/index.php/topic,24581.msg156588.html#msg156588
Since I've only dealt with awk 2 or 3 times, most of my time was spent Googling, reading, and trying to figure out why
it was doing what I told it to do, instead of what I wanted it to do.

My point is that while awk does do the job, in this case, ash is quite capable of doing it too. Using awk here sets the
bar higher than it needs to be for other people wanting to understand and/or modify your script.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on February 03, 2021, 03:32:05 PM
Hi, Rich!

Thanks for testing, even the simpliest scripts may sometimes play the tricks, caused by unattentiveness.
And thanks for the script example, but unfortunately it may fail. You were assuming, that this ID's are present in exclusive manner, but as documentation says, ID_INPUT_TOUCHPAD and ID_INPUT_TOUCHSCREEN may be accompanied with the ID_INPUT_MOUSE, and as we don't know anything about their order, ID_INPUT_MOUSE may appear earlier than ID_INPUT_TOUCHSCREEN and will cause wrong command. That's why I used awk.

Thanks again for AutoCursor!
Title: Re: AutoCursor extension submitted
Post by: Rich on February 04, 2021, 10:21:58 PM
Hi jazzbiker
After some searching I now see setting  ID_INPUT_MOUSE  was once the norm when  ID_INPUT_TOUCHPAD or
ID_INPUT_TOUCHSCREEN was set:
Quote
As shown above, udev itself already classifies the input devices with input_id. Existing flags are:

    ID_INPUT
       

    All input devices have this flag.

    ID_INPUT_MOUSE
       

    Touchscreens and tables have this flag as well, since by the type of events they can produce they act as a mouse.

    ID_INPUT_TABLET
       

    ID_INPUT_TOUCHSCREEN
       
 ----- Snip -----
Last edited 2010-04-13 and found here:
https://wiki.kubuntu.org/X/InputConfiguration#Device_classification

A more recent document from Feb 29 2016 states:
Quote
ID_INPUT
    If this property is set, the device is considered an input device. Any device with this property missing will be ignored, see Device type assignment via udev.
ID_INPUT_KEYBOARD, ID_INPUT_KEY, ID_INPUT_MOUSE, ID_INPUT_TOUCHPAD, ID_INPUT_TOUCHSCREEN, ID_INPUT_TABLET, ID_INPUT_JOYSTICK, ID_INPUT_ACCELEROMETER
    If any of the above is set, libinput initializes the device as the given type, see Device type assignment via udev. Note that for historical reasons more than one of these may be set at any time, libinput will select only one of these to determine the device type. To ensure libinput selects the correct device type, only set one of them.

 ----- Snip -----

The usual error handling applies within libinput and a device type label does not guarantee that the device is initialized by libinput. If a device fails to meet the requirements for a device type (e.g. a keyboard labelled as touchpad) the device will not be available through libinput.

Only one device type should be set per device at a type, though libinput can handle some combinations for historical reasons.

Below is an example udev rule to remove an ID_INPUT_TOUCHPAD setting and change it into an ID_INPUT_TABLET setting. This rule would apply for a device with the vendor/model ID of 012a/034b.
Code: [Select]
ACTION=="add|change", KERNEL=="event[0-9]*", ENV{ID_VENDOR_ID}=="012a", \
ENV{ID_MODEL_ID}=="034b", ENV{ID_INPUT_TOUCHPAD}="", ENV{ID_INPUT_TABLET}="1"

 ----- Snip -----

So the rule is only one device type is supposed to be set, but certain errors will be tolerated and worked around.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on February 05, 2021, 12:42:55 AM
Hi, Rich!

Yes, I saw both pages, and noticed, that worse case is an outdated one. Then I decided to check, what's going on right now. And on ASUS-1215B running Lubuntu 16.04 I've got:
Code: [Select]
andrey@andrey-1215B:~$ uname -a
Linux andrey-1215B 4.15.0-133-generic #137~16.04.1-Ubuntu SMP Fri Jan 15 02:55:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
andrey@andrey-1215B:~$ cat /sys/class/input/event9/device/name
SynPS/2 Synaptics TouchPad
andrey@andrey-1215B:~$ udevadm info -q property -p /sys/class/input/event9
DEVLINKS=/dev/input/by-path/platform-i8042-serio-1-event-mouse
DEVNAME=/dev/input/event9
DEVPATH=/devices/platform/i8042/serio1/input/input7/event9
ID_INPUT=1
ID_INPUT_HEIGHT_MM=34
ID_INPUT_TOUCHPAD=1
ID_INPUT_TOUCHSCREEN=1
ID_INPUT_WIDTH_MM=64
ID_PATH=platform-i8042-serio-1
ID_PATH_TAG=platform-i8042-serio-1
ID_SERIAL=noserial
LIBINPUT_DEVICE_GROUP=11/2/7/1b1:isa0060/serio1
LIBINPUT_MODEL_JUMPING_SEMI_MT=1
LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD=1
MAJOR=13
MINOR=73
SUBSYSTEM=input
USEC_INITIALIZED=5652584

Not bad, yeah?

Of course, TinyCore is well known to be the best distribution in our Univrse :) and gave me on the same box:

Code: [Select]
tc@box:~$ uname -a
Linux box 4.19.10-tinycore64 #1999 SMP Tue Dec 18 15:18:54 UTC 2018 x86_64 GNU/Linux
tc@box:~$ cat /sys/class/input/event8/device/name
SynPS/2 Synaptics TouchPad
tc@box:~$ udevadm info -q property -p /sys/class/input/event8
DEVLINKS=/dev/input/by-path/platform-i8042-serio-1-event-mouse
DEVNAME=/dev/input/event8
DEVPATH=/devices/platform/i8042/serio1/input/input6/event8
ID_INPUT=1
ID_INPUT_TOUCHPAD=1
ID_PATH=platform-i8042-serio-1
ID_PATH_TAG=platform-i8042-serio-1
ID_SERIAL=noserial
MAJOR=13
MINOR=72
SUBSYSTEM=input
USEC_INITIALIZED=4032823

awk is already in the busybox, so I used it.

I think we can use this flags wiith care, and manual corrections surely must have higher priority over the proposed by any auto-detections for this use case.
Title: Re: AutoCursor extension submitted
Post by: Rich on February 05, 2021, 07:35:46 AM
Hi jazzbiker
... Not bad, yeah? ...
Yeah, but I did notice this:
Quote
Code: [Select]
----- Snip -----

ID_INPUT_TOUCHPAD=1
ID_INPUT_TOUCHSCREEN=1

 ----- Snip -----

LIBINPUT_DEVICE_GROUP=11/2/7/1b1:isa0060/serio1
LIBINPUT_MODEL_JUMPING_SEMI_MT=1
LIBINPUT_MODEL_SYNAPTICS_SERIAL_TOUCHPAD=1

 ----- Snip -----
So this breaks the rules by selecting 2 devices.
Then it appears to break them again because  ID_INPUT_MOUSE  isn't one of them.
Yet  libinput  still figures out the correct device.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on February 05, 2021, 09:21:00 AM
Hi, Rich!

Does to get more (the most?) reliable device classifier we need to ask libinput?
Then the sequence became a little bit longer.
1. Get list of events
2. If device is keyboard, assign 'h' cmd and go on. else
3. If device is of some kind graphical manipulator (including tablets, joystick and even accelerators?) then capture its name
4. Associate this name with X device id, using "xinput list"
5. Capture device properties
6. Determine device role depending on "absolute" ('h' command) or "relative" ('s' command) property presence.

Such way may appear to be unambiguous. What's Your opinion?
Title: Re: AutoCursor extension submitted
Post by: Rich on February 05, 2021, 02:06:48 PM
Hi jazzbiker
Does to get more (the most?) reliable device classifier we need to ask libinput? ...
I don't think so. I would suggest this might be a Lubuntu issue. If you look at your reply #23, you'll see Tinycore listed
only the correct device. Maybe Lubuntu needs a udev rule (see reply #22) similar to:
Code: [Select]
ACTION=="change", KERNEL=="event[0-9]*", ENV{ID_VENDOR_ID}=="0002", \
ENV{ID_MODEL_ID}=="0007", ENV{ID_INPUT_TOUCHSCREEN}=""

Your script, because it looks at touchpad before touchscreen, would return the correct result.
Title: Re: AutoCursor extension submitted
Post by: Rich on February 06, 2021, 10:29:51 PM
Hi jazzbiker
The programs  usage  page did not list all of the command line switches. This has been corrected,
The updated extension has been posted.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on February 07, 2021, 05:23:43 AM
Hi, Rich!

Thanks for the update! I didn't tried yet AutoCursor under Lubuntu, but I hope it will run without problems under another Linuxes.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on April 10, 2021, 01:54:45 PM
Hi, Rich!

You didn't submitted AutoCursor for TC12, so I copied tcz from TC10 tce directory. libXfixes was last updated 2017/02/20, I think this is reliable. Am I right?
Title: Re: AutoCursor extension submitted
Post by: Rich on April 10, 2021, 02:07:16 PM
Hi jazzbiker
I would expect AutoCursor to work under all versions. I copied the 32 bit version I compiled under TC10 to a machine
running TC4 and it worked just fine.

Are you having a problem running it under TC12?

Title: Re: AutoCursor extension submitted
Post by: jazzbiker on April 11, 2021, 06:09:33 AM
No, everything is ok, thanks!
Title: Re: AutoCursor extension submitted
Post by: Rich on April 11, 2021, 01:42:58 PM
Hi jazzbiker
I booted up a TC11 CorePure partition and it runs fine there too. The dependencies are unchanged across TC10, 11 and 12.
AutoCursor has been copied to the TC11 and TC12 repos for x86 and x86_64.
Title: Re: AutoCursor extension submitted
Post by: jazzbiker on July 13, 2021, 04:15:36 AM
Hi Rich!

I use AutoCursor every day and enjoy it very much, thanks for this light and handy extension! Let me share my experience.
I am meeting two types of situations when AutoCursor needs manual service. They are not bugs or issues, just a little inconveniences, which appear rarely and probably for minority of users.

    1. When I exit X to cli AutoCursor continues to stay idle in memory and during the next X session I have 2 AutoCursors. One of them active and the other idle. During next X session - 3 AutoCursors and so on. I added to AutoCursor startup script
Code: [Select]
pidof AutoCursor >/dev/null && s_u_d_o pkill AutoCursor
and am happy.

    2. Sometimes I work on the laptop with external mouse. If I accidentally touch USB jack of the mouse then AutoCursor looses mouse handler and captures one of the CPU cores for unsuccessful attempts to do something useful. If I notice this I kill and reload it. But sometimes for example during long compile such an event may pass unnoticed.
   Such situations are rare enough to forget about what is the reason for AutoCursor not to work :)

    Both cases are not bugs nor issues, but if there exists simple workaround (something like one additional "if" in the right place) and one day You will be in the mood to make AutoCursor even better than it is now it would be great!
 
Thanks a lot!
 
Title: Re: AutoCursor extension submitted
Post by: Rich on July 13, 2021, 01:00:17 PM
Hi jazzbiker
1. I don't think I could handle preventing multiple instances nearly as efficiently as that. I think some  /usr/local/etc/init.d
   scripts use a similar technique.
2. OK, that one sounds like you want me to compensate for a faulty connector. :o USB connectors do require a
   certain amount of force to plug and unplug, and don't just pop out when touched.

... but if there exists simple workaround (something like one additional "if" in the right place) ...
Nothing like that. Not even close.