Run all files modified by pr45 through nxstyle.
This commit is contained in:
parent
37135e5dfe
commit
724a34bd3b
@ -131,53 +131,54 @@ static int nxterm_initialize(void)
|
|||||||
#ifdef CONFIG_VNCSERVER
|
#ifdef CONFIG_VNCSERVER
|
||||||
/* Setup the VNC server to support keyboard/mouse inputs */
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
struct boardioc_vncstart_s vnc =
|
struct boardioc_vncstart_s vnc =
|
||||||
{
|
{
|
||||||
0, g_nxterm_vars.hnx
|
0, g_nxterm_vars.hnx
|
||||||
};
|
};
|
||||||
|
|
||||||
ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc);
|
ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret);
|
printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret);
|
||||||
nx_disconnect(g_nxterm_vars.hnx);
|
nx_disconnect(g_nxterm_vars.hnx);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Start a separate thread to listen for server events. This is probably
|
/* Start a separate thread to listen for server events. This is probably
|
||||||
* the least efficient way to do this, but it makes this example flow more
|
* the least efficient way to do this, but it makes this example flow more
|
||||||
* smoothly.
|
* smoothly.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pthread_attr_init(&attr);
|
pthread_attr_init(&attr);
|
||||||
param.sched_priority = CONFIG_EXAMPLES_NXTERM_LISTENERPRIO;
|
param.sched_priority = CONFIG_EXAMPLES_NXTERM_LISTENERPRIO;
|
||||||
pthread_attr_setschedparam(&attr, ¶m);
|
pthread_attr_setschedparam(&attr, ¶m);
|
||||||
pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXTERM_STACKSIZE);
|
pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXTERM_STACKSIZE);
|
||||||
|
|
||||||
ret = pthread_create(&thread, &attr, nxterm_listener, NULL);
|
ret = pthread_create(&thread, &attr, nxterm_listener, NULL);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
printf("nxterm_initialize: pthread_create failed: %d\n", ret);
|
printf("nxterm_initialize: pthread_create failed: %d\n", ret);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't return until we are connected to the server */
|
/* Don't return until we are connected to the server */
|
||||||
|
|
||||||
while (!g_nxterm_vars.connected)
|
while (!g_nxterm_vars.connected)
|
||||||
{
|
{
|
||||||
/* Wait for the listener thread to wake us up when we really
|
/* Wait for the listener thread to wake us up when we really
|
||||||
* are connected.
|
* are connected.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
sem_wait(&g_nxterm_vars.eventsem);
|
sem_wait(&g_nxterm_vars.eventsem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("nxterm_initialize: nx_connect failed: %d\n", errno);
|
printf("nxterm_initialize: nx_connect failed: %d\n", errno);
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,6 +224,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* General Initialization *************************************************/
|
/* General Initialization *************************************************/
|
||||||
|
|
||||||
/* Reset all global data */
|
/* Reset all global data */
|
||||||
|
|
||||||
printf("nxterm_main: Started\n");
|
printf("nxterm_main: Started\n");
|
||||||
@ -235,6 +237,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* NSH Initialization *****************************************************/
|
/* NSH Initialization *****************************************************/
|
||||||
|
|
||||||
/* Initialize the NSH library */
|
/* Initialize the NSH library */
|
||||||
|
|
||||||
printf("nxterm_main: Initialize NSH\n");
|
printf("nxterm_main: Initialize NSH\n");
|
||||||
@ -248,14 +251,16 @@ int main(int argc, FAR char *argv[])
|
|||||||
ret = nsh_telnetstart(AF_UNSPEC);
|
ret = nsh_telnetstart(AF_UNSPEC);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
/* The daemon is NOT running. Report the error then fail...
|
/* The daemon is NOT running. Report the error then fail...
|
||||||
* either with the serial console up or just exiting.
|
* either with the serial console up or just exiting.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fprintf(stderr, "ERROR: Failed to start TELNET daemon: %d\n", ret);
|
fprintf(stderr, "ERROR: Failed to start TELNET daemon: %d\n", ret);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* NX Initialization ******************************************************/
|
/* NX Initialization ******************************************************/
|
||||||
|
|
||||||
/* Initialize NX */
|
/* Initialize NX */
|
||||||
|
|
||||||
printf("nxterm_main: Initialize NX\n");
|
printf("nxterm_main: Initialize NX\n");
|
||||||
@ -281,6 +286,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Window Configuration ***************************************************/
|
/* Window Configuration ***************************************************/
|
||||||
|
|
||||||
/* Create a window */
|
/* Create a window */
|
||||||
|
|
||||||
printf("nxterm_main: Create window\n");
|
printf("nxterm_main: Create window\n");
|
||||||
@ -352,7 +358,8 @@ int main(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
|
||||||
/* NxTerm Configuration ************************************************/
|
/* NxTerm Configuration ***************************************************/
|
||||||
|
|
||||||
/* Use the window to create an NX console */
|
/* Use the window to create an NX console */
|
||||||
|
|
||||||
g_nxterm_vars.wndo.wcolor[0] = CONFIG_EXAMPLES_NXTERM_WCOLOR;
|
g_nxterm_vars.wndo.wcolor[0] = CONFIG_EXAMPLES_NXTERM_WCOLOR;
|
||||||
@ -392,12 +399,14 @@ int main(int argc, FAR char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Start Console Task *****************************************************/
|
/* Start Console Task *****************************************************/
|
||||||
/* Now re-direct stdout and stderr so that they use the NX console driver.
|
|
||||||
* Note that stdin is retained (file descriptor 0, probably the serial console).
|
|
||||||
*/
|
|
||||||
|
|
||||||
printf("nxterm_main: Starting the console task\n");
|
/* Now re-direct stdout and stderr so that they use the NX console driver.
|
||||||
fflush(stdout);
|
* Note that stdin is retained (file descriptor 0, probably the serial
|
||||||
|
* console).
|
||||||
|
*/
|
||||||
|
|
||||||
|
printf("nxterm_main: Starting the console task\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@ -408,19 +417,19 @@ int main(int argc, FAR char *argv[])
|
|||||||
dup2(fd, 1);
|
dup2(fd, 1);
|
||||||
dup2(fd, 2);
|
dup2(fd, 2);
|
||||||
|
|
||||||
/* And we can close our original driver file descriptor */
|
/* And we can close our original driver file descriptor */
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
/* And start the console task. It will inherit stdin, stdout, and stderr
|
/* And start the console task. It will inherit stdin, stdout, and stderr
|
||||||
* from this task.
|
* from this task.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
g_nxterm_vars.pid = task_create("NxTerm", CONFIG_EXAMPLES_NXTERM_PRIO,
|
g_nxterm_vars.pid = task_create("NxTerm", CONFIG_EXAMPLES_NXTERM_PRIO,
|
||||||
CONFIG_EXAMPLES_NXTERM_STACKSIZE,
|
CONFIG_EXAMPLES_NXTERM_STACKSIZE,
|
||||||
nxterm_task, NULL);
|
nxterm_task, NULL);
|
||||||
DEBUGASSERT(g_nxterm_vars.pid > 0);
|
DEBUGASSERT(g_nxterm_vars.pid > 0);
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
|
||||||
/* Error Exits ************************************************************/
|
/* Error Exits ************************************************************/
|
||||||
|
|
||||||
@ -431,6 +440,7 @@ errout_with_hwnd:
|
|||||||
nxtk_closewindow(g_nxterm_vars.hwnd);
|
nxtk_closewindow(g_nxterm_vars.hwnd);
|
||||||
|
|
||||||
errout_with_nx:
|
errout_with_nx:
|
||||||
|
|
||||||
/* Disconnect from the server */
|
/* Disconnect from the server */
|
||||||
|
|
||||||
nx_disconnect(g_nxterm_vars.hnx);
|
nx_disconnect(g_nxterm_vars.hnx);
|
||||||
|
@ -179,7 +179,8 @@ static int telnetd_daemon(int argc, FAR char *argv[])
|
|||||||
/* Set socket to reuse address */
|
/* Set socket to reuse address */
|
||||||
|
|
||||||
optval = 1;
|
optval = 1;
|
||||||
if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
|
if (setsockopt(listensd, SOL_SOCKET, SO_REUSEADDR,
|
||||||
|
(FAR void *)&optval, sizeof(int)) < 0)
|
||||||
{
|
{
|
||||||
nerr("ERROR: setsockopt SO_REUSEADDR failure: %d\n", errno);
|
nerr("ERROR: setsockopt SO_REUSEADDR failure: %d\n", errno);
|
||||||
goto errout_with_socket;
|
goto errout_with_socket;
|
||||||
@ -237,7 +238,7 @@ static int telnetd_daemon(int argc, FAR char *argv[])
|
|||||||
|
|
||||||
/* Begin accepting connections */
|
/* Begin accepting connections */
|
||||||
|
|
||||||
for (;;)
|
for (; ; )
|
||||||
{
|
{
|
||||||
socklen_t accptlen;
|
socklen_t accptlen;
|
||||||
|
|
||||||
|
@ -149,9 +149,9 @@ static void nsh_telnettoken(FAR struct console_stdio_s *pstate,
|
|||||||
|
|
||||||
else if (isspace(*endp1))
|
else if (isspace(*endp1))
|
||||||
{
|
{
|
||||||
/* Break out... endp1 points to first while space encountered */
|
/* Break out... endp1 points to first while space encountered */
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,13 +166,13 @@ static int nsh_task(void)
|
|||||||
ret = nsh_telnetstart(AF_UNSPEC);
|
ret = nsh_telnetstart(AF_UNSPEC);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
/* The daemon is NOT running. Report the error then fail...
|
/* The daemon is NOT running. Report the error then fail...
|
||||||
* either with the serial console up or just exiting.
|
* either with the serial console up or just exiting.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fprintf(stderr, "ERROR: Failed to start TELNET daemon: %d\n", ret);
|
fprintf(stderr, "ERROR: Failed to start TELNET daemon: %d\n", ret);
|
||||||
exitval = 1;
|
exitval = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_NSH_CONSOLE
|
#ifdef CONFIG_NSH_CONSOLE
|
||||||
@ -232,6 +232,7 @@ int main(int argc, FAR char *argv[])
|
|||||||
{
|
{
|
||||||
return nsh_system(argc, argv);
|
return nsh_system(argc, argv);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
return nsh_task();
|
return nsh_task();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user