30 static int printer_fd = -1;
31 static int fd_to_open = 1;
33 #define BUFFER_SIZE 1024
34 #define COVOX_ACTIVATION_LIMIT 0x100
37 static int buffer_pos;
38 static int strobes_missed = 0;
40 static int printer_is_covox = 0;
41 static int covox_to_warn = 1;
42 static int old_strobe_level = 0;
46 static void write_printer_buffer (
void )
48 if (buffer_pos && printer_fd >= 0) {
51 WARNING_WINDOW(
"Cannot write printer output: %s\nFurther printer I/O has been disabled.",
ERRSTR());
63 if (printer_fd >= 0) {
64 write_printer_buffer();
66 DEBUG(
"Closing printer output file." NL);
78 if (!printer_is_covox) {
83 INFO_WINDOW(
"COVOX on printer port has been activated. There will be no further messages on this.");
93 static void send_data_to_printer (
Uint8 data )
97 char path[PATH_MAX + 1];
101 WARNING_WINDOW(
"Cannot create/append printer output file \"%s\": %s.\nYou can use Xep128 but printer output will not be logged!", path,
ERRSTR());
103 INFO_WINDOW(
"Printer event, file \"%s\" has been opened for the output.", path);
107 if (printer_fd >= 0) {
108 buffer[buffer_pos++] =
data;
110 write_printer_buffer();
119 if (old_strobe_level && !level) {
123 if (printer_is_covox) {
124 DEBUG(
"PRINTER: COVOX: covox mode has been disabled on STROBE, data byte %02Xh is sent for printing" NL,
printer_data_byte);
125 printer_is_covox = 0;
131 old_strobe_level = level;
138 if (printer_is_covox) {
139 printer_is_covox = 0;
141 DEBUG(
"PRINTER: COVOX: covox mode has been disabled on emulator event." NL);