Hi, Kristoffer Gustafsson, le Tue 01 May 2007 23:55:47 +0200, a écrit : > Is there a way to compile brltty, so that it can be used with a braille > display under dos? By compiling it with DJGPP, yes, but there are still a few missing modifications, a patch is attached to this mail. Note however that there is no USB support and that serial speeds greater than 9600 can't be achieved without special device drivers, since DOS alone doesn't support more than 9600bps. Samuel
Index: Programs/io_misc.c =================================================================== --- Programs/io_misc.c (r�vision 3012) +++ Programs/io_misc.c (copie de travail) @@ -35,15 +35,23 @@ awaitInput (int fileDescriptor, int milliseconds) { fd_set mask; struct timeval timeout; +#ifdef __MSDOS__ + int elapsed = 0; +#endif /* __MSDOS__ */ FD_ZERO(&mask); FD_SET(fileDescriptor, &mask); memset(&timeout, 0, sizeof(timeout)); + +#ifdef __MSDOS__ + do { +#else /* __MSDOS__ */ timeout.tv_sec = milliseconds / 1000; timeout.tv_usec = (milliseconds % 1000) * 1000; while (1) { +#endif /* __MSDOS__ */ switch (select(fileDescriptor+1, &mask, NULL, NULL, &timeout)) { case -1: if (errno == EINTR) continue; @@ -51,16 +59,27 @@ return 0; case 0: - if (milliseconds > 0) - LogPrint(LOG_DEBUG, "Input wait timed out after %d %s.", - milliseconds, ((milliseconds == 1)? "millisecond": "milliseconds")); - errno = EAGAIN; - return 0; +#ifdef __MSDOS__ + elapsed += tsr_usleep(1000); + continue; +#else /* __MSDOS__ */ + goto out; +#endif /* __MSDOS__ */ default: return 1; } +#ifdef __MSDOS__ + } while (elapsed < milliseconds * 1000); +#else /* __MSDOS__ */ } +out: +#endif /* __MSDOS__ */ + if (milliseconds > 0) + LogPrint(LOG_DEBUG, "Input wait timed out after %d %s.", + milliseconds, ((milliseconds == 1)? "millisecond": "milliseconds")); + errno = EAGAIN; + return 0; } int @@ -69,6 +88,7 @@ void *buffer, size_t *offset, size_t count, int initialTimeout, int subsequentTimeout ) { + if (!awaitInput(fileDescriptor, initialTimeout)) return 0; while (count > 0) { ssize_t amount; { @@ -120,15 +140,22 @@ awaitOutput (int fileDescriptor, int milliseconds) { fd_set mask; struct timeval timeout; +#ifdef __MSDOS__ + int elapsed = 0; +#endif /* __MSDOS__ */ FD_ZERO(&mask); FD_SET(fileDescriptor, &mask); +#ifdef __MSDOS__ + do { +#else /* __MSDOS__ */ memset(&timeout, 0, sizeof(timeout)); timeout.tv_sec = milliseconds / 1000; timeout.tv_usec = (milliseconds % 1000) * 1000; while (1) { +#endif /* __MSDOS__ */ switch (select(fileDescriptor+1, NULL, &mask, NULL, &timeout)) { case -1: if (errno == EINTR) continue; @@ -136,16 +163,27 @@ return 0; case 0: - if (milliseconds > 0) - LogPrint(LOG_DEBUG, "Output wait timed out after %d %s.", - milliseconds, ((milliseconds == 1)? "millisecond": "milliseconds")); - errno = EAGAIN; - return 0; +#ifdef __MSDOS__ + elapsed += tsr_usleep(1000); + continue; +#else /* __MSDOS__ */ + goto out; +#endif /* __MSDOS__ */ default: return 1; } +#ifdef __MSDOS__ + } while (elapsed < milliseconds * 1000); +#else /* __MSDOS__ */ } +out: +#endif /* __MSDOS__ */ + if (milliseconds > 0) + LogPrint(LOG_DEBUG, "Output wait timed out after %d %s.", + milliseconds, ((milliseconds == 1)? "millisecond": "milliseconds")); + errno = EAGAIN; + return 0; } ssize_t Index: Programs/config.c =================================================================== --- Programs/config.c (r�vision 3012) +++ Programs/config.c (copie de travail) @@ -2043,7 +2043,7 @@ atexit(exitTunes); suppressTuneDeviceOpenErrors(); -#if defined(WINDOWS) +#if defined(WINDOWS) || defined(__MSDOS__) if (!opt_noDaemon) { background(); } else if (!opt_standardError) { @@ -2157,7 +2157,7 @@ #endif /* ENABLE_PREFERENCES_MENU */ #endif /* ENABLE_CONTRACTED_BRAILLE */ -#if defined(HAVE_SYS_WAIT_H) || defined(WINDOWS) +#if defined(HAVE_SYS_WAIT_H) || defined(WINDOWS) || defined(__MSDOS__) if (!( #ifndef WINDOWS opt_noDaemon || @@ -2220,7 +2220,7 @@ } #endif /* detach */ } -#endif /* HAVE_SYS_WAIT_H || WINDOWS */ +#endif /* HAVE_SYS_WAIT_H || WINDOWS || __MSDOS__ */ /* * From this point, all IO functions as printf, puts, perror, etc. can't be Index: Programs/scr.h =================================================================== --- Programs/scr.h (r�vision 3012) +++ Programs/scr.h (copie de travail) @@ -25,6 +25,9 @@ /* scr.h - C header file for the screen reading library */ +#ifdef __MSDOS__ +#define ScreenMode _ScreenMode +#endif /* __MSDOS__ */ /* mode argument for readScreen() */ typedef enum { SCR_TEXT, /* get screen text */
_______________________________________________ Blinux-list mailing list Blinux-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/blinux-list