okee, der thread mutiert zur blauderecke zwischen tobi und mir, aber ich glaube, das könnte schon den einen oder anderen interessieren.

folgender code liest die serielle schnittstelle aus. es setzt am anfang den request to send richtig und sendet auch gleich noch das "s" um den code auf dem rp6 zu starten.

übersetzt wird mit GCC -o test test.c, aber wem erzähl ich das. wenn ihr das orginalkabel vom rp6 benutzt, sollte das device /dev/ttyUSB0 sein (äh ok, ist nur unter linux getestet!), andernfalls einfach ändern.

viel spaß damit. verbesserungen nehmen wir natürlich dankend entgegen. besonders die prozessorlast geht schon ordentlich in die höhe! code ist noch lange nicht fertig, wird jetzt auch zeit für die heija!

Code:
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/signal.h>
#include <sys/types.h>
#include <sys/ioctl.h>


int serial_port_fd = -1;

void Set_signals()
{
  int stat_;

  if(serial_port_fd == -1)
    return;

  if(ioctl(serial_port_fd, TIOCMGET, &stat_) == -1)
    {
      printf("Control signals read\n");
      return;
    }
	
	//Toggle RTS
   if(stat_ & TIOCM_RTS)
		stat_ &= ~TIOCM_RTS;
   else
		stat_ |= TIOCM_RTS;
   
   if(ioctl(serial_port_fd, TIOCMSET, &stat_) == -1)
		printf("RTS write\n");

}

int Config_port(void)
{
  struct termios termios_p;
  
  //open serial port
  serial_port_fd = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
  
  if(serial_port_fd == -1)
      return 0;

  //read config from port?    
  tcgetattr(serial_port_fd, &termios_p);

  //set baudrate to 38400
  termios_p.c_cflag = B38400;

  //set 8 data bits
  termios_p.c_cflag |= CS8;
 
  //stopbit 1
  termios_p.c_cflag &= ~CSTOPB;
  
  //enable receiver
  termios_p.c_cflag |= CREAD;
  
  //character size
  termios_p.c_cflag &= ~CSIZE;
  
  //some other stuff (?)
  termios_p.c_cflag &= ~CRTSCTS;
  termios_p.c_cflag &= ~PARENB;
  termios_p.c_iflag = IGNPAR | IGNBRK;
  termios_p.c_cflag |= CLOCAL;
  termios_p.c_oflag = 0;
  termios_p.c_lflag = 0;
  termios_p.c_cc[VTIME] = 0;
  termios_p.c_cc[VMIN] = 1;
  tcsetattr(serial_port_fd, TCSANOW, &termios_p);
  tcflush(serial_port_fd, TCOFLUSH);  
  tcflush(serial_port_fd, TCIFLUSH);

  return 1;
}

main() {
	char buf[255];  
	int res,i;
	
	if (Config_port()) {
		printf("Port opened ...\n");
		
		//toggle RTS, needed to enable serial output on the RP6
		Set_signals();
		
		//wait a little time
		sleep(2);

		//start program uploaded to your rp6.
		//be sure to check, if the correct program was uploaded! 
		write(serial_port_fd, "s", 1);
		
		while(1) {
			//read 100 bytes from serial
			res = read(serial_port_fd,buf,100);
		
			if (res>1) {
				//printf("get %d bytes\n", res);
				for (i=0; i<res; i++) { //for all chars in string
					printf("%c",buf[i]);
				}
      	}
      }   
      
      //close serial port
      close(serial_port_fd);   	
      		
	}		 
}