Salut

Je développe actuellement une petite application pour point d'acces à architecture MIPS.

voici le code qui me pose probleme :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdio.h>   /* Standard input/output definitions */
#include <termios.h> /* POSIX terminal control definitions */
#include <fcntl.h>   /* File control definitions */
int initport_ (int fd)
{
	struct termios options;
	// Récuperation d'options courante
	tcgetattr(fd, &options);
	// Vitesse In/out.
	cfsetispeed(&options, B9600);
	cfsetospeed(&options, B9600);
	options.c_cflag |= (CLOCAL | CREAD);
	options.c_cflag &= ~PARENB;
	options.c_cflag &= ~CSTOPB;
	options.c_cflag &= ~CSIZE;
	options.c_cflag |= CS8;
	// Applique la nouvelle config
	tcsetattr(fd, TCSANOW, &options);
	return 1;
}
 
int main ()
{
	int fd;
	fd = open("/dev/tts/0", O_RDWR | O_NOCTTY | O_NDELAY);
	if (fd == -1) {
		perror("Impossible d'ouvrir le port /dev/ttys/0 - ");
		return 1;
	} else {
		fcntl(fd, F_SETFL, 0);
	}
	initport_(fd);
	write(fd, "test", 4);
	close(fd);
	return 0;
}
À la compilation, pas de soucis, tout se passe bien. Mais quand je lance mon programme via SSH sur le point d'acces, il me dit :
./serial: ./serial: 4: Syntax error: "(" unexpected
C'est étrange puis-ce que ce que je lui donne est déjà compilé... Pourquoi me renvoie-t-il ça? D'autant plus que je ne vois pas d'où peut provenir l'erreur.

J'ai pensé à un bug du cross-compilateur qui me donnerait des binaires porteurs de messages psychedéliques (la vérité est ailleur!) mais je n'y crois pas trop.

Mon point d'acces est sous OpenWrt

Pourriez vous m'aider à y voir plus clair ?

merci, ++ Tixlegeek.