| PLEX86 | ||
|
linux serial port help... Try this code instead to see if it makes any difference. Incidentally, compile this with a command that has at least these options: root can't change permissions, owner 2202 Aragorn writes: toncho-~ apt-cache show ntfsprogs Package: ntfsprogs Priority: optional Section: otherosfs Installed-Size: 536 Architecture: i386 Version: 1.12.1-1 Replaces: ntfstools Provides: ntfstools Size: 213500 MD5sum: 85c925c8bd6149dd49f9fb9df9baabe5 SHA1: e85ffe55b55d913dc6548c2c992ea725bd3eb451 SHA256... gcc -O2 -Wall -W foo.c You could also add -ansi to the options, and then the code would need "#define GNUSOURCE 1" added at the very top. int portopen(char *); int portcnfg(int); #define TESTSTRING "LCD TEST-n" #define DEVICEPORT "-dev-ttyS2" #define BAUD B9600 Crontab question No overloading involved. There is simply a delay in caching by NFS. If I remember the terminology correctly, it is comparable to write-back vs. write-back... int main(void) { int fd, bytes; if (-1 == (fd = portopen(DEVICEPORT))) { fprintf(stderr, "Unable to open port device %s.-n", DEVICEPORT); exit(EXITFAILURE); } if (-1 == (fd = portcnfg(fd))) { fprintf(stderr, "Unable to configure port device %s.-n", device); exit(EXITFAILURE); } bytes = write(fd, TESTSTRING, strlen(TESTSTRING)); if (bytes == (int) strlen(TESTSTRING)) { fprintf(stderr, "String written.-n"); } else { switch (bytes) { case -1: fprintf(stderr, "A write error occurred.-n"); break; case 0: fprintf(stderr, "No data was written.-n"); break; default: fprintf(stderr, "Complete string not written.-n"); break; } } return EXITSUCCESS; } root can't change permissions, owner 2201 comp.os.linux.misc: Please do not multipost your problems In that case whoever wtrote the wikipedia article was... int portopen(char *device) { int fd; if (-1 != (fd = open(device, ORDWR ONOCTTY ONONBLOCK))) { if (-1 == (fcntl(fd, FSETFL, 0))) { return -1; } if (-1 == tcflush(fd, TCIOFLUSH)) { close(fd); return -1; } } return fd; } int portcnfg(int fd) { struct termios tty; memset(&tty, 0, sizeof tty); * avoids setting each flag. * tty.ciflag = IGNBRK IGNPAR; * input flags * tty.ccflag = CS8 CREAD CLOCAL;* control flags * * always set bit rate just before calling tcsetattr() * cfsetispeed(&tty, BAUD); cfsetospeed(&tty, BAUD); if (-1 == (tcsetattr(fd, TCSAFLUSH, &tty)) { return -1; } return fd; } --
|
||||
root can't change permissions, owner 2201 Linux groups from Newsgroups The #1 Usenet Provider on the Internet
|
||||