matrix_keyboard based driver

3 messages, 2 authors, 2011-11-22 · open the first message on its own page

matrix_keyboard based driver

From: Christian Gmeiner <christian.gmeiner@gmail.com>
Date: 2011-11-21 13:52:39

Hi all,

today I started with a basic matrix_keyboard based keypad driver. It
seems to work quite
well but I have some questions.

Is it possible to define following values from user space?

* debounce time in [ms]
* auto repeat time in [ms]
* multi click abort time in [ms]

I am also not sure about the default keymap I should use in the
platform_data. At
the moment it looks like:

static const uint32_t ot200_keymap[] = {
	KEY(0, 1, 0x01),
	KEY(0, 2, 0x02),
	KEY(0, 3, 0x03),
	KEY(0, 4, 0x04),
	KEY(0, 5, 0x05),
	KEY(0, 6, 0x06),
	KEY(0, 7, 0x07),
	KEY(0, 8, 0x08),
	KEY(0, 9, 0x09),
...
...
	KEY(9, 6, 0x96),
	KEY(9, 7, 0x97),
	KEY(9, 8, 0x98),
	KEY(9, 9, 0x99),
};

I need to configure the mapping from userspace and it is be done via loadkeys
if I am not wrong. Does the input core handle cases like SHIFT key and
CAPS lock?

thanks
--
Christian Gmeiner, MSc

Re: matrix_keyboard based driver

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2011-11-21 17:27:21

Hi CHristian,

On Mon, Nov 21, 2011 at 02:52:17PM +0100, Christian Gmeiner wrote:
Hi all,

today I started with a basic matrix_keyboard based keypad driver. It
seems to work quite
well but I have some questions.

Is it possible to define following values from user space?

* debounce time in [ms]
No as it is mostly hardware property, not user preference.
* auto repeat time in [ms]
Yes: EVIOCSREP (kbdrate or similar). Note that X ignores kernel
autorepeat and implements its own.
* multi click abort time in [ms]
I have no idea what that is, so apparently no ;)
I am also not sure about the default keymap I should use in the
platform_data. At
the moment it looks like:

static const uint32_t ot200_keymap[] = {
	KEY(0, 1, 0x01),
	KEY(0, 2, 0x02),
	KEY(0, 3, 0x03),
	KEY(0, 4, 0x04),
	KEY(0, 5, 0x05),
	KEY(0, 6, 0x06),
	KEY(0, 7, 0x07),
	KEY(0, 8, 0x08),
	KEY(0, 9, 0x09),
...
...
	KEY(9, 6, 0x96),
	KEY(9, 7, 0x97),
	KEY(9, 8, 0x98),
	KEY(9, 9, 0x99),
The last items in triplets should be KEY_* constant defined in
include/linux/input.h
};

I need to configure the mapping from userspace and it is be done via loadkeys
if I am not wrong.
To adjust mapping of the input device itself one should use 'setkeycode'
or some other utility issuing EVIOCGKEYCODE/EVIOCSKEYCODE ioctls.

loadkeys adjusts higher level keymap used by the console.
Does the input core handle cases like SHIFT key and
CAPS lock?
No, that is the task for higher layers (console, X, etc...).

Thanks.

-- 
Dmitry

Re: matrix_keyboard based driver

From: Christian Gmeiner <christian.gmeiner@gmail.com>
Date: 2011-11-22 12:53:05

Hi Dmitry,

2011/11/21 Dmitry Torokhov [off-list ref]:
Hi CHristian,

On Mon, Nov 21, 2011 at 02:52:17PM +0100, Christian Gmeiner wrote:
quoted
Hi all,

today I started with a basic matrix_keyboard based keypad driver. It
seems to work quite
well but I have some questions.

Is it possible to define following values from user space?

* debounce time in [ms]
No as it is mostly hardware property, not user preference.
Okay... lets see If i need to do this in hardware.
quoted
* auto repeat time in [ms]
Yes: EVIOCSREP (kbdrate or similar). Note that X ignores kernel
autorepeat and implements its own.
Fine.
quoted
* multi click abort time in [ms]
I have no idea what that is, so apparently no ;)
At the moment I have a uinput based user space program,
which gets the matrix coordinates and send back the pressed
key. And there it is possible to enter a handy-like input method.

press 3 times in a short time the letter 1 on the keypad and the
uinput based program sends a 'c' to the kernel.

quoted
I am also not sure about the default keymap I should use in the
platform_data. At
the moment it looks like:

static const uint32_t ot200_keymap[] = {
      KEY(0, 1, 0x01),
      KEY(0, 2, 0x02),
      KEY(0, 3, 0x03),
      KEY(0, 4, 0x04),
      KEY(0, 5, 0x05),
      KEY(0, 6, 0x06),
      KEY(0, 7, 0x07),
      KEY(0, 8, 0x08),
      KEY(0, 9, 0x09),
...
...
      KEY(9, 6, 0x96),
      KEY(9, 7, 0x97),
      KEY(9, 8, 0x98),
      KEY(9, 9, 0x99),
The last items in triplets should be KEY_* constant defined in
include/linux/input.h
Okay.. this should be doable... my company offers a way to have their
own mapping of some universal keys on the keypad. for instance it is
possible to assign to a key the action to sending ALT + TAB.
quoted
};

I need to configure the mapping from userspace and it is be done via loadkeys
if I am not wrong.
To adjust mapping of the input device itself one should use 'setkeycode'
or some other utility issuing EVIOCGKEYCODE/EVIOCSKEYCODE ioctls.
So these two ioctls are changing the last value in the triplets of the keymap?
quoted
static const uint32_t ot200_keymap[] = {
      KEY(0, 1, 0x01),
In this case 0x01 will get replaced?
loadkeys adjusts higher level keymap used by the console.
ah okay.
quoted
Does the input core handle cases like SHIFT key and
CAPS lock?
No, that is the task for higher layers (console, X, etc...).
Need to play a little bit with I think.

thanks
--
Christian Gmeiner, MSc
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help