Matrix-keypad

Hi, I would like to use a matrix keypad (4x4) to control osmc (browse menus, start movies, stop and pause them, etc). According to this page,

Raspberry Pi – Subjektive Wahrnehmung (I edited, the url has changed, this one shows all raspberry post on the blog, gpio-keys is there too)

there is a way to use a driver instead of polling row and columns with a code. As I have a raspberry pi zero, cpu usage is important.

I noticed that gpio-keys is already present in osmc but it could be interresting to use matrix-keypad driver for those who need more keys (less gpio pin used this way, 8 for 16 keys).

Is there a way to add matrix-keypad module, I can ssh and do it via command line if needed but I am new to this overlay thing.

thanks

The instructions you linked to says to run sudo modinfo matrix-keypad to find out if the driver is installed. Did you do that? When I try it on mine it seems to be already installed…

osmc@kodi_cave:~$ sudo modinfo matrix-keypad
filename:       /lib/modules/4.19.122-1-osmc/kernel/drivers/input/keyboard/matrix_keypad.ko
alias:          platform:matrix-keypad
license:        GPL v2
description:    GPIO Driven Matrix Keypad Driver
author:         Marek Vasut <marek.vasut@gmail.com>
srcversion:     DD9CE2D3AB1816B2A6662F0
alias:          of:N*T*Cgpio-matrix-keypadC*
alias:          of:N*T*Cgpio-matrix-keypad
depends:        matrix-keymap
intree:         Y
name:           matrix_keypad
vermagic:       4.19.122-1-osmc SMP preempt mod_unload modversions ARMv7 p2v8

thanks for the reply,

this is the first thing I did to see if it was available, maybe it has to do with the kernel version. do you have a pi zero too or you have another model?

I checked with my RPi 3b+. I don’t own a zero, and I got rid of all my original RPi’s years ago.

ok, I just updated my osmc just to be sure and no luck, from sudo modinfo matrix-keypad I got this.

Last login: Wed May 13 19:54:13 EDT 2020 on ttyAMA0
Linux osmc 4.19.122-1-osmc #1 PREEMPT Wed May 27 04:13:18 UTC 2020 armv6l
osmc@osmc:~$ sudo modinfo matrix-keypad
modinfo: ERROR: Module matrix-keypad not found.
osmc@osmc:~$

I browsed on it with command line, it should be in the same folder as gpio-keys. unfortunatly it’s not there and my kernel is up to date. Maybe it is not included in the raspberry zero osmc image.

Linux osmc 4.19.122-1-osmc #1 PREEMPT Wed May 27 04:13:18 UTC 2020 armv6l

osmc@osmc:~$ sudo modinfo matrix-keypad
modinfo: ERROR: Module matrix-keypad not found.

osmc@osmc:~$ sudo modinfo gpio-keys
filename: /lib/modules/4.19.122-1-osmc/kernel/drivers/input/keyboard/gpio_ keys.ko
alias: platform:gpio-keys
description: Keyboard driver for GPIOs
author: Phil Blundell pb@handhelds.org
license: GPL
srcversion: 06F5A4302CFCAB3BE669A6B
alias: of:NTCgpio-keysC*
alias: of:NTCgpio-keys
depends:
intree: Y
name: gpio_keys
vermagic: 4.19.122-1-osmc preempt mod_unload modversions ARMv6 p2v8

osmc@osmc:/lib/modules$ ls
4.19.122-1-osmc 4.19.55-6-osmc

osmc@osmc:/lib/modules/4.19.122-1-osmc/kernel/drivers/input$ ls
evdev.ko gameport joydev.ko keyboard serio
ff-memless.ko input-polldev.ko joystick misc touchscreen

osmc@osmc:/lib/modules/4.19.122-1-osmc/kernel/drivers/input$ cd keyboard
osmc@osmc:/lib/modules/4.19.122-1-osmc/kernel/drivers/input/keyboard$ ls
gpio_keys.ko gpio_keys_polled.ko

osmc@osmc:/lib/modules/4.19.55-6-osmc/kernel/drivers/input/keyboard$ ls
gpio_keys.ko gpio_keys_polled.ko

You’re right, it’s not included in the rbp1 image, though, as already discussed, it does appear in the rbp2/3 image.

This is simply down to the different kernel compile options used:

Rbp1:

user@erp1:/tmp/boot$ grep MATRIX config-4.19.122-1-osmc
# CONFIG_INPUT_MATRIXKMAP is not set
# CONFIG_KEYBOARD_MATRIX is not set

Rbp2/3:

osmc@osmc:/boot$ grep MATRIX config-4.19.122-1-osmc
CONFIG_INPUT_MATRIXKMAP=m
CONFIG_KEYBOARD_MATRIX=m

I don’t know why Sam excluded the options for the rbp1 image.

I can get these included.

Sam

thanks, I think this option would be very useful for those owning a pi zero, those boards are useful but sometimes, just one usb is far from enough to do what we want especially when it is a not a zero W and I would have done it with IR but unfortunatly can’t find a tsop receiver in my scrap electronics so I will have to order some and wait several weeks.

Is it possible to add these without recompiling the whole kernel?

No – but this is on my list to do.

Sam

ok, thanks for your answer

Hello everyone!

More than a year has passed since the last post. I suggest raising this topic again.
Now i have an urgent need to use the matrix keyboard. My project uses the “matrix-keypad” module in Raspbian to manage some functionality.
Now I am migrate completely to OSMC and in the latest version of OSMC for Raspberry Pi Zero W the “matrix-keypad” module is still missing.

What i need to do to run this module on OSMC ?

Thank you.

Unfortunately Pi Zero W is based on the original Pi and is no longer receiving updates / support.
You could consider compiling the kernel from source.