diff options
author | H. Peter Anvin <hpa@zytor.com> | 2006-09-12 17:06:16 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2006-09-12 17:06:16 -0700 |
commit | b90182528d6d9a64d0eae7e3876d629fd3a596d2 (patch) | |
tree | 6c50ca74ad03fa60003013febcb73b5d7b66be22 /com32 | |
parent | 9ac07bc4aad3c52a63c2c1063cc7fde9d103fcf4 (diff) | |
download | syslinux-b90182528d6d9a64d0eae7e3876d629fd3a596d2.tar.gz |
Implement fallback from vesacon to ansicon
Diffstat (limited to 'com32')
-rw-r--r-- | com32/lib/sys/file.h | 1 | ||||
-rw-r--r-- | com32/lib/sys/opendev.c | 11 | ||||
-rw-r--r-- | com32/lib/sys/vesacon_write.c | 4 | ||||
-rw-r--r-- | com32/lib/sys/vesaserial_write.c | 2 |
4 files changed, 16 insertions, 2 deletions
diff --git a/com32/lib/sys/file.h b/com32/lib/sys/file.h index 84ce7be5..3b73848d 100644 --- a/com32/lib/sys/file.h +++ b/com32/lib/sys/file.h @@ -68,6 +68,7 @@ struct output_dev { ssize_t (*write)(struct file_info *, const void *, size_t); int (*close)(struct file_info *); int (*open)(struct file_info *); + const struct output_dev *fallback; /* Fallback option for certain consoles */ }; /* File structure */ diff --git a/com32/lib/sys/opendev.c b/com32/lib/sys/opendev.c index 5928b366..1bcc1010 100644 --- a/com32/lib/sys/opendev.c +++ b/com32/lib/sys/opendev.c @@ -75,12 +75,21 @@ int opendev(const struct input_dev *idev, fp->iop = idev; } - if (odev) { + while (odev) { if (odev->open && (e = odev->open(fp))) { + if (e == EAGAIN) { + if (odev->fallback) { + odev = odev->fallback; + continue; + } else { + e = EIO; + } + } errno = e; goto puke; } fp->oop = odev; + break; } return fd; diff --git a/com32/lib/sys/vesacon_write.c b/com32/lib/sys/vesacon_write.c index bcdf6a13..da940062 100644 --- a/com32/lib/sys/vesacon_write.c +++ b/com32/lib/sys/vesacon_write.c @@ -37,6 +37,7 @@ #include <com32.h> #include <minmax.h> #include <colortbl.h> +#include <console.h> #include <klibc/compiler.h> #include "ansi.h" #include "file.h" @@ -85,7 +86,7 @@ int __vesacon_open(struct file_info *fp) } else { /* Switch mode */ if (__vesacon_init()) - return EIO; + return EAGAIN; /* Initial state */ __ansi_init(&ti); @@ -162,4 +163,5 @@ const struct output_dev dev_vesacon_w = { .write = __vesacon_write, .close = __vesacon_close, .open = __vesacon_open, + .fallback = &dev_ansicon_w, }; diff --git a/com32/lib/sys/vesaserial_write.c b/com32/lib/sys/vesaserial_write.c index fa434c3b..e9696cb2 100644 --- a/com32/lib/sys/vesaserial_write.c +++ b/com32/lib/sys/vesaserial_write.c @@ -35,6 +35,7 @@ #include <string.h> #include <com32.h> #include <minmax.h> +#include <console.h> #include "file.h" extern int __vesacon_open(void); @@ -55,4 +56,5 @@ const struct output_dev dev_vesaserial_w = { .write = __vesaserial_write, .close = __vesacon_close, .open = __vesacon_open, + .fallback = &dev_ansiserial_w, }; |