You are not logged in.

#1 2020-07-18 23:18:20

ThinkPad
Member
Registered: 2019-01-29
Posts: 58

kbdrate not taking effect at console login for external keyboard

In addition to what I've tried in this post, I created a udev rule to run when my keyboard is plugged in:

/usr/udev/rules.d/10-local.rules
----
ATTRS{name}=="foostan Corne Keyboard (crkbd)", ACTION=="add", RUN+="/usr/local/shsc/kbdrate"
/usr/local/shsc/kbdrate
----
/usr/bin/kbdrate -s -d 1000 -r 15
touch /home/loaf/triggered

I confirm that it's run by writing the file 'triggered', but it does not take effect at the login console for my external keyboard. I am not sure how to further debug this. As stated in my other post, if I run the command as root after logging in, it works for my external keyboard. If I try to trigger it at or after login by plugging and unplugging the keyboard, it does not work. At the console login and after login it works for the built in laptop keyboard, but not my USB keyboard.

Last edited by ThinkPad (2020-07-18 23:18:59)

Offline

#2 2020-07-19 06:03:19

seth
Member
Registered: 2012-09-03
Posts: 16,607

Re: kbdrate not taking effect at console login for external keyboard

Overridden? Runs before keyboard is initialized?
Did you try to delay the call, eg. prepend "sleep 1"?

Offline

#3 2020-07-19 17:58:35

ThinkPad
Member
Registered: 2019-01-29
Posts: 58

Re: kbdrate not taking effect at console login for external keyboard

This is what I tried:

/usr/local/shsc/kbdrate
----
#!/bin/sh

/bin/sleep 1
/usr/bin/kbdrate -s -d 1000 -r 15
touch /home/loaf/triggered

It didn't work.

Last edited by ThinkPad (2020-07-19 18:00:55)

Offline

#4 2020-07-19 18:32:09

loqs
Member
Registered: 2014-03-06
Posts: 11,874

Re: kbdrate not taking effect at console login for external keyboard

If you replace touch with the following to check the exit status of kbdrate

echo $? > /home/loaf/triggered

Is the exit status 0?

Offline

#5 2020-07-19 19:08:40

ThinkPad
Member
Registered: 2019-01-29
Posts: 58

Re: kbdrate not taking effect at console login for external keyboard

Oddly, the service, but not the udev rule, seems to work now after installing powertop, running powertop --calibrate, and enabling the powertop service as per these instructions. powertop --calibrate soft blocked my wifi card and bluetooth, not sure if that is causation. This is all with the sleep line removed. I've since disabled the powertop service as it was affecting keyboard input and missing strokes. The service also works with powertop uninstalled.

Using your suggestion, the rule writes a '0'.

I will wait to mark as solved as I am not sure what the fix was or if it will persist. If you have anything you'd like me to test let me know. I appreciate the help.

Last edited by ThinkPad (2020-07-19 19:10:47)

Offline

#6 2020-07-20 12:28:46

ondoho
Member
Registered: 2013-04-30
Posts: 677
Website

Re: kbdrate not taking effect at console login for external keyboard

ThinkPad wrote:

I am not sure how to further debug this.

'udevadm monitor', 'udevadm info' etc. can give insight.
the Archwiki has a long page on udev too.


However studied and stilted your rant, it can never hide the base and primitve emotion that inspired it.
There's no objectivity.

Offline

#7 2020-07-20 13:47:00

ThinkPad
Member
Registered: 2019-01-29
Posts: 58

Re: kbdrate not taking effect at console login for external keyboard

So it seems the udev does not take effect, and that the service only takes effect if the keyboard is plugged in before the machine is powered on. I tested with the rule in place and the service and tried unplugging and plugging at login to trigger.

I will reread the udev wiki entry. I thought udevadm info was to get parameters to use in rules. I will explore both, thank you for the guidance.

Offline

#8 2020-07-20 13:54:24

seth
Member
Registered: 2012-09-03
Posts: 16,607

Re: kbdrate not taking effect at console login for external keyboard

If the udev rule doesn't work, why would /home/loaf/triggered get updated (and exit status 0)?

Offline

#9 2020-07-24 02:02:10

ThinkPad
Member
Registered: 2019-01-29
Posts: 58

Re: kbdrate not taking effect at console login for external keyboard

Not sure. Even when the service wasn't working it still showed correct output that the delay was changed. Again, it takes effect for my built in keyboard, but not the external which is why I think it returns without error. The external only works as intended when the computer is started after the board is plugged in and with the service, not the udev.

Offline

#10 2020-07-24 06:30:33

seth
Member
Registered: 2012-09-03
Posts: 16,607

Re: kbdrate not taking effect at console login for external keyboard

If  /home/loaf/triggered gets updated  when you plug in the keyboard (maybe ensure that this isn't a false positive because it got updated w/ eg. the service only?) the udev rule hits and the script gets called.
If "/usr/bin/kbdrate -s -d 1000 -r 15" generally works and is called by the script when you plug the keyboard, it either fails to affect the keyboard at that time or gets reset later on.
In that case, adding a random delay should™ sanitize the situation unless the reset is triggered by a voluntary later action (eg. a login script and your login)

Offline

Board footer

Powered by FluxBB