Enable numeric keypad on startup

#1

I’m using a keyboard with a numeric keypad on my osmc running on a raspberry pi 3.

I would like to have the numeric keypad automatically enabled after startup. How can this be configured?

#2

This should work. I’m not sure which startup script you should put this in though, might need a bit of trial and error there

https://timmurphy.org/2012/02/26/numlock-on-startup-in-debian-or-fedora/

#3

That’s also the only one I found googleing, but I didn’t recommended to @stp as I assume that it will drag in all the X packages unnecessarily

#4

Thank you for your answers! I had found the solution with numlockx before I made my post, but unfortunately it doesn’t work.

osmc@osmc:~$ numlockx on
Error opening display!
#5

Hi stp,

You may have more success with setleds, more details in this stack exchange post:

numlockx needs x11, which isn’t installed by default with osmc.

Thanks Tom.

#6

Hi Tom,

I tried also setled like explained in http://forums.debian.net/viewtopic.php?t=134006#p650222

Unfortunately it also doesn’t work.

After rebooting and loggin on via ssh I receive the following error:
setleds: Error reading current flags setting. Maybe you are not on the console?: ioctl KDGKBLED: Inappropriate ioctl for device

#7

this would work
sudo setleds -D +num < /dev/tty1

While I am not sure which tty would impact Kodi (if any)

#8

Hi fzinken,

how should I integrate the command correctly on startup?

If I enter the command
sudo setleds -D +num < /dev/tty1
via ssh, the LED on the keypd turns on. But if I push a button on the keypad, it turns off again.

I have manual keymaps, so that a press on the numbers on the keypad starts playing different radio streams. That’s why I would like that the keypad is automatically turned on on startup.

#9

Normally you could do that via /etc/rc.local but if it switches off after first keypress than that doesn’t help you too much

#10

Yes correct. The LED turns on startup, but it switches off after first keypress (the first keypress has also no other effect).

#11

Has anyone an idea how to solve this problem?
sudo setleds -D +num < /dev/tty1
seems to only turn on the LED, but doesn’t actually activate the keypad.

#12

Hi,

Does the bash script work if called manually?

Thanks Tom.

#13

Are you sure that it’s tty1 that’s being used for the keypad?

FIrst, to rule out a permissions problem, try this:

sudo -i
setleds -D +num < /dev/tty1

and see if that helps. Make sure to exit from the sudo bash after testing

exit

if that does not work, try this:

sudo -i
INITTY=/dev/tty[0-8]
for tty in $INITTY; do
     setleds -D +num < $tty
done

and again test. If that works you will need to try each tty until you find the correct one.

Don’t forget to exit the elevated bash when done testing.

1 Like
#14

Hi bmillham,

no I’m not sure that tty1 is the correct one.

I tried your suggested commands:

sudo -i
setleds -D +num < /dev/tty1
exit

It turns on the LED, but has no other effect. If I press one of the numbers, the LED turns off again.

Also your 2nd suggestion

sudo -i
INITTY=/dev/tty[0-8]
for tty in $INITTY; do
     setleds -D +num < $tty
done

had the same effect. It turned on the LED, but the keypad is not enabled. I also rebooted the raspberry between my tests. Unfortunately it didn’t help.

#15

Hi,

I’ve found some time to test this, setleds works as expected on the console and I can reproduce the led switching off within kodi. I’ve done some digging and unfortunately kodi doesn’t have any access to tty(s), this would explain why setleds is not working.

Unfortunately I don’t think there is going to easy solution to this, from googling I can only find the 2 solutions listed above:

numlockx - Requires X11, although x11 can be installed; you have to exit kodi before you can use it.

setleds - Kodi can’t access tty(s), so again kodi needs to be not running for this to work.

I know its a pain, but the best solution may just be to press numlock after startup. Raspberry pi’s are designed to always be on, so you shouldn’t be required to press numlock to often.

Regards Tom.