Correct use of the BOARDIOC_GRAPHICS_SETUP boardctl() call

This commit is contained in:
Gregory Nutt 2015-04-16 07:39:00 -06:00
parent 90d0300d46
commit b76ec96bfb

View File

@ -127,15 +127,25 @@ CNxServer::~CNxServer(void)
bool CNxServer::connect(void) bool CNxServer::connect(void)
{ {
#if defined(CONFIG_NXWIDGETS_EXTERNINIT) #if defined(CONFIG_NXWIDGETS_EXTERNINIT)
struct boardioc_graphics_s devinfo;
int ret;
// Use external graphics driver initialization // Use external graphics driver initialization
m_hDevice = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_NXWIDGETS_DEVNO); printf("nxtext_initialize: Initializing external graphics device\n");
if (!m_hDevice)
devinfo.devno = CONFIG_NXWIDGETS_DEVNO;
devinfo.dev = NULL;
ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
if (ret < 0)
{ {
gdbg("boardctl failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO); gdbg("boardctl failed, devno=%d: %d\n", CONFIG_NXWIDGETS_DEVNO, errno);
return false; return false;
} }
m_hDevice = devinfo.dev;
#elif defined(CONFIG_NX_LCDDRIVER) #elif defined(CONFIG_NX_LCDDRIVER)
int ret; int ret;
@ -359,15 +369,25 @@ int CNxServer::server(int argc, char *argv[])
int ret; int ret;
#if defined(CONFIG_NXWIDGETS_EXTERNINIT) #if defined(CONFIG_NXWIDGETS_EXTERNINIT)
struct boardioc_graphics_s devinfo;
int ret;
// Use external graphics driver initialization // Use external graphics driver initialization
dev = boardctl(BOARDIOC_GRAPHICS_SETUP, CONFIG_NXWIDGETS_DEVNO); printf("nxtext_initialize: Initializing external graphics device\n");
if (!dev)
devinfo.devno = CONFIG_NXWIDGETS_DEVNO;
devinfo.dev = NULL;
ret = boardctl(BOARDIOC_GRAPHICS_SETUP, (uintptr_t)&devinfo);
if (ret < 0)
{ {
gdbg("boardctl failed, devno=%d\n", CONFIG_NXWIDGETS_DEVNO); gdbg("boardctl failed, devno=%d: %d\n", CONFIG_NXWIDGETS_DEVNO, errno);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
dev = devinfo.dev;
#elif defined(CONFIG_NX_LCDDRIVER) #elif defined(CONFIG_NX_LCDDRIVER)
// Initialize the LCD device // Initialize the LCD device