profile/ivi/syslinux.git
15 years agoMerge branch 'cmenu-video' into hdt-next
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 23:23:48 +0000 (16:23 -0700)]
Merge branch 'cmenu-video' into hdt-next

Conflicts:
com32/hdt/hdt-cli-disk.c
com32/hdt/hdt-common.c

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agoMerge branch 'bootloader-detection' into hdt-next
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 23:12:59 +0000 (16:12 -0700)]
Merge branch 'bootloader-detection' into hdt-next

Conflicts:
com32/hdt/hdt-cli-disk.c
com32/hdt/hdt-common.h
com32/hdt/hdt-menu-disk.c

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: use ASCII characters for scrollbars
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 22:54:57 +0000 (15:54 -0700)]
cmenu: use ASCII characters for scrollbars

Use ^ and v as hints for scrolling. Use \141 from the Special Characters and
Line Drawing Character Set as the scrollbox.

Note: printf "\016\141\017" doesn't seem to work well on xterm, although
it does work on the vga console.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: do not invoke help if helpid is 0xFFFF (complex.c)
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 22:17:22 +0000 (15:17 -0700)]
cmenu: do not invoke help if helpid is 0xFFFF (complex.c)

0xFFFF is invalid (no help)

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: do not invoke help if helpid is 0xFFFF
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 22:10:20 +0000 (15:10 -0700)]
hdt: do not invoke help if helpid is 0xFFFF

0xFFFF is invalid (no help).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: redraw the current menu after exiting the keys_handler
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 22:03:28 +0000 (15:03 -0700)]
cmenu: redraw the current menu after exiting the keys_handler

After exiting the keys_handler, reset_ui() is not enough since it
only resets the status line and title. The current menu needs to be redrawn.

Note: only a submenu will be redrawn, not its parents. This means that not
all the UI will be displayed after exiting the handler if invoked from whithin a
submenu. We have already this problem nowadays when exiting a submenu
of a submenu. The root parent is not redrawn, leading to some ugly states
(the background color overrides part of the root menu).
This will be fixed when we implement a real hierarchy (each submenu having
access to its parents).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: remove extra LF
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 21:50:52 +0000 (14:50 -0700)]
hdt: remove extra LF

In a few places, extra LFs cause the menu to scroll ('\n' in the status bar).
Remove them (they are not needed anyway).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: optimize redraw to be faster
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 21:48:03 +0000 (14:48 -0700)]
cmenu: optimize redraw to be faster

cmenu currently redraws everything after each key press. This doesn't scale
well, especially over serial. Instead, redraw only the previous/current selected
entries. A full redraw is still needed when scrolling though.

Misc.: add CTRL-L combo to force a redraw of the current menu.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: force refresh after checkbox_handler in complex.c
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 21:44:34 +0000 (14:44 -0700)]
cmenu: force refresh after checkbox_handler in complex.c

complex.c has a special checkbox_handler that disables mutual exclusive
entries. This works today because each key press triggers a redraw of the whole
menu. We can't rely on this if we want to optimize the redraw.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: redraw menu when exiting keys_handler
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 18:18:13 +0000 (11:18 -0700)]
cmenu: redraw menu when exiting keys_handler

The keys_handler can change the UI (e.g. the help system draws a black
background by default). We need to redraw the background and title on exit.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: pad help filename with 0 instead of spaces
Pierre-Alexandre Meyer [Mon, 7 Sep 2009 18:00:34 +0000 (11:00 -0700)]
cmenu: pad help filename with 0 instead of spaces

The manual states that the help filename format is hlp<NNNNN>.txt where
<NNNNN> is the helpid.

If the helpid contains less than 5 digits, pad with zero, not spaces,
i.e. look for hlp00023.txt, not hlp   23.txt.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: remove obsolete com32io code
Pierre-Alexandre Meyer [Sun, 6 Sep 2009 07:49:27 +0000 (00:49 -0700)]
cmenu: remove obsolete com32io code

Remove legacy scrollupwindow definition and checkkbdbuf declaration.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: make the help menu actually work
Pierre-Alexandre Meyer [Sun, 6 Sep 2009 07:48:14 +0000 (00:48 -0700)]
cmenu: make the help menu actually work

With the recent changes in cmenu, the help feature was completely broken.
Fix it.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: fix build due to cmenu keyboard changes
Pierre-Alexandre Meyer [Sun, 6 Sep 2009 07:46:55 +0000 (00:46 -0700)]
hdt: fix build due to cmenu keyboard changes

Sames changes as the ones needed on the cmenu examples.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: add function to scroll up multiple lines
Pierre-Alexandre Meyer [Sun, 6 Sep 2009 05:59:00 +0000 (22:59 -0700)]
libansi: add function to scroll up multiple lines

Impact: API change. scrollup() has been renamed scrollup_once().

Use scrollup(nb_of_lines) to specify the number of lines the window needs
to scroll.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: fix handlers signature in the examples
Pierre-Alexandre Meyer [Sun, 6 Sep 2009 05:55:28 +0000 (22:55 -0700)]
cmenu: fix handlers signature in the examples

The keys handler accepts three arguments: the current menu system, the current
menu entry and the key pressed.

Misc: fix timeout in complex.c to actually be 10 seconds.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: use get_key library for keyboard functions
Pierre-Alexandre Meyer [Sun, 6 Sep 2009 05:51:04 +0000 (22:51 -0700)]
cmenu: use get_key library for keyboard functions

Syslinux already uses a get_key library to handle stdin. Let's leverage it.
cmenu now works over serial completely.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: correctly reset attributes
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 18:42:29 +0000 (11:42 -0700)]
libansi: correctly reset attributes

When resetting the attributes, we were updating last_attr to the unknown value
0x300, which doesn't always work.

For instance, when requesting reset and normal attributes, i.e.
"\e[0;30;47m" with the previous attribute being "\e[1;30;47m", we where printing
"\e[0;47m", which behaves like "\e[0;39;47m". This is incorrect.

This patch adds a flag to explicitly set background and foreground colors after
a reset.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: reset_colors should use csprint
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 18:35:09 +0000 (11:35 -0700)]
libansi: reset_colors should use csprint

cprint_vga2ansi takes only a char, not a string.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: fill backgorund with printable character
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 18:22:36 +0000 (11:22 -0700)]
cmenu: fill backgorund with printable character

To have a blue background on the console (serial), we need to fill
the screen with a printable character (e.g. space).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: remove legacy CHABSATTR/CHRELATTR code
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 17:26:45 +0000 (10:26 -0700)]
cmenu: remove legacy CHABSATTR/CHRELATTR code

CHABSATTR and CHRELATTR have been replaced by SO/SI.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: remove legacy box drawing code
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 17:23:00 +0000 (10:23 -0700)]
cmenu: remove legacy box drawing code

Lines are now printed via the Line Drawing Character Set.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: unify normal menu/radio menu handling
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 17:20:48 +0000 (10:20 -0700)]
cmenu: unify normal menu/radio menu handling

A lot of code was duplicated between regular and normal menus
(menu printing and selection handling). This patch unifies this logic
by adding an extra bool in printmenu() and getmenuoption() to distinguish
between the two types of menus.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: fix Login/Password and Kernel Arguments lines (complex.c)
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 17:15:35 +0000 (10:15 -0700)]
cmenu: fix Login/Password and Kernel Arguments lines (complex.c)

Update the cmenu example complex.c to use clear_line(): cprint behavior has
changed w.r.t. cursor positioning (it is automatically advanced now).

Note: need to reset the colors before clearing the line since the status bar is
printed just before the Kernel Arguments line and it changes the background
color.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: add reset_colors function
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 17:14:24 +0000 (10:14 -0700)]
libansi: add reset_colors function

Purpose of reset_colors is to reset the attribute to VGA 0x07.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: turn off auto wrap
Pierre-Alexandre Meyer [Sat, 5 Sep 2009 04:17:43 +0000 (21:17 -0700)]
cmenu: turn off auto wrap

Auto wrap made the menu scroll because of the status line (when printing
the last character of the bottom right of the screen, the ansicon scrolled
the whole menu).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agoansi: add support for no-wrap mode, cleanups
H. Peter Anvin [Fri, 14 Aug 2009 05:35:28 +0000 (22:35 -0700)]
ansi: add support for no-wrap mode, cleanups

Add support for nowrap mode CSI ? 7 l (unfortunately, on ANSI.SYS it
is CSI = 7 l; which means that the only way to support both is to
print both sequences and then erase the resulting garbage.)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
15 years agoMerge commit 'origin/libansi' into cmenu-video
Pierre-Alexandre Meyer [Fri, 4 Sep 2009 23:59:53 +0000 (16:59 -0700)]
Merge commit 'origin/libansi' into cmenu-video

15 years agoMerge branch 'cmenu-video' of git://git.zytor.com/users/pam/hdt-pierre into cmenu...
Pierre-Alexandre Meyer [Fri, 4 Sep 2009 23:54:24 +0000 (16:54 -0700)]
Merge branch 'cmenu-video' of git://git.zytor.com/users/pam/hdt-pierre into cmenu-video

15 years agocmenu: use printf instead of csprint with default attribute
Pierre-Alexandre Meyer [Thu, 3 Sep 2009 22:43:54 +0000 (15:43 -0700)]
cmenu: use printf instead of csprint with default attribute

We don't change the attribute in the help screen. Refactor the code
to simply use printf.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: use putchar instead of putch when using default attribute
Pierre-Alexandre Meyer [Thu, 3 Sep 2009 22:23:22 +0000 (15:23 -0700)]
cmenu: use putchar instead of putch when using default attribute

There is no real need to do putch('x', 0x07), 0x07 being the default
VGA attribute. Use putchar instead.

Note that showhelp will trigger a drawbox first with 0x07 as attribute.
Since we don't update the attribute, it is guaranteed to still be 0x07
when invoking putch.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: remove call to legacy getnumcols (menu)
Pierre-Alexandre Meyer [Thu, 3 Sep 2009 21:31:27 +0000 (14:31 -0700)]
hdt: remove call to legacy getnumcols (menu)

Use getscreensize instead.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: use getscreensize to access number of rows/columns
Pierre-Alexandre Meyer [Thu, 3 Sep 2009 21:16:17 +0000 (14:16 -0700)]
cmenu: use getscreensize to access number of rows/columns

The simple menu system already uses getscreensize. Another step towards
unification.

Impact: exported getnumcols and getnumrows are now deprecated.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: add const qualifier in cpu_dev (cpuid)
Pierre-Alexandre Meyer [Thu, 3 Sep 2009 17:28:00 +0000 (10:28 -0700)]
gpllib: add const qualifier in cpu_dev (cpuid)

The Syslinux build turns on -Wwrite-strings, which gives string constants
the type const char[length].

Note: -Wall doesn't trigger this warning.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: add missing header in ata.c
Pierre-Alexandre Meyer [Thu, 3 Sep 2009 17:15:20 +0000 (10:15 -0700)]
gpllib: add missing header in ata.c

This fixes an implicit definition warning.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: fix signedness warnings
Pierre-Alexandre Meyer [Thu, 3 Sep 2009 17:01:01 +0000 (10:01 -0700)]
hdt: fix signedness warnings

host_bus_type and interface_type are uint8_t. Force a cast when calling remove_spaces
on these fields.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: unify disk headers in hdt-common.h
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 23:02:30 +0000 (16:02 -0700)]
hdt: unify disk headers in hdt-common.h

Both cli and menu need to access disk functions. Include disk headers
in hdt-common.h, instead of duplicating code.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: remove get_error declaration from disk/util.h
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 23:00:20 +0000 (16:00 -0700)]
gpllib: remove get_error declaration from disk/util.h

In d1890409251949b80c2026557b9b12ca00d55144, it seems we
have forgotten to update util.h.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: fix cpuid.h Once-Only Header wrapper
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 22:52:21 +0000 (15:52 -0700)]
gpllib: fix cpuid.h Once-Only Header wrapper

It seems that the cpuid.h had a misplaced #endif.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: share PAGE_SIZE definition with cpuid.h
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 21:02:42 +0000 (14:02 -0700)]
gpllib: share PAGE_SIZE definition with cpuid.h

swsusp detection needs PAGE_SIZE. cpuid.h is actually already defining it.
Since both swsusp and cpuid are taken from the Linux kernel, it is a good idea to
share it (they really need to be equal).

We are going to rely on cpuid.h. Creating a page.h for this single definition seems
overkilling and the MMU is part of the CPU on x86 anyways.

Impact: fix compiler warning (redefinition).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: fix hdt-cli.c compilation warning
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 20:41:35 +0000 (13:41 -0700)]
hdt: fix hdt-cli.c compilation warning

We are missing a const qualifier.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: fix compiler warnings
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 20:30:20 +0000 (13:30 -0700)]
libansi: fix compiler warnings

Fix "warning: function declaration isn't a prototype" warnings.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: switch to libansi
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 18:33:40 +0000 (11:33 -0700)]
hdt: switch to libansi

Make hdt use libansi.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: switch to libansi
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 18:32:44 +0000 (11:32 -0700)]
cmenu: switch to libansi

Make cmenu use libansi.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: add missing prototype in the header
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 18:32:03 +0000 (11:32 -0700)]
libansi: add missing prototype in the header

clearwindow() was not presented in libansi.h.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: build libansi.o
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 18:30:32 +0000 (11:30 -0700)]
libansi: build libansi.o

Hook libansi.o into the lib/ build.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agolibansi: move to lib directory, as it is MIT, not GPL licensed
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 18:13:11 +0000 (11:13 -0700)]
libansi: move to lib directory, as it is MIT, not GPL licensed

gplinclude/gpllib should be used for external, GPL, libraries
only. libansi has been developed for Syslinux and is MIT licensed.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: add more ANSI functions
Pierre-Alexandre Meyer [Tue, 1 Sep 2009 18:07:07 +0000 (11:07 -0700)]
gpllib: add more ANSI functions

Import the functions that I introduced in cmenu.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: add a new ansi library
Pierre-Alexandre Meyer [Mon, 31 Aug 2009 22:59:17 +0000 (15:59 -0700)]
gpllib: add a new ansi library

HDT and cmenu are currently duplicating code: they both define their
own mini ansi library.

This patch extracts the HDT ansi lib into gpllib as a first step towards
unification.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: reset attributes instead of using ANSI sequence 22
Pierre-Alexandre Meyer [Mon, 31 Aug 2009 06:47:46 +0000 (23:47 -0700)]
cmenu: reset attributes instead of using ANSI sequence 22

hpa advised not to use ANSI sequence 22, as it may not work everywhere.
Instead, let's reset attributes and set last_attr to unknown. The next
background/foreground tests are then guaranteed to fire. We take a small
hit in terms of performance though.

Misc.: change initialization of last_attr to 0x300 (unknown) to trigger
properly the tests the first time.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: fix background color
Pierre-Alexandre Meyer [Mon, 31 Aug 2009 06:37:01 +0000 (23:37 -0700)]
cmenu: fix background color

The menu highlights some characters to mark them as key shortcuts.
To switch the bold attribute off, we were printing the reset code,
resetting the background color in the same time.

Use ANSI sequence 22 instead.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agoRevert "ansicon: allow to pass page # to write functions"
Pierre-Alexandre Meyer [Mon, 31 Aug 2009 00:14:02 +0000 (17:14 -0700)]
Revert "ansicon: allow to pass page # to write functions"

We shouldn't be using any pages, as there is no support on the
serial line.

This reverts commit e9b317fd0dc87dc93a49bc40520f4bdd0264d746.

15 years agocmenu: use 80x25 as terminal size by default
Pierre-Alexandre Meyer [Mon, 31 Aug 2009 00:11:33 +0000 (17:11 -0700)]
cmenu: use 80x25 as terminal size by default

Let's not rely on the geometry returned by the BIOS for the
terminal size - we don't know anything about the one used via serial.

We now default to 80x25, regardless of what the BIOS returns.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: misc. cleanups
Pierre-Alexandre Meyer [Mon, 31 Aug 2009 00:09:52 +0000 (17:09 -0700)]
cmenu: misc. cleanups

Fix a compiler warning and a header documentation.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: remove multi pages support
Pierre-Alexandre Meyer [Mon, 31 Aug 2009 00:06:30 +0000 (17:06 -0700)]
cmenu: remove multi pages support

The cmenu used to display the help on a separate page. Since we
can't have multi pages on the serial line, get rid of them completely.

This has a fairly big impact as the external cmenu API has changed.
adv_menu.tpl and HDT have been patched accordingly.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: use < for menu exit character
Pierre-Alexandre Meyer [Sun, 30 Aug 2009 03:55:34 +0000 (20:55 -0700)]
cmenu: use < for menu exit character

Use plain '<' as the "back" symbol.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: fix menu separators
Pierre-Alexandre Meyer [Sun, 30 Aug 2009 03:53:38 +0000 (20:53 -0700)]
cmenu: fix menu separators

Use the alternate character set to draw horizontal lines (menu
separator). Refactor the c*print functions in the same time as they
were severely broken.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: use > instead of » for submenus
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 18:26:17 +0000 (11:26 -0700)]
cmenu: use > instead of » for submenus

» doesn't exist in the alternate character set. Use plain
> instead.

Misc.: fix SO/SI invocation, putchar takes a char, fputs a string.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: remove extra getboxchars call
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 05:38:08 +0000 (22:38 -0700)]
cmenu: remove extra getboxchars call

getboxchars is not used anymore in drawbox. Let's get rid of it.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: build cleanups
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 05:28:05 +0000 (22:28 -0700)]
cmenu: build cleanups

Fix build warnings and remove old cls declaration.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: refactor cswprint function
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 05:27:22 +0000 (22:27 -0700)]
cmenu: refactor cswprint function

Now that cprint is smarter, cswprint can be simplified.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: refactor printmenuitem function
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 05:21:00 +0000 (22:21 -0700)]
cmenu: refactor printmenuitem function

Simplify the printmenuitem function, now that putch is smarter.

15 years agocmenu: refactor beep function
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 05:14:10 +0000 (22:14 -0700)]
cmenu: refactor beep function

Use \007 to make the system beep. Note "\007" works, but not '\007'.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: refactor cprint functions
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 05:09:53 +0000 (22:09 -0700)]
cmenu: refactor cprint functions

Some refactoring:

* Make cprint_vga2ansi static, as it is an internal function.
* Simplify the logic in cprint().

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: use VT-100 alternate character set for drawing boxes
Pierre-Alexandre Meyer [Sat, 29 Aug 2009 05:06:12 +0000 (22:06 -0700)]
cmenu: use VT-100 alternate character set for drawing boxes

Use the Special Characters and Line Drawing Character Set as
described in http://www.vt100.net/docs/vt102-ug/table5-13.html
to draw boxes around the menus.

Note that to work in xterm, G1 needs to be initialized (to point
to the alternate character set). This is done in the cls function
("\033)0").

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: remove unused bit_reverse function
Pierre-Alexandre Meyer [Fri, 21 Aug 2009 15:37:06 +0000 (08:37 -0700)]
cmenu: remove unused bit_reverse function

Not needed anymore: we use a lookup table (ansi_char)
in cprint_vga2ansi now to reverse Background and Foreground bits..

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: better implementation of vga->ansi
Pierre-Alexandre Meyer [Fri, 21 Aug 2009 06:00:25 +0000 (23:00 -0700)]
cmenu: better implementation of vga->ansi

hpa suggested a better implementation, that also fixes some color
issues and invalid ANSI codes. Thanks hpa!

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: implement cprint using printf
Pierre-Alexandre Meyer [Fri, 21 Aug 2009 05:02:50 +0000 (22:02 -0700)]
cmenu: implement cprint using printf

First step towards a usable menu. Color is now sent over serial.

Testing Done: launched HDT over serial. The background got drawn blue,
as expected.

Note: vga attributes need to be converted to ansi codes.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: remove unused getchar function
Pierre-Alexandre Meyer [Wed, 19 Aug 2009 04:55:41 +0000 (21:55 -0700)]
cmenu: remove unused getchar function

char getchar(void) doesn't seem to be used.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: implement scrollup using SU escape sequence
Pierre-Alexandre Meyer [Wed, 19 Aug 2009 04:20:54 +0000 (21:20 -0700)]
cmenu: implement scrollup using SU escape sequence

Use the ANSI SU - Scroll Up escape sequence to scrollup the window.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agocmenu: implement gotoxy using escape sequences
Pierre-Alexandre Meyer [Wed, 19 Aug 2009 04:09:09 +0000 (21:09 -0700)]
cmenu: implement gotoxy using escape sequences

Use ansicon and the ANSI CUP - CUrsor Position escape sequence
to implement the gotoxy function.

Note: page switching is not supported (yet).

Testing Done: ran com32/cmenu/test.c32 in qemu.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agoansicon: allow to pass page # to write functions
Pierre-Alexandre Meyer [Tue, 11 Aug 2009 15:58:19 +0000 (08:58 -0700)]
ansicon: allow to pass page # to write functions

Some video modes support up to 8 different pages, the current one being
stored at 0x462.

The display page value is passed in BH when invoking the INT 10h Video
Service routines. This patch changes the interface of ansicon_write_char
and ansicon_set_cursor to allow the caller to specify the page.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: add bootloader detection (menu)
Pierre-Alexandre Meyer [Thu, 27 Aug 2009 04:31:32 +0000 (21:31 -0700)]
hdt: add bootloader detection (menu)

Print the bootloader ID in the partition submenu if we recognize it.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: add bootloader detection (CLI)
Pierre-Alexandre Meyer [Thu, 27 Aug 2009 04:27:18 +0000 (21:27 -0700)]
hdt: add bootloader detection (CLI)

When iterating through all partitions (e.g. `show disks'),
print the bootloader ID if we recognize it.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: add bootloader detection
Pierre-Alexandre Meyer [Thu, 27 Aug 2009 04:21:38 +0000 (21:21 -0700)]
gpllib: add bootloader detection

Given an (active) partition, look for a bootloader ID.

Syslinux prints a string (SYSLINUX or EXTLINUX) between bytes
3 and 10.

After some random tests, it seems that Windows™98/98SE and Windows™ME
put MSWIN4.1 at the same place. Internet seems to confirm it:

   http://www.geocities.com/thestarman3/asm/mbr/MSWin41BRinHexEd.htm

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: rename __BOOTLOADERS_H_ to __MBRS_H_ in mbrs.h
Pierre-Alexandre Meyer [Thu, 27 Aug 2009 03:52:45 +0000 (20:52 -0700)]
gpllib: rename __BOOTLOADERS_H_ to __MBRS_H_ in mbrs.h

We had forgotten to update the #define when renaming the file.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: rename bootloader detection to MBR detection
Pierre-Alexandre Meyer [Wed, 26 Aug 2009 07:31:43 +0000 (00:31 -0700)]
gpllib: rename bootloader detection to MBR detection

bootloaders.c really inspects the MBR, not the bootloader itself.
Let's not confuse the two of them.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: use four bytes to discover the MBR
Pierre-Alexandre Meyer [Wed, 26 Aug 2009 07:17:40 +0000 (00:17 -0700)]
gpllib: use four bytes to discover the MBR

Syslinux and Master Boot LoaDeR share the first 2 bytes. Use one more
to distinguish between the two of them.

To keep standards types, uint16_t is being replaced by uint32_t.
The extra byte is not used yet.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agoNEWS: update for 3.83
H. Peter Anvin [Wed, 26 Aug 2009 04:19:26 +0000 (21:19 -0700)]
NEWS: update for 3.83

15 years agohdt: enhance error reporting in the CLI (disk) syslinux-3.83-pre9
Pierre-Alexandre Meyer [Sat, 22 Aug 2009 18:08:04 +0000 (11:08 -0700)]
hdt: enhance error reporting in the CLI (disk)

parse_partition_table can fail for two reasons: disk I/O
error or unrecognized partition layout (non msdos, corrupt, ...).

In the latter case, we were displaying

   Error parsing disk 0x80
   parse_partition_table: error 0

which is confusing. We now display

   Disk 0x80: unrecognized partition layout

or the errno_disk in case of I/O errors.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: make get_error behaves like perror
Pierre-Alexandre Meyer [Sat, 22 Aug 2009 17:34:40 +0000 (10:34 -0700)]
hdt: make get_error behaves like perror

This simplifies buffer handling.

Misc.: clean some old error code handling.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: fix CLI crash when parsing unsupported geometries
Pierre-Alexandre Meyer [Sat, 22 Aug 2009 16:42:37 +0000 (09:42 -0700)]
hdt: fix CLI crash when parsing unsupported geometries

Remove extra free() calls: these were needed before the introduction
of the disklib errno. We apparently forgot to remove them.

Reported-by: Gert Hulselmans <hulselmansgert@gmail.com>
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: right-align information about each disk (CLI)
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 21:59:42 +0000 (14:59 -0700)]
hdt: right-align information about each disk (CLI)

Align C/H/S, EDD and Bootloader fields.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: enhance user experience (CLI) - try harder
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 21:57:45 +0000 (14:57 -0700)]
hdt: enhance user experience (CLI) - try harder

Alright - let's try again.

  * Manually increment the display_line_nb counter in the disk CLI
    (we are doing a multi line more_printf!)
  * Add the pause_printf() macro to pause the CLI as needed

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: fix comment
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 21:40:49 +0000 (14:40 -0700)]
gpllib: fix comment

buffer_ptr has been renamed to s.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: fix comment
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 21:40:49 +0000 (14:40 -0700)]
gpllib: fix comment

buffer_ptr has been renamed to s.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: enhance user experience (CLI)
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 21:31:53 +0000 (14:31 -0700)]
hdt: enhance user experience (CLI)

Some users have reported that reading the CLI can be difficult,
especially when spitting out a lot of information.

This patch:

  * adds a missing reset_more_printf() in the disk CLI
  * reduces the total scrolling to 20 lines (seems better in my testing)
  * removes a reset_more_printf() in the show disk function. This can potentially
    be bad when doing a lot of show disk 0xXX (especially after 4 in a row)
    but enhances the display when running show disks with lots of disks.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: enhance user experience (CLI)
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 21:31:53 +0000 (14:31 -0700)]
hdt: enhance user experience (CLI)

Some users have reported that reading the CLI can be difficult,
especially when spitting out a lot of information.

This patch:

  * adds a missing reset_more_printf() in the disk CLI
  * reduces the total scrolling to 20 lines (seems better in my testing)
  * removes a reset_more_printf() in the show disk function. This can potentially
    be bad when doing a lot of show disk 0xXX (especially after 4 in a row)
    but enhances the display when running show disks with lots of disks.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: tweak bootloader display (menu)
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:50:32 +0000 (10:50 -0700)]
hdt: tweak bootloader display (menu)

The extra "id" makes the menu too large under Qemu, removing it
enhances the user experience.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: fix bootloader entry alignment
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:47:43 +0000 (10:47 -0700)]
hdt: fix bootloader entry alignment

We're missing a space here.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: print bootloader name (menu)
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:45:01 +0000 (10:45 -0700)]
hdt: print bootloader name (menu)

Add bootloader information in the disk menu.

Misc.: fix compilation warning by refactoring the compute_disks interface
(remove unneeded hardware->disk_info argument).

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: fix compilation warning (disk/bootloaders.h)
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:43:53 +0000 (10:43 -0700)]
gpllib: fix compilation warning (disk/bootloaders.h)

struct driveinfo is defined in disk/geom.h.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: print bootloader name (CLI)
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:29:36 +0000 (10:29 -0700)]
hdt: print bootloader name (CLI)

`show disks' in the CLI now prints bootloader information, e.g.

DISK 0x83:
  C/H/S: 1023 cylinders, 255 heads, 63 sectors/track
  EDD:   Version: 30
         Size:  10 GiB, 512 bytes/sector, 63 sectors/track
         Host bus: ISA, Interface type: ATA
  Bootloader: Grub (id 0xEB48)

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: bootloader id should be uint16_t
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:27:09 +0000 (10:27 -0700)]
gpllib: bootloader id should be uint16_t

The id is of the form 0xABCD: use uint16_t instead of int.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: detect bootloader ids when probing disks
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:22:06 +0000 (10:22 -0700)]
hdt: detect bootloader ids when probing disks

Add a bootloader_ids[] array in the hardware structure to store bootloader
ids when probing the disks.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agogpllib: add bootloader detection
Pierre-Alexandre Meyer [Sun, 23 Aug 2009 17:20:06 +0000 (10:20 -0700)]
gpllib: add bootloader detection

The first two bytes of the hard drive can help identifying the boot code
installed in the MBR.

Values from the boot_info_script:

    http://sourceforge.net/projects/bootinfoscript/

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: enhance error reporting in the CLI (disk)
Pierre-Alexandre Meyer [Sat, 22 Aug 2009 18:08:04 +0000 (11:08 -0700)]
hdt: enhance error reporting in the CLI (disk)

parse_partition_table can fail for two reasons: disk I/O
error or unrecognized partition layout (non msdos, corrupt, ...).

In the latter case, we were displaying

   Error parsing disk 0x80
   parse_partition_table: error 0

which is confusing. We now display

   Disk 0x80: unrecognized partition layout

or the errno_disk in case of I/O errors.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: make get_error behaves like perror
Pierre-Alexandre Meyer [Sat, 22 Aug 2009 17:34:40 +0000 (10:34 -0700)]
hdt: make get_error behaves like perror

This simplifies buffer handling.

Misc.: clean some old error code handling.

Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: fix CLI crash when parsing unsupported geometries
Pierre-Alexandre Meyer [Sat, 22 Aug 2009 16:42:37 +0000 (09:42 -0700)]
hdt: fix CLI crash when parsing unsupported geometries

Remove extra free() calls: these were needed before the introduction
of the disklib errno. We apparently forgot to remove them.

Reported-by: Gert Hulselmans <hulselmansgert@gmail.com>
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
15 years agohdt: 0.3.4 syslinux-3.83-pre8
erwan [Thu, 20 Aug 2009 04:24:16 +0000 (06:24 +0200)]
hdt: 0.3.4

Impact: New release

0.3.4 is now out !