summaryrefslogtreecommitdiffstats
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-20 22:10:34 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-20 22:10:34 +0000
commit8a825b60c5ed3404fea9bd945904926ccc4cd792 (patch)
tree33492e787345ddef26740d5a9c1282f59324c2b0 /nuttx
parent05c80e089254de1a81dba682888d2b0fbfd755ce (diff)
Add an NxWM console/keyboard thread and eliminate all issues with NxConsole window serial input
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4755 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/ChangeLog8
-rw-r--r--nuttx/graphics/nxconsole/nxcon_kbdin.c16
-rw-r--r--nuttx/graphics/nxmu/nx_kbdin.c2
3 files changed, 22 insertions, 4 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 2f3d946db3..71534b470d 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2790,3 +2790,11 @@
will receive its input from stdin (/dev/console). This works great but
cannot be shared between different windows. Chaos will ensue if you
try to support multiple NxConsole windows without CONFIG_NXCONSOLE_NXKBDIN
+ * graphics/nxmu/nx_kbdin.c: Fix pointer argument. This is a error
+ introduced in changes leading up to the 6.18 release. This error will
+ cause crashes or perhaps simply not work when you try to handle window
+ keyboard data in multi-user mode.
+ * graphics/nxconsole/nxcon_kdbind.c: Fixed unmatched sem_wait and sem_post.
+ Fix some conditional compilation that included a few too many lines of code.
+
+
diff --git a/nuttx/graphics/nxconsole/nxcon_kbdin.c b/nuttx/graphics/nxconsole/nxcon_kbdin.c
index 5914d40697..f4b116c467 100644
--- a/nuttx/graphics/nxconsole/nxcon_kbdin.c
+++ b/nuttx/graphics/nxconsole/nxcon_kbdin.c
@@ -244,7 +244,7 @@ ssize_t nxcon_read(FAR struct file *filep, FAR char *buffer, size_t len)
/* Relinquish the mutual exclusion semaphore */
- sem_post(&priv->exclsem);
+ nxcon_sempost(priv);
/* Notify all poll/select waiters that they can write to the FIFO */
@@ -400,6 +400,7 @@ void nxcon_kbdin(NXCONSOLE handle, FAR const uint8_t *buffer, uint8_t buflen)
ssize_t nwritten;
int nexthead;
char ch;
+ int ret;
gvdbg("buflen=%d\n");
DEBUGASSERT(handle);
@@ -408,6 +409,15 @@ void nxcon_kbdin(NXCONSOLE handle, FAR const uint8_t *buffer, uint8_t buflen)
priv = (FAR struct nxcon_state_s *)handle;
+ /* Get exclusive access to the driver structure */
+
+ ret = nxcon_semwait(priv);
+ if (ret < 0)
+ {
+ gdbg("ERROR: nxcon_semwait failed\n");
+ return;
+ }
+
/* Loop until all of the bytes have been written. This function may be
* called from an interrupt handler! Semaphores cannot be used!
*
@@ -451,7 +461,6 @@ void nxcon_kbdin(NXCONSOLE handle, FAR const uint8_t *buffer, uint8_t buflen)
/* Was anything written? */
-#ifndef CONFIG_DISABLE_POLL
if (nwritten > 0)
{
int i;
@@ -468,10 +477,11 @@ void nxcon_kbdin(NXCONSOLE handle, FAR const uint8_t *buffer, uint8_t buflen)
/* Notify all poll/select waiters that they can write to the FIFO */
+#ifndef CONFIG_DISABLE_POLL
nxcon_pollnotify(priv, POLLIN);
+#endif
sched_unlock();
}
-#endif
nxcon_sempost(priv);
}
diff --git a/nuttx/graphics/nxmu/nx_kbdin.c b/nuttx/graphics/nxmu/nx_kbdin.c
index ac044bec70..b4b91298b4 100644
--- a/nuttx/graphics/nxmu/nx_kbdin.c
+++ b/nuttx/graphics/nxmu/nx_kbdin.c
@@ -113,7 +113,7 @@ int nx_kbdin(NXHANDLE handle, uint8_t nch, FAR const uint8_t *ch)
outmsg->ch[i] = ch[i];
}
- ret = nxmu_sendserver(conn, &outmsg, size);
+ ret = nxmu_sendserver(conn, outmsg, size);
free(outmsg);
return ret;