DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
In apps/examples/nxterm, nxterm_listener.c is the thread that drives nx_eventhandler(). The normal window NX keyboard callback is the function nxwndo_kbdin() in nxterm_wndo.c. That callback function is just a stub that writes the keyboard data to stdout. It is a stub because keyboard input is not received from the NxTerm in this example.
...
apps/examples/nxterm does not do things in the normal way, however. NSH does not receive keyboard input from NX; it gets keyboard input directly from the default stdin which is probably not a keyboard at all but more likely the host PC serial console. This is okay because only the background a single window is used and that example does not need the help of NX to select the window that has focus.
...
stdin in and stderr are re-directed to the NxTerm character driver in nxterm_main.c just before starting the console task. That logic looks like this:
/* Now re-direct stdout and stderr so that they use the NX console driver. * Note that stdin is retained (file descriptor 0, probably the serial * console). */
...
Note that stdin is not re-directed in this example! This means that keyboard input does not come from the NxTerm driver but, rather, from whatever input device was previously configured for stdin, often a serial console.
There is a configuration option that determines if NxTerm receives keyboard input or not: CONFIG_NXTERM_NXKBDIN, For this NxTerm example, that option can be disabled
What Is BOARDIOC_NXTERM_IOCTL and Where Is It Used?
The boardctl() command BOARDIOC_NXTERM_IOCTL allows an application to inject keyboard data into NX for forwarding to the window with focus. In apps/examples/nxterm, the BOARDIOC_NXTERM_IOCTL is only called for the case of a redraw event. A redraw event may happen when a window above the current window is moved and the text is exposed.
If you use only the background a single window for the NxTerm example, then the background that window will always have focus. It will always have focus and will never be redrawn and the BOARDIOC_NXTERM_IOCTL will never be used (Unless, perhaps, you choose to implement pop-up error messages or menus on top of the NxTerm backgroundwindow).
Redraw callbacks will not be received even in a multi-window configuration if you use per-window frame buffers, either. In that case, the system will automatically redraw windows as needed using the per-window frame buffer shadow memory. This is controlled by the option CONFIG_NX_RAMBACKED. This option is recommended for performance reasons if you have sufficient memory to support it.
Keyboard Data Flow
Keyboard Data Flow in apps/examples/nxterm
- Character input driver receives input
- NSH receives input on stdin and processes it (stdin is not redirected)
- Data is output to stdout (redirected to the NxTerm driver)
In this simple, backgroundsingle-window -only case, BOARDIOC_NXTERM_IOCTL will never be used.
...