From be1683673515350ffe3e51807e9051d639ef6b94 Mon Sep 17 00:00:00 2001 From: Lars Brinkhoff Date: Sun, 27 Oct 2024 15:35:36 +0100 Subject: [PATCH] tmp --- vt100/flowers.c | 14 +++++++++----- vt100/keyboard.c | 2 +- vt100/main.c | 11 +++++++++-- vt100/vt100.h | 3 ++- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/vt100/flowers.c b/vt100/flowers.c index 7dbc3ba..ff3844b 100644 --- a/vt100/flowers.c +++ b/vt100/flowers.c @@ -2,13 +2,14 @@ #include #include "vt100.h" -int flowers = 0; // Trevor Flowers' mini VT100. +int flowersi = 0; // Trevor Flowers' mini VT100. +int flowerso = 0; void flowers_leds(u8 data) { char command[100]; int n; - if (!flowers) + if (!flowerso) return; n = snprintf(command, sizeof command, "SET_ALL_LEDS %c%c%c%c%c%c%c\n", (data & 0x20) ? '0' : '1', @@ -18,7 +19,7 @@ void flowers_leds(u8 data) (data & 0x04) ? '1' : '0', (data & 0x02) ? '1' : '0', (data & 0x01) ? '1' : '0'); - write(flowers, command, n); + write(flowerso, command, n); } static const char *const prefix = "\nSPECIAL_KEY: "; @@ -29,11 +30,14 @@ int flowers_key(void) char data; int n; - if (ioctl(flowers, FIONREAD, &n) != 0) + if (!flowersi) + return -1; + + if (ioctl(flowersi, FIONREAD, &n) != 0) return -1; if (n < 1) return -1; - if (read(flowers, &data, 1) != 1) + if (read(flowersi, &data, 1) != 1) return -1; if (*pointer == 0) { diff --git a/vt100/keyboard.c b/vt100/keyboard.c index 05db035..daa72cf 100644 --- a/vt100/keyboard.c +++ b/vt100/keyboard.c @@ -206,6 +206,6 @@ void reset_keyboard (void) down[0x7F] = 1; scan = 0x80; flowers_leds(0); - if (flowers) + if (flowersi) add_event (1000, &flowers_event); } diff --git a/vt100/main.c b/vt100/main.c index de82fb6..f51f2d6 100644 --- a/vt100/main.c +++ b/vt100/main.c @@ -197,9 +197,16 @@ int main (int argc, char **argv) curvature = atof (optarg); break; case 'F': - flowers = open(optarg, O_RDONLY); - if (flowers == -1) +#if 1 + flowersi = open(optarg, O_RDONLY); + if (flowersi == -1) panic("Couldn't open %s: %s", optarg, strerror (errno)); +#endif +#if 0 + flowerso = open(optarg, O_WRONLY); + if (flowerso == -1) + panic("Couldn't open %s: %s", optarg, strerror (errno)); +#endif break; default: usage(); diff --git a/vt100/vt100.h b/vt100/vt100.h index 67a339f..1393d19 100644 --- a/vt100/vt100.h +++ b/vt100/vt100.h @@ -21,7 +21,6 @@ extern u8 vt100_flags; extern int pty; extern int sound_scope; extern int field_rate; -extern int flowers; extern int quick; extern int pixcolor; @@ -64,5 +63,7 @@ extern void nvr_clock (void); extern void key_down (u8 code); extern void key_up (u8 code); +extern int flowersi; +extern int flowerso; extern void flowers_leds(u8 data); extern int flowers_key(void);