From 94c691edc97da7bb7181bc4cc379b71b1c3d5c51 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 2 Apr 2019 06:32:55 -0600 Subject: [PATCH] configs/boardctl.c, include/sys/boardctl.h: Add a command to start the VNC server. --- configs/boardctl.c | 36 ++++++++++++++++++++++++-- include/sys/boardctl.h | 59 ++++++++++++++++++++++++------------------ 2 files changed, 68 insertions(+), 27 deletions(-) diff --git a/configs/boardctl.c b/configs/boardctl.c index 04fa98a0a1..ea23818347 100644 --- a/configs/boardctl.c +++ b/configs/boardctl.c @@ -53,6 +53,10 @@ # include #endif +#ifdef CONFIG_VNCSERVER +# include +#endif + #ifdef CONFIG_BOARDCTL_USBDEVCTRL # include # include @@ -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 diff --git a/include/sys/boardctl.h b/include/sys/boardctl.h index 1abc5f54a3..6547d18d93 100644 --- a/include/sys/boardctl.h +++ b/include/sys/boardctl.h @@ -45,6 +45,10 @@ #include +#ifdef CONFIG_VNCSERVER +# include +#endif + #ifdef CONFIG_NXTERM # include #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 */