madhu Posted September 5, 2016 Report Share Posted September 5, 2016 (edited) 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 September 5, 2016 by madhu Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted September 5, 2016 Report Share Posted September 5, 2016 You can use the GINPUT Toggle driver interface for that. Once you implemented you board file, you can use gwinAttachToggle() to attach a physical button to a toggle input role of a widget. Similarly you can use the GINPUT Dial interface for analog inputs (rotary encoders, potentiometers, ...). Link to comment Share on other sites More sharing options...
madhu Posted September 6, 2016 Author Report Share Posted September 6, 2016 (edited) 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 September 6, 2016 by madhu Link to comment Share on other sites More sharing options...
inmarket Posted September 7, 2016 Report Share Posted September 7, 2016 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 More sharing options...
madhu Posted September 7, 2016 Author Report Share Posted September 7, 2016 Hi, Thanks for the response. Is there any inbuilt keyboard driver? Is there a physical keyboard demo in ugfx? Link to comment Share on other sites More sharing options...
inmarket Posted September 8, 2016 Report Share Posted September 8, 2016 Yes and yes. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted September 9, 2016 Report Share Posted September 9, 2016 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 More sharing options...
madhu Posted September 10, 2016 Author Report Share Posted September 10, 2016 Hi, I'm getting following error when I'm building physical keyboard demo (/demo/module/ginput/keyboard). I'm building this demo for arm with linux frambuffer support. undefined reference to `GKEYBOARDVMT_OnlyOne' Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted September 11, 2016 Report Share Posted September 11, 2016 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 More sharing options...
inmarket Posted September 12, 2016 Report Share Posted September 12, 2016 It would be possible to write a keyboard driver for /dev/tty and it should be a simple driver. We have not had a need yet to do so and so it has not been written yet. If that would solve your problem and you are happy to write it we would love to add it to the repository. Link to comment Share on other sites More sharing options...
madhu Posted September 20, 2016 Author Report Share Posted September 20, 2016 Hi, Will ugfx supports arrow buttons in physical keyboard(Down, up, side)..? Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted September 20, 2016 Report Share Posted September 20, 2016 Yes. Link to comment Share on other sites More sharing options...
madhu Posted September 21, 2016 Author Report Share Posted September 21, 2016 But physical keyboard arrow keys are not working with SDL only TAB and Enter are working. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted September 21, 2016 Report Share Posted September 21, 2016 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 More sharing options...
inmarket Posted September 23, 2016 Report Share Posted September 23, 2016 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 More sharing options...
madhu Posted September 26, 2016 Author Report Share Posted September 26, 2016 Hi, Its true @inmarket I want to use arrow keys for changing the focus between buttons. Is there any alternate option for using arrow keys for buttons navigation. Link to comment Share on other sites More sharing options...
inmarket Posted September 26, 2016 Report Share Posted September 26, 2016 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 More sharing options...
Joel Bodenmann Posted September 26, 2016 Report Share Posted September 26, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now