Jump to content

key mapping to screen


madhu

Recommended Posts

Hi.

My screen  doesn't have touch support. But my board got few button.So I need to Map  those buttons to my screen.But I don't have any idea how to start it.please help if some knows how to do it.

Note:I'm running Linux 3.0 on my board.

Edited by madhu
Link to comment
Share on other sites

Hi,

whatever the keys  I'm using are gpio keys(Total 6 keys) . I have written a small  C application to print key events.

Following are the keys with event codes.

event type 0 (Sync)

event type 1(Key)

event code   1:Esc

event code 28:Enter

event code 103:Up

event code 105:Left

event code 106:Right

event code 108:Down

Here I have a bit confusion how to write a board file with these keys.

 

Edited by madhu
Link to comment
Share on other sites

It looks like these are being exposed as a keyboard rather than as true gpio pins. In that case you want a keyboard driver rather than a toggle driver. A toggle driver is used when the switches affect sigular gpio pins. A keyboard driver is used when the switches are mapped to key or event codes.

Link to comment
Share on other sites

On 9/7/2016 at 14:27, madhu said:

Is there any inbuilt keyboard driver?

Yes, the GINPUT module has a keyboard input driver. Various drivers can be found in the /drivers directory.

 

On 9/7/2016 at 14:27, madhu said:

Is there a physical keyboard demo in ugfx?

You can find a demo for using the GINPUT keyboard interface under /demos/ginput/keyboard.

 

This is somewhat related: 

 

Link to comment
Share on other sites

You are getting that error message because no keyboard driver was linked while GINPUT_NEED_KEYBOARD was set to TRUE.

The /boards/base/multiple/Linux-Framebuffer board files don't include a keyboard input driver, neither does /boards/base/multiple/Linux-Framebuffer-Touch. Right now only the Linux board files for SDL (recommended) include the keyboard input drivers. That is due to the fact that SDL provides a common high-level API interface for interfacing keyboards. The Linux framebuffer itself has nothing to do with keyboards and hence doesn't know how to interface them.
The most proper solution is writing a generic Linux event input system driver for keyboards, similar (or exactly the same) as the one for the mouse/touchscreen: 

 

Link to comment
Share on other sites

  • 2 weeks later...

I just tested it on an Ubuntu 16 64-bit computer - works well. All keys are recognized as they should be including the arrow keys. The /demos/modules/ginput/keyboard demo together with the /drivers/multiple/SDL driver was used for testing.

If you are using some custom made driver for a custom keyboard as per your initial question - most likely there will be something wrong in your mapping.

Link to comment
Share on other sites

I suspect that @madhu is wanting to use the arrow keys for navigation between controls.

It is true that the keyboard will generate arrow key events however the window manager doesn't currently recognise those keys to change the window that has the focus.

It needs to be put on the todo list. It will always be a config option as arrow keys are also useful for things like sliders. 

Link to comment
Share on other sites

Yes - A virtual mouse. There is an idea, perhaps we could write a mouse driver that uses the arrow keys or gpio toggles to implement the mouse. :) That however would also require a screen mouse pointer - something we don't currently support.

In reality it shouldn't be too hard to add the arrow key support to the window manager. We currently support using the tab key to move between controls so it is just a matter of adding a new switch element and some routines to find controls based on their position.

Another idea would be to leave left and right arrow keys for use by controls eg inc/dec a slider position and use up and down as equivalents to tab and reverse direction tab. That would probably be easier as their is no need to find controls based on their screen position.

Link to comment
Share on other sites

18 minutes ago, inmarket said:

Another idea would be to leave left and right arrow keys for use by controls eg inc/dec a slider position and use up and down as equivalents to tab and reverse direction tab. That would probably be easier as their is no need to find controls based on their screen position.

Just an insider information in case of @madhu decides to implement it that way: The list that the built-in window manager uses is a uni-direction list in order to safe resources. Back-Tab is currently not supported/implemented at all. Code needs to be added that overflows the list to find the previous item.

That being said, it's also possible to write your own window manager and using that by using gwinSetWindowManager().

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...