summaryrefslogtreecommitdiffstats
path: root/ui/ncurses
Commit message (Collapse)AuthorAgeFilesLines
* ui/ncurses: Add safe mode indicatorJeremy Kerr2014-07-221-0/+5
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: allow tab/backtab to skip through a widget's fieldsJeremy Kerr2014-07-221-2/+19
| | | | | | | | Since we may have a long list of devices on the configuration screen, we'd like a way to jump between widgets. This change repeats the PREV_FIELD/NEXT_FIELD driver request on these events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Make Network: heading consistent with other labelsJeremy Kerr2014-07-221-1/+1
| | | | | | | The 'Network' label was originally intended as a header, but we should keep it consistent with other field labels. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Expose boot_device configuration through UIJeremy Kerr2014-07-222-22/+170
| | | | | | | | | | | | | | | | Add a configuration setting for the default boot device. We change the autoboot option to a select, as we have three possible behaviours for autoboot: ( ) Don't autoboot ( ) Autoboot from any disk/network device ( ) Only autoboot from a specific disk/network device The latter option will show a list of possible devices to seelct for autoboot behaviour. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Remove net_conf parameter from sconfig_screen_layout_widgetsJeremy Kerr2014-07-171-8/+7
| | | | | | | We always pass screen->net_conf_type as this parameter, so we may as weel grab it from screen directly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: specify a fixed length for status messagesJeremy Kerr2014-07-161-2/+2
| | | | | | | | | | Incoming status messages can be an arbitrary length; if so, the status line may be corrupt. This change uses the 'n' variant of mvwaddnstr(), so we only write one line of characters. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover,ui: fix checks for debug optionJeremy Kerr2014-05-011-1/+1
| | | | | | We need to check for equality with opt_yes, not just check for non-zero. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: only cancel default boot on valid key eventsJeremy Kerr2014-04-221-4/+7
| | | | | | | | | | We're seeing occasionaly failures to autoboot due to supirious key events (getch() returing -1) on an IPMI console. This change modifies the process_key logic to only abort the default if we see a valid key event. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Always provide a key definition for backtabJeremy Kerr2014-04-161-0/+5
| | | | | | | | | | | | | Petitboot environments will probably want a basic terminfo defintion (eg, vt220) rather than a full linux or xterm, but vt220 and friends don't define a backtab key. Backtab can be useful for proper form navigation, and without a key definition, we just get an escape, which exits the current screen. This change provides a static definition for KEY_BTAB, so we should always have one available. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use a fixed-sized for small, known-length fieldsJeremy Kerr2014-04-163-1/+11
| | | | | | | | | | | | | Fields without O_STATIC can "scroll" horizontally, and we may miss a left-hand section of text from the current display. This can mean that the user can't leave a validated field with no indication why, if the off-to-the-left data is not a valid entry. This change adds a widgetset function to mark a field as fixed-size, so we don't have this scrolling behaviour. This means that the entire field contents will always be visible, and any validation errors can be seen. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Ensure boot option labels are displayable as menu itemsJeremy Kerr2014-04-101-1/+43
| | | | | | | | | | | | | | | ncurses' new_item() expects the name parameter to be a "printable string", by converting it to a wchar *, and checking that each character is printable with iswprint(). If it fails, we won't see a boot option at all. This change introduces a function to convert the label into something we know is printable, and valid UTF-8. If mbstowcs fails, we replace it with a generic 'Invalid option' label. If we encounter a valid multibyte string with unprintable characters, we replace those with U+fffd REPLACEMENT CHARACTER. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Fix discover_client leakJeremy Kerr2014-04-101-0/+1
| | | | | | | We're not freeing the discover_client on exit, as it's not attached to any existing talloc context. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: unpost ncurses menu in pmenu cleanup pathJeremy Kerr2014-04-101-0/+1
| | | | | | We need to unpost the menu so that free_item can actually free the item. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use pmenu_item destrutor to free ncurses ITEMsJeremy Kerr2014-04-101-6/+9
| | | | | | | | | | Currently, pemnu_destroy is used to free items. This means that the menu code needs to iterate over items, and we have no way to free the ITEM * of items that aren't in a menu. Instead, free the ITEM in the pmenu_item destructor. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Separate menu item creation & initialisation from insertionJeremy Kerr2014-04-104-70/+67
| | | | | | | | | | | | | | | | | | | | | | | Currently, the menu item creation is has two main functions: pmenu_item_alloc and pmenu_item_setup. The latter does initialisation (it sets item->name), and inserts the item into the menu. We have pmenu_item_init to combine this into one, but that means we need to do further initialisation (eg, to set on_execute) after the item has been added to the menu. Instead, this change use a more direct _create and _insert interface. Create does the allocation and initialisation, while _insert does the actual insertion. This means new_item failures will be detected at creation time, rather than during pmenu_insert. Also, we're now insert a completely-populated item into the menu, rather than populating on_edit, on_execute and data after insertion. Because we can detect errors from creation (ie, from new_item failing), we add handling code to cui_boot_option_add and cui_boot_editor_on_exit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Don't use menu offsets for user item numbersJeremy Kerr2014-04-101-1/+2
| | | | | | | The menu offsets are arbitrary, use a separate numbering scheme for user items. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Remove pmenu_item_replaceJeremy Kerr2014-04-082-49/+0
| | | | | | ... as nothing uses it. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Don't free item in pmenu_item_setupJeremy Kerr2014-04-083-7/+16
| | | | | | | | | | | | | Currently pmenu_item_setup may free its item parameter on error. This makes it non-obvious whether the item is still allocated on exit to the caller. Instead, this change removes the talloc_free, and requires that the caller do this on error. This makes the potential use-after-free in cui_boot_editor_on_exit obvious, so we fix that too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: clear DNS server setting before appending new serversJeremy Kerr2014-04-071-0/+4
| | | | | | | | | | Currently, we have a bug where newly-configured DNS servers are appended to the existing set of servers, rather than replacing them. This change clears the existing servers out before adding the newly-configured ones. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* log: Allow runtime selection of 'debug' log levelJeremy Kerr2014-04-071-2/+10
| | | | | | | | | | | | | | | | | Currently, we need to compile with -DDEBUG to implement debug-level logging in the UIs and discover server. Since we may not be able to easily replace a system's petitboot binaries, this change introduces a -v|--verbose option to the discver server and ncurses UI, which enables debug at runtime. We also move some of the udev debug code out of an #ifdef DEBUG block. Since petitboot is generally started on boot, we also add a little infrastructure to pass -v to petitboot on certain system contitions: either petitboot.debug on the kernel command line, or a petitboot,debug? NVRAM property containing the value 'true'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use tty name in default log filenameJeremy Kerr2014-04-031-5/+35
| | | | | | | | | | | When we have multiple ncurses UIs running, we'd like to log to separate files. Currenly, all UIs log to the same file, which makes it diffifult to determine which UI is logging each message. This change uses the output of ttyname() (sanitised appropriately) as a component of the default log filename. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add menu option to restart discoveryJeremy Kerr2014-04-023-2/+16
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Ensure that the selected menu item is visibleJeremy Kerr2014-03-031-5/+16
| | | | | | | | | | When adding new items to the petitboot menu, we need to ensure that the scroll position of the menu includes the currently-selected item. This change adds a call to set_top_row, calculated from the selected item index, and the number of rows in the menu. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Unify key bindings & key help textJeremy Kerr2014-01-316-4/+70
| | | | | | | | | | This change is a small cleanup of the key bindings; we ensure that the general key bindings are available (and documented) on all screens. In order to keep things consistent, this change adds an initial UI guidelines text file, which documents the general key bindings. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add help to boot editor screenJeremy Kerr2014-01-313-2/+49
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add help to system configuration screenJeremy Kerr2014-01-313-4/+51
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add help to sysinfo screenJeremy Kerr2014-01-313-0/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add help facility to text screensJeremy Kerr2014-01-312-0/+17
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add help text to nc-menu & generic-mainJeremy Kerr2014-01-315-2/+31
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add support for help screensJeremy Kerr2014-01-315-0/+127
| | | | | | | Add a textscreen-based help screen system, triggered from the cui module's cui_show_help() Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add text_screen_set_text()Jeremy Kerr2014-01-312-9/+38
| | | | | | When we have a large chunk of text, we'll want to add it all in one go. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Abstract text-screen code from sysinfo screenJeremy Kerr2014-01-315-140/+230
| | | | | | | | | | We want to implement help screens, which are very similar to the sysinfo screen - show a set of lines, and allow scrolling. This change splits the text-screen rendering code into a new nc-textinfo module. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: do all config screen updates in config_screen_postJeremy Kerr2014-01-311-5/+10
| | | | | | | | We call _post when the config screen is to be displayed, so do all drawing here. This means we get the same drawing code on both init and update. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Use descriptive field labels for boot editorJeremy Kerr2014-01-311-6/+10
| | | | | | | Rather than the brief names for the boot editor field label, expand (and capitalise) for a more-friendly form. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-config: Add config_copyJeremy Kerr2014-01-301-2/+3
| | | | | | | | | | | | | | At the moment, UIs have the config_set_defaults function to estabilish an initial configuration when performing an update. Rather than using the defaults, this change provides a config_copy() function, so that the updated configuration can be initialised from the current config. With this in place, the UI/server-common pb-config module can be reduced to just the one function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-config: Add validation for network settingsJeremy Kerr2013-12-181-9/+30
| | | | | | | Use the new widget validators, plus a bit of whole-form logic, to implement some basic validation on the config UI. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-widgets: Add initial textbox validation functionsJeremy Kerr2013-12-182-0/+68
| | | | | | | | | We'd like to do some validation of the system configuration parameters, so add a few validation types to the widget code. We currently need integer, ipv4 address and multiple ipv4 address types. These are implemented as small wrappers around the ncurses form validator code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-config: expand mask fieldJeremy Kerr2013-12-181-1/+1
| | | | | | This makes it obvious if there's more than two characters in the field. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Use AC_GNU_SOURCEJeremy Kerr2013-12-189-20/+20
| | | | | | | Rather than #defining _GNU_SOURCE in our .c files, we can define this from config.h instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add link status to system info & system config screensJeremy Kerr2013-12-182-3/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/util: Move mac_buf from nc code to util libraryJeremy Kerr2013-12-181-22/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/boot-editor: Fix (null) when non-device resources are shownJeremy Kerr2013-12-031-1/+1
| | | | | | | | | | | We're seeing the following in the boot editor: image: (null)ftp://... the (null) is due to the sep in conditional_prefix, which should be blank, not NULL. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add key debugJeremy Kerr2013-12-021-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses/nc-widgets: Unify select keyJeremy Kerr2013-11-221-15/+11
| | | | | | | | We have a few instances where we check for a 'select' action (enter or space key event), and some are inconsistent. Unify these with a key_is_select() function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Redraw entire screen with ctrl+LJeremy Kerr2013-11-221-4/+2
| | | | | | Use wrefresh(curscr) to clean and repaint the entire screen. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Ensure boot editor window is properly paintedJeremy Kerr2013-11-221-0/+2
| | | | | | | We're not currently drawing the window title correctly; we need to draw the main_ncw for this to hit the terminal. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Fix use-after-free when exiting boot option editorJeremy Kerr2013-11-221-13/+29
| | | | | | | | After we've called on_exit, we can no longer use the boot editor. This change moves individual button callbacks into process_key, which returns to the main loop. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Allow boot editor sysinfo updatesJeremy Kerr2013-11-222-65/+99
| | | | | | | We may start a boot editor (via 'New') before we have the sysinfo. To allow this, we redraw the device select. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add widgetset_set_windowJeremy Kerr2013-11-222-0/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: Add widget_select_drop_optionsJeremy Kerr2013-11-222-0/+40
| | | | | | We want to be able to re-set the options in a select widget. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud