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

From: Vladimir Kondratyev <vladimir_at_kondratyev.su>
Date: Tue, 28 Jun 2022 10:00:10 UTC
On 28.06.2022 09:59, Ivan Quitschal wrote:
> 

> Hi Vladimir / All,
> 
> Just a question in case you guys know how.
> Problem is fixed , nothing about that, but after the keyboard is detached and reattached , I
> always have to do another "kbdcontrol -r fast" myself for it to get back to the speed I use.
> I've tried to call this command from within devd.conf alongside moused, but no success.
> Any ideas ?
> 

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