RES: RES: iichid/hms keyboard/mouse wrongly reattached to uhid/ums

From: Ivan Quitschal <tezeka_at_hotmail.com>
Date: Tue, 28 Jun 2022 13:15:26 UTC
> May be DE overrides repeat rate for you?
> 
> Anyway, it is possible to change repeat rate through evdev interface.
> Following snippet of code illustrates a way to do that:
> 
> 
> #include <sys/ioctl.h>
> #include <dev/evdev/input.h>
> 
> #include <fcntl.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> 
> void
> usage(void)
> {
> 	printf("usage: eviocresp /dev/input/event0\n"); }
> 
> int
> main(int argc, char** argv)
> {
> 	int fd = 0;
> 	int rep[2] = {0, 0};
> 
> 	if (argc < 2) {
> 		usage();
> 		exit(0);
> 	}
> 
> 	if ((fd = open(argv[1], O_RDWR)) < 0) {
> 		perror("unable to access file, exiting");
> 		exit(1);
> 	}
> 
> 	/* get current auto-repeat args. */
> 	if (ioctl(fd, EVIOCGREP, rep)) {
> 		perror("unable to set delay and repeat rate for input devices");
> 		exit(1);
> 	}
> 
> 	/* set auto-repeat rate as 0. */
> 	rep[1] = 0;
> 
> 	if (ioctl(fd, EVIOCSREP, rep)) {
> 		perror("unable to set delay and repeat rate for input devices");
> 		exit(1);
> 	}
> 
> 	printf("rep[0]:%d;rep[1]:%d\n", rep[0], rep[1]);
> 	close(fd);
> }
> 
> 
> 
> --
> WBR
> Vladimir Kondratyev

Hi Vladimir,

Worked , i think i will try to implement it within /usr/src/sys/dev/usb/input/
as soon as I find out where exactly : )

for now I made this and its working great now:
I compiled your code and copied to: 
/usr/local/bin/eviocresp

In /etc/devd.conf 

notify 100 {
    match "system" "DEVFS";
    match "subsystem" "CDEV";
    match "type" "CREATE";
    match "cdev" "input/event[0-9]+";

    action "/usr/local/sbin/moused -m 2=3 -p /dev/$cdev -I /var/run/moused.`echo $cdev | cut -c 7-`.pid";
    action "/usr/local/bin/eviocresp /dev/$cdev";
};

detach 100 {
    device-name "hms[0-9]+";
    action "/bin/pkill moused";   <-- this part is need for the reason explained below
};

BUG: 
I had to put the following in rc.local since the first moused loaded always have the cursor 
"shaking" in the screen, even with the actual mouse totally stopped. 

rc.local:

pkill moused
for file in /dev/input/event[0-9]*; do
        /usr/local/sbin/moused -m 2=3 -p $file -I /var/run/moused.`echo $file | cut -c 12-`.pid
Done

I don’t know why, but moused only gets its cursor pointer on screen "not shaking" (I mean not moving) on the second 
moused execution, you need to pkill and run it again in order to work properly. Maybe it's getting attached to
the  wrong /dev/event* on the first run. On the first run , I always have 4 moused processes , after I pkill and re-run it
I only get 2 (that’s when it works properly)

That I'm pretty sure it’s a bug, right?

Well, now I can attach and detach the mouse and keyboard as much as I want and everything remains the same 
Thank you again 

--tzk