diff --git a/examples/nx/nx_main.c b/examples/nx/nx_main.c index 0b3142e84..c1a38e04f 100644 --- a/examples/nx/nx_main.c +++ b/examples/nx/nx_main.c @@ -1,7 +1,8 @@ /**************************************************************************** * examples/nx/nx_main.c * - * Copyright (C) 2008-2011, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2011, 2015-2016, 2019 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -56,10 +57,6 @@ #include #include -#ifdef CONFIG_VNCSERVER -# include -#endif - #include #include #include @@ -458,15 +455,21 @@ static int nxeg_initialize(void) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, g_hnx); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); - nx_disconnect(g_hnx); - g_exitcode = NXEXIT_FBINITIALIZE; - return ERROR; - } + struct boardioc_vncstart_s vnc = + { + 0, g_hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(g_hnx); + g_exitcode = NXEXIT_FBINITIALIZE; + return ERROR; + } #endif + /* Start a separate thread to listen for server events. This is probably * the least efficient way to do this, but it makes this example flow more * smoothly. diff --git a/examples/nxdemo/nxdemo_main.c b/examples/nxdemo/nxdemo_main.c index fcb96125b..d3f130ef9 100644 --- a/examples/nxdemo/nxdemo_main.c +++ b/examples/nxdemo/nxdemo_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxdemo/nxdemo_main.c * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. + * Copyright (C) 2018-2019 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Cherciu Mihail * @@ -61,9 +61,6 @@ # include #else # include -# ifdef CONFIG_VNCSERVER -# include -# endif #endif #include @@ -148,14 +145,20 @@ static inline int nxdemo_initialize(void) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, g_nxdemo.hnx); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); - nx_disconnect(g_nxdemo.hnx); - return ERROR; - } + struct boardioc_vncstart_s vnc = + { + 0, g_nxdemo.hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(g_nxdemo.hnx); + return ERROR; + } #endif + /* Start a separate thread to listen for server events. This is probably * the least efficient way to do this, but it makes this example flow more * smoothly. diff --git a/examples/nxhello/nxhello_main.c b/examples/nxhello/nxhello_main.c index 9d6a6d3ea..c7be3b656 100644 --- a/examples/nxhello/nxhello_main.c +++ b/examples/nxhello/nxhello_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/nxhello/nxhello_main.c * - * Copyright (C) 2011, 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2015-2017, 2019 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -56,10 +56,6 @@ #include #include -#ifdef CONFIG_VNCSERVER -# include -#endif - #include #include #include @@ -126,14 +122,20 @@ static inline int nxhello_initialize(void) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, g_nxhello.hnx); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); - nx_disconnect(g_nxhello.hnx); - return ERROR; - } + struct boardioc_vncstart_s vnc = + { + 0, g_nxhello.hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(g_nxhello.hnx); + return ERROR; + } #endif + /* Start a separate thread to listen for server events. This is probably * the least efficient way to do this, but it makes this example flow more * smoothly. diff --git a/examples/nximage/nximage_main.c b/examples/nximage/nximage_main.c index 789316229..7d365222a 100644 --- a/examples/nximage/nximage_main.c +++ b/examples/nximage/nximage_main.c @@ -56,10 +56,6 @@ #include #include -#ifdef CONFIG_VNCSERVER -# include -#endif - #include #include #include @@ -130,14 +126,20 @@ static inline int nximage_initialize(void) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, g_nximage.hnx); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); - nx_disconnect(g_nximage.hnx); - return ERROR; - } + struct boardioc_vncstart_s vnc = + { + 0, g_nximage.hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(g_nximage.hnx); + return ERROR; + } #endif + /* Start a separate thread to listen for server events. This is probably * the least efficient way to do this, but it makes this example flow more * smoothly. diff --git a/examples/nxlines/nxlines_main.c b/examples/nxlines/nxlines_main.c index 0f0179798..094b5781b 100644 --- a/examples/nxlines/nxlines_main.c +++ b/examples/nxlines/nxlines_main.c @@ -1,7 +1,8 @@ /**************************************************************************** * examples/nxlines/nxlines_main.c * - * Copyright (C) 2011-2012, 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015-2017, 2019 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -54,10 +55,6 @@ #include #include -#ifdef CONFIG_VNCSERVER -# include -#endif - #include #include @@ -151,14 +148,20 @@ static inline int nxlines_initialize(void) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, g_nxlines.hnx); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); - nx_disconnect(g_nxlines.hnx); - return ERROR; - } + struct boardioc_vncstart_s vnc = + { + 0, g_nxlines.hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(g_nxlines.hnx); + return ERROR; + } #endif + /* Start a separate thread to listen for server events. This is probably * the least efficient way to do this, but it makes this example flow more * smoothly. diff --git a/examples/nxterm/nxterm_main.c b/examples/nxterm/nxterm_main.c index e80b64836..38e98df37 100644 --- a/examples/nxterm/nxterm_main.c +++ b/examples/nxterm/nxterm_main.c @@ -56,9 +56,6 @@ # include #else # include -# ifdef CONFIG_VNCSERVER -# include -# endif #endif #include @@ -142,15 +139,22 @@ static int nxterm_initialize(void) pthread_attr_t attr; #ifdef CONFIG_VNCSERVER - /* Setup the VNC server to support keyboard/mouse inputs */ + /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, g_nxterm_vars.hnx); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); - return ERROR; - } + struct boardioc_vncstart_s vnc = + { + 0, g_nxterm_vars.hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(g_nxterm_vars.hnx); + return ERROR; + } #endif + /* Start a separate thread to listen for server events. This is probably * the least efficient way to do this, but it makes this example flow more * smoothly. diff --git a/examples/nxtext/nxtext_main.c b/examples/nxtext/nxtext_main.c index 92d852fb6..8f8d8a13b 100644 --- a/examples/nxtext/nxtext_main.c +++ b/examples/nxtext/nxtext_main.c @@ -1,7 +1,8 @@ /**************************************************************************** * examples/nxtext/nxtext_main.c * - * Copyright (C) 2011-2012, 2015-2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015-2017, 2019 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -60,9 +61,6 @@ # include #else # include -# ifdef CONFIG_VNCSERVER -# include -# endif #endif #include @@ -204,15 +202,21 @@ static int nxtext_initialize(void) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, g_hnx); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); + struct boardioc_vncstart_s vnc = + { + 0, g_hnx + }; - g_exitcode = NXEXIT_FBINITIALIZE; - return ERROR; - } + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(g_hnx); + g_exitcode = NXEXIT_FBINITIALIZE; + return ERROR; + } #endif + /* Start a separate thread to listen for server events. This is probably * the least efficient way to do this, but it makes this example flow more * smoothly. diff --git a/examples/pwfb/pwfb_main.c b/examples/pwfb/pwfb_main.c index 9859d9383..c029ce47f 100644 --- a/examples/pwfb/pwfb_main.c +++ b/examples/pwfb/pwfb_main.c @@ -57,10 +57,6 @@ #include #include -#ifdef CONFIG_VNCSERVER -# include -#endif - #include #include #include @@ -120,15 +116,22 @@ static bool pwfb_server_initialize(FAR struct pwfb_state_s *st) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, st->hnx); - if (ret < 0) - { - printf("pwfb_server_initialize: ERROR: " - "vnc_default_fbinitialize failed: %d\n", - ret); - nx_disconnect(st->hnx); - return false; - } + struct boardioc_vncstart_s vnc = + { + 0, st->hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("pwfb_server_initialize: ERROR: " + "boardctl(BOARDIOC_VNC_START) failed: %d\n", + ret); + + nx_disconnect(st->hnx); + g_exitcode = NXEXIT_FBINITIALIZE; + return ERROR; + } #endif } else diff --git a/examples/pwlines/pwlines_main.c b/examples/pwlines/pwlines_main.c index a13c3e7cb..8474a4ce4 100644 --- a/examples/pwlines/pwlines_main.c +++ b/examples/pwlines/pwlines_main.c @@ -57,10 +57,6 @@ #include #include -#ifdef CONFIG_VNCSERVER -# include -#endif - #include #include #include @@ -111,15 +107,21 @@ static bool pwlines_server_initialize(FAR struct pwlines_state_s *st) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, st->hnx); - if (ret < 0) - { - printf("pwlines_server_initialize: ERROR: " - "vnc_default_fbinitialize failed: %d\n", - ret); - nx_disconnect(st->hnx); - return false; - } + struct boardioc_vncstart_s vnc = + { + 0, st->hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("pwlines_server_initialize: ERROR: " + "boardctl(BOARDIOC_VNC_START) failed: %d\n", + ret); + + nx_disconnect(st->hnx); + return false; + } #endif } else diff --git a/graphics/NxWidgets/nxwidgets/src/cnxserver.cxx b/graphics/NxWidgets/nxwidgets/src/cnxserver.cxx index ef7cea1a2..f6a2ed815 100644 --- a/graphics/NxWidgets/nxwidgets/src/cnxserver.cxx +++ b/graphics/NxWidgets/nxwidgets/src/cnxserver.cxx @@ -1,7 +1,8 @@ /**************************************************************************** * apps/graphics/NxWidgets/nxwidgets/src/cnxserver.cxx * - * Copyright (C) 2012, 2013, 2015-2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2013, 2015-2016, 2019 Gregory Nutt. All rights + * reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -54,10 +55,6 @@ #include -#ifdef CONFIG_VNCSERVER -# include -#endif - #include "graphics/nxwidgets/nxconfig.hxx" #include "graphics/nxwidgets/singletons.hxx" #include "graphics/nxwidgets/cnxserver.hxx" @@ -161,14 +158,19 @@ bool CNxServer::connect(void) #ifdef CONFIG_VNCSERVER // Setup the VNC server to support keyboard/mouse inputs - ret = vnc_default_fbinitialize(0, m_hNxServer); - if (ret < 0) - { - gerr("ERROR: CNxServer::connect: vnc_default_fbinitialize failed: %d\n", ret); - m_running = false; - disconnect(); - return false; - } + struct boardioc_vncstart_s vnc = + { + 0, m_hNxServer + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + gerr("ERROR: boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + m_running = false; + disconnect(); + return false; + } #endif // Start a separate thread to listen for server events. This is probably diff --git a/graphics/screenshot/screenshot_main.c b/graphics/screenshot/screenshot_main.c index 93dd02cb2..b251d6dc2 100644 --- a/graphics/screenshot/screenshot_main.c +++ b/graphics/screenshot/screenshot_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/examples/screenshot/screenshot_main.c * - * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016, 2019 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Petteri Aimonen * @@ -40,6 +40,7 @@ #include +#include #include #include #include @@ -52,10 +53,6 @@ #include -#ifdef CONFIG_VNCSERVER -# include -#endif - /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ @@ -125,6 +122,9 @@ int save_screenshot(FAR const char *filename) struct tiff_info_s info; struct nx_callback_s cb = {}; struct nxgl_size_s size = {CONFIG_SCREENSHOT_WIDTH, CONFIG_SCREENSHOT_HEIGHT}; +#ifdef CONFIG_VNCSERVER + struct boardioc_vncstart_s vnc; +#endif FAR uint8_t *strip; NXHANDLE server; NXWINDOW window; @@ -146,15 +146,18 @@ int save_screenshot(FAR const char *filename) } #ifdef CONFIG_VNCSERVER - /* Setup the VNC server to support keyboard/mouse inputs */ + /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, server); - if (ret < 0) - { - printf("vnc_default_fbinitialize failed: %d\n", ret); - nx_disconnect(server); - return 1; - } + vnc.display = 0; + vnc.handle = server; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + nx_disconnect(server); + return 1; + } #endif /* Wait for "connected" event */ diff --git a/graphics/traveler/src/trv_graphics.c b/graphics/traveler/src/trv_graphics.c index 6806acf9a..e5e9bdcd4 100644 --- a/graphics/traveler/src/trv_graphics.c +++ b/graphics/traveler/src/trv_graphics.c @@ -58,9 +58,6 @@ #ifdef CONFIG_GRAPHICS_TRAVELER_FB # include #endif -#ifdef CONFIG_VNCSERVER -# include -#endif /**************************************************************************** * Public Data @@ -241,11 +238,16 @@ static inline int trv_nx_initialize(FAR struct trv_graphics_info_s *ginfo) #ifdef CONFIG_VNCSERVER /* Setup the VNC server to support keyboard/mouse inputs */ - ret = vnc_default_fbinitialize(0, ginfo->hnx); - if (ret < 0) - { - trv_abort("vnc_default_fbinitialize failed: %d\n", ret); - } + struct boardioc_vncstart_s vnc = + { + 0, ginfo->hnx + }; + + ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc); + if (ret < 0) + { + trv_abort("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret); + } #endif /* Start a separate thread to listen for server events. This is probably