Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [EN] Keyboard rate is too fast  (Read 4122 times)

Offline clubex

  • User
  • Posts: 265
[EN] Keyboard rate is too fast
« on: 2014/02/24, 13:40:41 »
Since switching to systemd every time I drop into a tty (CRTL+ALT+F1) I find the keyboard rate is too fast for my ageing fingers. Having to correct typos is bad enough but having to make many attempts at getting the password correct is driving me mad.

I know about kbdrate and xset but neither are of any use when logging in to a tty. Even when the rate is set with kbdrate it doesn't survive a logout.

What I need is a default (permanent) rate of r=30 set from boot onwards. The present default rate is obviously being set somewhere but i can't find it in /etc/defaults or X11 or anywhere else. I would have thought this could be arranged to occur at boot time but I don't know how and googled to no avail.

I've even tried writing a ttykeyboard.service with no success. (Probably because of my present poor knowledge of writing systemd services and because I can't decide which target actually wants this service.)

So anyone know how to set a permanent keyboard rate suitable for my fingers?

Offline clubex

  • User
  • Posts: 265
Re: Keyboard rate is too fast
« Reply #1 on: 2014/02/24, 23:11:38 »
I think I've figured out why the keyboard delay and rate isn't set by systemd. Under sysvinit the init script /etc/init.d/kbd uses the variables KEYBOARD_DELAY and KEYBOARD_RATE in /etc/kbd/config to set the keyboard delay and repeat rate. I could be wrong but there doesn't seem to be a systemd service to accomplish the same task.

I've discovered that some other distros have a kbd.service (SuSE for one) but I've not been able to obtain a copy. So I tried to write a systemd service to achieve this.ie.
 
[Unit]
Description=Configure keyboard repeat rate in tty

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart= /sbin/kbdrate -d 750 -r 30.3
 
[Install]
WantedBy=multi-user.target

It looks OK to me, given that I haven't written a systemd service before, Unfortunately, it doesn't do what I intend it to do.

(The args passed to kbdrate may look odd but they are within the constraints shown in the kbdrate man page.)

To my mind it doesn't work because a) the multi-user.target isn't a tty target and/or b) I should include a Before and/or an After statement. Problem is I don't know what to do to make it work.

Does anyone more knowledgeable know how?

Offline clubex

  • User
  • Posts: 265
Re: Keyboard rate is too fast [Solved]
« Reply #2 on: 2014/02/25, 13:51:00 »
If anyone is still interested I seem to have a solution which works.

After a bit of reading it seemed to me that StandardInput=tty was the statement referring to the tty that I needed. After appending the statement the service successfully set the delay and repeat rate that I required.

Later I added the StandardOutput=tty which displays the rate values while booting (I don't have a boot splash).

If anyone knows this in an incorrect method or has a better way of achieving the same aims then please let me know. 

Here is the service for whomever finds it useful just don't blame me if causes harm to you, your machine or your software.
Code: [Select]
[Unit]
Description=Configure keyboard repeat rate in tty

[Service]
Type=simple
ExecStart=/sbin/kbdrate -d 750 -r 30.3
StandardInput=tty
StandardOutput=tty

[Install]
WantedBy=multi-user.target

I named it ttykbdrate.service, put it in
Code: [Select]
/etc/systemd/system
reloaded the services so that ttykbdrate was available,
Code: [Select]
systemctl --system daemon-reloaded
started and enabled it
Code: [Select]
systemctl start ttykbdrate.service
systemctl enable ttykbdrate.service
then rebooted to check that it displayed the values set.

Enjoy!

 
« Last Edit: 2014/02/25, 21:57:00 by clubex »