[syslinux:pathbased] stdcon: make the screen size available
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Sat Mar 6 14:54:14 PST 2010
Commit-ID: c25c83df767519d1a9919dcebda9a58611671cc1
Gitweb: http://syslinux.zytor.com/commit/c25c83df767519d1a9919dcebda9a58611671cc1
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Sat, 6 Mar 2010 14:49:40 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Sat, 6 Mar 2010 14:49:40 -0800
stdcon: make the screen size available
Make the screen size available when using stdcon, not just ansicon.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
com32/lib/sys/stdcon_write.c | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/com32/lib/sys/stdcon_write.c b/com32/lib/sys/stdcon_write.c
index 8cc6b5f..9cb2f7d 100644
--- a/com32/lib/sys/stdcon_write.c
+++ b/com32/lib/sys/stdcon_write.c
@@ -37,6 +37,23 @@
#include <minmax.h>
#include "file.h"
+#define BIOS_ROWS (*(uint8_t *)0x484) /* Minus one; if zero use 24 (= 25 lines) */
+#define BIOS_COLS (*(uint16_t *)0x44A)
+
+static int __stdcon_open(struct file_info *fp)
+{
+ fp->o.rows = BIOS_ROWS + 1;
+ fp->o.cols = BIOS_COLS;
+
+ /* Sanity check */
+ if (fp->o.rows < 12)
+ fp->o.rows = 24;
+ if (fp->o.cols < 40)
+ fp->o.cols = 80;
+
+ return 0;
+}
+
static ssize_t __stdcon_write(struct file_info *fp, const void *buf,
size_t count)
{
@@ -68,5 +85,5 @@ const struct output_dev dev_stdcon_w = {
.fileflags = O_WRONLY | O_CREAT | O_TRUNC | O_APPEND,
.write = __stdcon_write,
.close = NULL,
- .open = NULL,
+ .open = __stdcon_open,
};
More information about the Syslinux-commits
mailing list