diff --git a/graphics/nxconsole/Make.defs b/graphics/nxconsole/Make.defs index 03747763a7..a57b228850 100644 --- a/graphics/nxconsole/Make.defs +++ b/graphics/nxconsole/Make.defs @@ -40,7 +40,7 @@ NXCON_CSRCS += nxcon_vt100.c nxcon_unregister.c nxtk_register.c NXCON_CSRCS += nxtool_register.c ifeq ($(CONFIG_NXCONSOLE_NXKBDIN),y) -NXCON_CSRCS += nxcon_kbdin.c +NXCON_CSRCS += nxcon_kbdin.c endif ifeq ($(CONFIG_DEBUG),y) diff --git a/graphics/nxconsole/nxcon_driver.c b/graphics/nxconsole/nxcon_driver.c index d90218e60f..c647f97bba 100755 --- a/graphics/nxconsole/nxcon_driver.c +++ b/graphics/nxconsole/nxcon_driver.c @@ -128,7 +128,7 @@ static int nxcon_open(FAR struct file *filep) #ifndef CONFIG_NXCONSOLE_NXKBDIN if ((filep->f_oflags & O_RDOK) != 0) { - gdbg("Attempted open with read access\n"); + gdbg("ERROR: Attempted open with read access\n"); return -EACCES; } #endif diff --git a/graphics/nxconsole/nxcon_internal.h b/graphics/nxconsole/nxcon_internal.h index 47a51663f2..dc976a6620 100644 --- a/graphics/nxconsole/nxcon_internal.h +++ b/graphics/nxconsole/nxcon_internal.h @@ -144,20 +144,20 @@ struct nxcon_state_s #ifdef CONFIG_DEBUG pid_t holder; /* Deadlock avoidance */ #endif + uint8_t minor; /* Device minor number */ /* Text output support */ - struct nxgl_point_s fpos; /* Next display position */ - - uint16_t maxchars; /* Size of the bm[] array */ - uint16_t nchars; /* Number of chars in the bm[] array */ - - uint8_t minor; /* Device minor number */ uint8_t fheight; /* Max height of a font in pixels */ uint8_t fwidth; /* Max width of a font in pixels */ uint8_t spwidth; /* The width of a space */ uint8_t maxglyphs; /* Size of the glyph[] array */ + uint16_t maxchars; /* Size of the bm[] array */ + uint16_t nchars; /* Number of chars in the bm[] array */ + + struct nxgl_point_s fpos; /* Next display position */ + /* VT100 escape sequence processing */ char seq[VT100_MAX_SEQUENCE]; /* Buffered characters */ @@ -210,8 +210,8 @@ extern const struct file_operations g_nxcon_drvrops; int nxcon_semwait(FAR struct nxcon_state_s *priv); int nxcon_sempost(FAR struct nxcon_state_s *priv); #else -# define nxcon_semwait(p) sem_wait(&p->exclsem); -# define nxcon_sempost(p) sem_post(&p->exclsem); +# define nxcon_semwait(p) sem_wait(&p->exclsem) +# define nxcon_sempost(p) sem_post(&p->exclsem) #endif /* Common device registration */ diff --git a/graphics/nxconsole/nxcon_kbdin.c b/graphics/nxconsole/nxcon_kbdin.c index d88505ab9c..5914d40697 100644 --- a/graphics/nxconsole/nxcon_kbdin.c +++ b/graphics/nxconsole/nxcon_kbdin.c @@ -126,6 +126,7 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len) ret = nxcon_semwait(priv); if (ret < 0) { + gdbg("ERROR: nxcon_semwait failed\n"); return ret; } @@ -198,6 +199,8 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len) int errval = errno; + gdbg("ERROR: nxcon_semwait failed\n"); + /* Were we awakened by a signal? Did we read anything before * we received the signal? */ @@ -283,6 +286,7 @@ int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) ret = nxcon_semwait(priv); if (ret < 0) { + gdbg("ERROR: nxcon_semwait failed\n"); return ret; } @@ -310,6 +314,8 @@ int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) if (i >= CONFIG_NXCONSOLE_NPOLLWAITERS) { + gdbg("ERROR: Too many poll waiters\n"); + fds->priv = NULL; ret = -EBUSY; goto errout; @@ -343,6 +349,8 @@ int nxcon_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup) #ifdef CONFIG_DEBUG if (!slot) { + gdbg("ERROR: No slot\n"); + ret = -EIO; goto errout; } @@ -361,7 +369,7 @@ errout: #endif /**************************************************************************** - * Name: nxcon_kdbin + * Name: nxcon_kbdin * * Description: * This function should be driven by the window kbdin callback function @@ -386,13 +394,14 @@ errout: * ****************************************************************************/ -void nxcon_kdbin(NXCONSOLE handle, FAR const uint8_t *buffer, uint8_t buflen) +void nxcon_kbdin(NXCONSOLE handle, FAR const uint8_t *buffer, uint8_t buflen) { FAR struct nxcon_state_s *priv; ssize_t nwritten; int nexthead; char ch; + gvdbg("buflen=%d\n"); DEBUGASSERT(handle); /* Get the reference to the driver structure from the handle */ diff --git a/graphics/nxconsole/nxcon_register.c b/graphics/nxconsole/nxcon_register.c index 3eea4e67ae..cadda73941 100644 --- a/graphics/nxconsole/nxcon_register.c +++ b/graphics/nxconsole/nxcon_register.c @@ -99,6 +99,10 @@ FAR struct nxcon_state_s * memcpy(&priv->wndo, wndo, sizeof( struct nxcon_window_s)); sem_init(&priv->exclsem, 0, 1); +#ifdef CONFIG_DEBUG + priv->holder = NO_HOLDER; +#endif + #ifdef CONFIG_NXCONSOLE_NXKBDIN sem_init(&priv->waitsem, 0, 0); #endif diff --git a/include/nuttx/nx/nxconsole.h b/include/nuttx/nx/nxconsole.h index 57324e5dad..6ff7192377 100644 --- a/include/nuttx/nx/nxconsole.h +++ b/include/nuttx/nx/nxconsole.h @@ -100,7 +100,7 @@ * CONFIG_NXCONSOLE_NXKBDIN * Take input from the NX keyboard input callback. By default, keyboard * input is taken from stdin (/dev/console). If this option is set, then - * the interface nxcon_kdbin() is enabled. That interface may be driven + * the interface nxcon_kbdin() is enabled. That interface may be driven * by window callback functions so that keyboard input *only* goes to the * top window. * CONFIG_NXCONSOLE_KBDBUFSIZE @@ -328,7 +328,7 @@ EXTERN void nxcon_redraw(NXCONSOLE handle, FAR const struct nxgl_rect_s *rect, bool more); /**************************************************************************** - * Name: nxcon_kdbin + * Name: nxcon_kbdin * * Description: * This function should be driven by the window kbdin callback function @@ -354,7 +354,7 @@ EXTERN void nxcon_redraw(NXCONSOLE handle, FAR const struct nxgl_rect_s *rect, ****************************************************************************/ #ifdef CONFIG_NXCONSOLE_NXKBDIN -EXTERN void nxcon_kdbin(NXCONSOLE handle, FAR const uint8_t *buffer, +EXTERN void nxcon_kbdin(NXCONSOLE handle, FAR const uint8_t *buffer, uint8_t buflen); #endif