diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-05-20 18:56:14 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-05-20 18:56:14 +0000 |
commit | 05c80e089254de1a81dba682888d2b0fbfd755ce (patch) | |
tree | 8420c219c8f334bb6ec77acb5e51a3872bb2461e /nuttx/graphics/nxconsole | |
parent | 06eb8df01392ea77c3d62bb316ca1307a7c20363 (diff) |
NxWM::CNxConsole and NXWidgets::CCallback can now redirect keyboard input to the NxConsole driver
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4754 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/graphics/nxconsole')
-rw-r--r-- | nuttx/graphics/nxconsole/Make.defs | 2 | ||||
-rwxr-xr-x | nuttx/graphics/nxconsole/nxcon_driver.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxconsole/nxcon_internal.h | 16 | ||||
-rw-r--r-- | nuttx/graphics/nxconsole/nxcon_kbdin.c | 13 | ||||
-rw-r--r-- | nuttx/graphics/nxconsole/nxcon_register.c | 4 |
5 files changed, 25 insertions, 12 deletions
diff --git a/nuttx/graphics/nxconsole/Make.defs b/nuttx/graphics/nxconsole/Make.defs index 03747763a7..a57b228850 100644 --- a/nuttx/graphics/nxconsole/Make.defs +++ b/nuttx/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/nuttx/graphics/nxconsole/nxcon_driver.c b/nuttx/graphics/nxconsole/nxcon_driver.c index d90218e60f..c647f97bba 100755 --- a/nuttx/graphics/nxconsole/nxcon_driver.c +++ b/nuttx/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/nuttx/graphics/nxconsole/nxcon_internal.h b/nuttx/graphics/nxconsole/nxcon_internal.h index 47a51663f2..dc976a6620 100644 --- a/nuttx/graphics/nxconsole/nxcon_internal.h +++ b/nuttx/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/nuttx/graphics/nxconsole/nxcon_kbdin.c b/nuttx/graphics/nxconsole/nxcon_kbdin.c index d88505ab9c..5914d40697 100644 --- a/nuttx/graphics/nxconsole/nxcon_kbdin.c +++ b/nuttx/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/nuttx/graphics/nxconsole/nxcon_register.c b/nuttx/graphics/nxconsole/nxcon_register.c index 3eea4e67ae..cadda73941 100644 --- a/nuttx/graphics/nxconsole/nxcon_register.c +++ b/nuttx/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 |