diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-20 18:56:14 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-20 18:56:14 +0000 |
commit | 01bce341a9d065e8250f655c246c07a525779bc0 (patch) | |
tree | 8420c219c8f334bb6ec77acb5e51a3872bb2461e /nuttx/graphics | |
parent | c5ff7843f26438947da8fa0b0fc9b255aeb1d638 (diff) | |
download | px4-nuttx-01bce341a9d065e8250f655c246c07a525779bc0.tar.gz px4-nuttx-01bce341a9d065e8250f655c246c07a525779bc0.tar.bz2 px4-nuttx-01bce341a9d065e8250f655c246c07a525779bc0.zip |
NxWM::CNxConsole and NXWidgets::CCallback can now redirect keyboard input to the NxConsole driver
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4754 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics')
-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 03747763a..a57b22885 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 d90218e60..c647f97bb 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 47a51663f..dc976a662 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 d88505ab9..5914d4069 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 3eea4e67a..cadda7394 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 |