configs/boardctl.c, include/sys/boardctl.h: Add a command to start the VNC server.

This commit is contained in:
Gregory Nutt 2019-04-02 06:32:55 -06:00
parent 870aa61a49
commit 94c691edc9
2 changed files with 68 additions and 27 deletions

View File

@ -53,6 +53,10 @@
# include <nuttx/nx/nxmu.h>
#endif
#ifdef CONFIG_VNCSERVER
# include <nuttx/video/vnc.h>
#endif
#ifdef CONFIG_BOARDCTL_USBDEVCTRL
# include <nuttx/usb/cdcacm.h>
# include <nuttx/usb/pl2303.h>
@ -411,9 +415,9 @@ int boardctl(unsigned int cmd, uintptr_t arg)
#ifdef CONFIG_NX
/* CMD: BOARDIOC_NX_START
* DESCRIPTION: Start the NX servier
* DESCRIPTION: Start the NX server
* ARG: Integer display number to be served by this NXMU
( instance.
* instance.
* CONFIGURATION: CONFIG_NX
* DEPENDENCIES: Base graphics logic provides nxmu_start()
*/
@ -430,6 +434,34 @@ int boardctl(unsigned int cmd, uintptr_t arg)
break;
#endif
#ifdef CONFIG_VNCSERVER
/* CMD: BOARDIOC_VNC_START
* DESCRIPTION: Start the NX server and framebuffer driver.
* ARG: A reference readable instance of struct
* boardioc_vncstart_s
* CONFIGURATION: CONFIG_VNCSERVER
* DEPENDENCIES: VNC server provides vnc_default_fbinitialize()
*/
case BOARDIOC_VNC_START:
{
FAR struct boardioc_vncstart_s *vnc =
(FAR struct boardioc_vncstart_s *)arg;
if (vnc == NULL)
{
ret = -EINVAL;
}
else
{
/* Setup the VNC server to support keyboard/mouse inputs */
ret = vnc_default_fbinitialize(vnc->display, vnc->handle);
}
}
break;
#endif
#ifdef CONFIG_NXTERM
/* CMD: BOARDIOC_NXTERM
* DESCRIPTION: Create an NX terminal device

View File

@ -45,6 +45,10 @@
#include <nuttx/fs/ioctl.h>
#ifdef CONFIG_VNCSERVER
# include <nuttx/nx/nx.h>
#endif
#ifdef CONFIG_NXTERM
# include <nuttx/nx/nxterm.h>
#endif
@ -119,6 +123,13 @@
* CONFIGURATION: CONFIG_NX
* DEPENDENCIES: Base graphics logic provides nxmu_start()
*
* CMD: BOARDIOC_VNC_START
* DESCRIPTION: Start the NX server and framebuffer driver.
* ARG: A reference readable instance of struct
* boardioc_vncstart_s
* CONFIGURATION: CONFIG_VNCSERVER
* DEPENDENCIES: VNC server provides vnc_default_fbinitialize()
*
* CMD: BOARDIOC_NXTERM
* DESCRIPTION: Create an NX terminal device
* ARG: A reference readable/writable instance of struct
@ -161,10 +172,11 @@
#define BOARDIOC_OS_SYMTAB _BOARDIOC(0x0007)
#define BOARDIOC_USBDEV_CONTROL _BOARDIOC(0x0008)
#define BOARDIOC_NX_START _BOARDIOC(0x0009)
#define BOARDIOC_NXTERM _BOARDIOC(0x000a)
#define BOARDIOC_NXTERM_REDRAW _BOARDIOC(0x000b)
#define BOARDIOC_NXTERM_KBDIN _BOARDIOC(0x000c)
#define BOARDIOC_TESTSET _BOARDIOC(0x000d)
#define BOARDIOC_VNC_START _BOARDIOC(0x000a)
#define BOARDIOC_NXTERM _BOARDIOC(0x000b)
#define BOARDIOC_NXTERM_REDRAW _BOARDIOC(0x000c)
#define BOARDIOC_NXTERM_KBDIN _BOARDIOC(0x000d)
#define BOARDIOC_TESTSET _BOARDIOC(0x000e)
/* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support.
* In this case, all commands not recognized by boardctl() will be forwarded
@ -173,31 +185,13 @@
* User defined board commands may begin with this value:
*/
#define BOARDIOC_USER _BOARDIOC(0x000e)
#define BOARDIOC_USER _BOARDIOC(0x000f)
/****************************************************************************
* Public Type Definitions
****************************************************************************/
/* Structure used to pass arguments and get returned values from the
* BOARDIOC_GRAPHICS_SETUP command.
*/
#ifdef CONFIG_NX_LCDDRIVER
struct lcd_dev_s; /* Forward reference */
#else
struct fb_vtable_s; /* Forward reference */
#endif
struct boardioc_graphics_s
{
int devno; /* IN: Graphics device number */
#ifdef CONFIG_NX_LCDDRIVER
FAR struct lcd_dev_s *dev; /* OUT: LCD driver instance */
#else
FAR struct fb_vtable_s *dev; /* OUT: Framebuffer driver instance */
#endif
};
/* Structures used with IOCTL commands */
/* In order to full describe a symbol table, a vector containing the address
* of the symbol table and the number of elements in the symbol table is
@ -271,7 +265,19 @@ struct boardioc_usbdev_ctrl_s
};
#endif /* CONFIG_BOARDCTL_USBDEVCTRL */
#ifdef CONFIG_VNCSERVER
/* Argument passed with the BOARDIOC_VNC_START command */
struct boardioc_vncstart_s
{
int display; /* Display number */
NXHANDLE handle; /* Handle returned by nx_connect */
};
#endif
#ifdef CONFIG_NXTERM
/* Arguments passed with the BOARDIOC_NXTERM command */
enum boardioc_termtype_e
{
BOARDIOC_XTERM_RAW = 0, /* Raw NX terminal window */
@ -288,7 +294,8 @@ struct boardioc_nxterm_create_s
uint8_t minor; /* Terminal device minor number, N, in
* /dev/nxtermN. 0 <= N <= 255 */
};
/* Structures used with IOCTL commands */
/* Arguments passed with the BOARDIOC_NXTERM_REDRAW command */
struct boardioc_nxterm_redraw_s
{
@ -298,6 +305,8 @@ struct boardioc_nxterm_redraw_s
};
#ifdef CONFIG_NXTERM_NXKBDIN
/* Arguments passed with the BOARDIOC_NXTERM_KBDIN command */
struct boardioc_nxterm_kbdin_s
{
NXTERM handle; /* NxTerm handle */