예제 #1
0
파일: serial-shell.c 프로젝트: 1uk3/contiki
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(serial_shell_process, ev, data)
{
  PROCESS_BEGIN();

  shell_init();

  while(1) {
    PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL);
    shell_input(data, strlen(data));
  }

  PROCESS_END();
}
예제 #2
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(serial_shell_process, ev, data)
{
  PROCESS_BEGIN();

  shell_init();

  while(1) {
    // remove these printf - maneesh
    printf("Inside serial_shell_process Loop...\n") ;
    PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message && data != NULL);
    printf("shell_input ... called \n") ;
    shell_input(data, strlen(data));
  }

  PROCESS_END();
}
예제 #3
0
파일: gui-shell.c 프로젝트: EDAyele/wsn430
/*-----------------------------------------------------------------------------------*/
PROCESS_THREAD(shell_gui_process, ev, data)
{
  PROCESS_BEGIN();

  ctk_window_new(&window, SHELL_GUI_XSIZE,
		 SHELL_GUI_YSIZE + 1, "Command shell");
  CTK_WIDGET_ADD(&window, &loglabel);
  /*    CTK_WIDGET_SET_FLAG(&loglabel, CTK_WIDGET_FLAG_MONOSPACE);*/
  CTK_WIDGET_ADD(&window, &commandentry);
  /*    CTK_WIDGET_SET_FLAG(&commandentry, CTK_WIDGET_FLAG_MONOSPACE);*/
  CTK_WIDGET_FOCUS(&window, &commandentry);

  shell_init();
  shell_file_init();
  shell_ps_init();
  shell_run_init();
  shell_text_init();
  shell_time_init();
  shell_wget_init();

  ctk_window_open(&window);

  while(1) {
    PROCESS_WAIT_EVENT();

    if(ev == ctk_signal_widget_activate &&
       data == (process_data_t)&commandentry) {
      int command_len = (int)strlen(command);
      shell_default_output("> ", 2, command, command_len);
      shell_input(command, command_len);
      if(shell_gui_process.state) {
        CTK_TEXTENTRY_CLEAR(&commandentry);
        CTK_WIDGET_REDRAW(&commandentry);
      }
    } else if(ev == ctk_signal_window_close ||
	      ev == PROCESS_EVENT_EXIT) {
      shell_quit();
      ctk_window_close(&window);
      process_exit(&shell_gui_process);
      LOADER_UNLOAD();
    }
  }
  PROCESS_END();
}
예제 #4
0
/*---------------------------------------------------------------------------*/
static void
get_char(u8_t c)
{
  if(c == ISO_cr) {
    return;
  }
  
  s.buf[(int)s.bufptr] = c;
  if(s.buf[(int)s.bufptr] == ISO_nl ||
     s.bufptr == sizeof(s.buf) - 1) {
    if(s.bufptr > 0) {
      s.buf[(int)s.bufptr] = 0;
      /*      petsciiconv_topetscii(s.buf, TELNETD_CONF_LINELEN);*/
    }
    shell_input(s.buf);
    s.bufptr = 0;
  } else {
    ++s.bufptr;
  }
}
예제 #5
0
/*---------------------------------------------------------------------------*/
	static void
get_char(u8_t c)
{
	PRINTF("telnetd: get_char '%c' %d %d\n", c, c, s.bufptr);

	if(c == 0) {
		return;
	}

	if(c != ISO_nl && c != ISO_cr) {
		s.buf[(int)s.bufptr] = c;
		++s.bufptr;
	}
	if((c == ISO_nl || c == ISO_cr) ||
			s.bufptr == sizeof(s.buf)) {
		if(s.bufptr < sizeof(s.buf)) {
			s.buf[(int)s.bufptr] = 0;
		}
		PRINTF("telnetd: get_char '%.*s'\n", s.bufptr, s.buf);
		shell_input(s.buf, s.bufptr);
		s.bufptr = 0;
	}
}
예제 #6
0
int main()
{
#ifdef EMULATION
	emu_init();
#endif
	irq_setmask(0);
	irq_enable(1);
	uart_async_init();
	banner();
	brd_init();
	cpustats_init();
	time_init();
	mem_init();
	vga_init();
	snd_init();
	pfpu_init();
	tmu_init();
	renderer_init();
	apipe_init();
	rpipe_init();
	slowout_init();
	hdlcd_init();
	ui_init();
	shell_init();
	
	while(1) {
		if(readchar_nonblock())
			shell_input(readchar());
		apipe_service();
		rpipe_service();
#ifdef EMULATION
		emu_service();
#endif
	}
	
	return 0;
}
예제 #7
0
파일: telnetd.c 프로젝트: EDAyele/ptunes
/*---------------------------------------------------------------------------*/
static void
get_char(u8_t c)
{
  PRINTF("telnetd: get_char '%c' %d %d\n", c, c, s.bufptr);

  if(c == 0) {
    return;
  }

  if(c != ISO_nl && c != ISO_cr) {
    s.buf[(int)s.bufptr] = c;
    ++s.bufptr;
  }
  if(((c == ISO_nl || c == ISO_cr) && s.bufptr > 0) ||
     s.bufptr == sizeof(s.buf)) {
    if(s.bufptr < sizeof(s.buf)) {
      s.buf[(int)s.bufptr] = 0;
    }
    petsciiconv_topetscii(s.buf, TELNETD_CONF_LINELEN);
    PRINTF("telnetd: get_char '%.*s'\n", s.bufptr, s.buf);
    shell_input(s.buf, s.bufptr);
    s.bufptr = 0;
  }
}
예제 #8
0
void telnetd_appcall(void *ts) {
	if(uip_connected()) {
		tcp_markconn(uip_conn, &s);
		buf_init(&buf);
		s.bufptr = 0;
		s.state = STATE_NORMAL;

		stdout = &telnet_stream;
		shell_input("", 0);
		//shell_start();
	}

	if(s.state == STATE_CLOSE) {
		s.state = STATE_NORMAL;
		uip_close();
		return;
	}
	if(uip_closed() ||
			uip_aborted() ||
			uip_timedout()) {
		closed();
	}
	if(uip_acked()) {
		acked();
	}
	if(uip_newdata()) {
		newdata();
	}
	if(uip_rexmit() ||
			uip_newdata() ||
			uip_acked() ||
			uip_connected() ||
			uip_poll()) {
		senddata();
	}
}