Novell Home

HowTo: Create a Dialog Console-Based Configuration Helper - Part 2

Novell Cool Solutions: Feature
By Stomfi

Digg This - Slashdot This

Posted: 13 Oct 2005
 

StomfiLearning to use Linux at Home and Work
Welcome to my ongoing series of HowTo articles designed to help Linux newbies get comfortable with Linux. Before trying any of these HowTos, take a few minutes to study the prerequisites so you can hit the ground running.
--Stomfi

This is part 2 of the fixit system, a utility for helping the newbie fix common SUSE configuration problems from the command line.

In part 1 we developed the main menu and the X Window item. The utility displayed the contents of the X configuration file, or various parts of it, and context-sensitive help. The help was extracted from the existing SUSE documentation and saved in help files for the fixit system. The fixit system was saved in a global directory tree "/usr/local/FIXIT" with root permissions, and a check performed when starting the utility to make sure that the user is "root", as only root can make system configuration changes.

To help you set up your system effectively, this is the contents of the various X system help files. The first bold line is the file name which exactly corresponds to the keyword in the selection dialog window.

Overview

SaX2 is a program to configure the X-Server.
It is able to detect almost all stuff related to the graphics card.
The graphics card, Touchscreens, Tablets, 3D features, AccessX, Keyboard, Mouse, Multihead, ... and more can be configured using this tool.

SaX2 starts an X Window where all configuration changes can be made.

If you are having trouble starting the X Server, it is better to make conservative choices when trying an initial setup.
e.g. resolution 800x600. Make small increments until you get an error. Change only one parameter at a time.

In the left navigation bar, there are four main items: Display, Input devices, Multihead, and AccessX.

Configure your monitor, graphics card, color depth, resolution, and the position and size of the screen under Display.

The keyboard, mouse, touchscreen monitor, and graphics tablet can be configured under Input devices. Use Multihead to configure multiple screens. AccessX is a useful tool for controlling the mouse pointer with the number pad.

Files

This shows the list of possible font files and input devices on the system. The system will automatically find these, so no user configuration should be necessary.

If your X server won't start because it can't load the fonts, this is usually because you have run out of room in the system temporary folder /tmp. In many cases there will be iso files from CD or DVD burning using up the space. Use df to check whether this is the case, and delete some unused temporary files.

Input Devices

Mouse

If the automatic detection fails, use this dialog to configure your mouse manually. Refer to the documentation of your mouse for a description of the model. Select your model from the list of supported mouse types and confirm by pressing 5 on the number pad.

Keyboard

Use the selection field at the top of this dialog to specify the kind of keyboard to use. Then select the language for the keyboard layout (the country-specific position of the keys). Use the test field to check if special characters are displayed correctly.

The status of the check box used for activating and deactivating the entry of accented letters depends on the respective language and does not need to be changed. Click Finish to apply the new settings to your system.

Touchscreen

Currently, X.Org only supports Microtouch and Elo TouchSystems touchscreens. SaX2 can only autodetect the monitor, not the toucher. The toucher is treated as an input device.

To configure the toucher, start SaX2 and select Input devices+Touchscreens. Click Add and add a touchscreen. Save the configuration by clicking Finish. You do not need to test the configuration.

Touchscreens feature a variety of options and usually must be calibrated first. Unfortunately, there is no general tool for this purpose in Linux. The standard configuration contains suitable default values for the dimensions of the touchscreen. Normally, no additional configuration is required.

Graphics Tablet

Currently, X.Org only supports a limited number of graphics tablets. SaX2 enables the configuration of graphics tablets connected to the USB port or the serial port. From the configuration perspective, a graphics tablet is just an input device like a mouse.

Start SaX2 and select Input devices+Graphics tablet. Click Add, select the vendor from the following dialog, and add a graphics tablet from the selection list. Mark the check boxes to the right if you have connected a pen or eraser. If your tablet is connected to the serial port, verify the port. /dev/ttyS0 refers to the first serial port. /dev/ttyS1 refers to the second. Additional ports use similar notation. Save the configuration by clicking Finish.

AccessX

If you do not use a mouse on your computer, start SaX2 and activate AccessX to be able to control the mouse pointer with the keys on the numeric keypad. Use the slider to set the speed of the mouse pointer movement when a key is pressed.

Colors and Resolutions

Here, three tabs are available: Colors, Resolution, and Expert.

Monitor

In the left part of the window, select the vendor. In the right part, select your model. If you have floppy disks with Linux drivers for your monitor, install these by clicking Manufacturer Disk.

Frequencies

Here, enter the horizontal and vertical frequencies for your screen. The vertical frequency is another designation for the image refresh rate. Normally, the acceptable value ranges are read from the model and entered here. Usually, they do not need to be changed.

Expert

Here, enter some options for your screen. In the upper selection field, define the method to use for the calculation of the screen resolution and screen geometry. Do not change anything unless the monitor is addressed incorrectly and the display is not stable. Additionally, you can change the size of the displayed image and activate the power saving mode DPMS.

Configuring the Monitor Frequencies

There are safety mechanisms, but you should still be very careful when manually changing the allowed frequencies. Incorrect values may destroy your monitor. If in doubt, refer to the manual of the monitor.

Modes

Colors and Resolutions

Here, three tabs are available: Colors, Resolution, and Expert.

Colors

Depending on the hardware used, select a color depth of 16, 256, 32768, 65536, or 16.7 million colors (4, 8, 15, 16, or 24 bit). For a reasonable display quality, set at least 256 colors.

Resolution

The module offers all resolution and color depth combinations that your hardware can display correctly. This keeps the danger very low for damaging your hardware with incorrect settings in SUSE Linux. If you change the resolution manually, consult the documentation of your hardware to make sure the value set can be displayed.

Configuring the Resolution

Expert

In addition to the resolutions offered in the previous tab, this tab enables you to add your own resolutions, which will subsequently be included for selection in the tab.

Virtual Resolution

Every desktop has a certain resolution that is displayed over the full screen of the monitor. Additionally, it is possible to set the resolution larger than the visible area of the screen. If you move the mouse beyond the margins of the desktop, the virtual part of the desktop is displayed on screen. This increases the available work space.

Configuring the Virtual Resolution

The virtual resolution can be set in two different ways. To set it using Drag&Drop, move the mouse pointer over the monitor image so it turns into crosshairs. Keep the left mouse button pressed and move the mouse to enlarge the raster image, which corresponds with the virtual resolution. This method is best if you are not quite sure how much virtual space you want on your desktop.

By selection from the pop-up menu, the pop-up menu in the middle of the raster image displays the currently used virtual resolution. To use one of the default virtual resolutions, select one from the menu.

Device

The graphics card dialog has two tabs: General and Expert. In General, select the vendor of your graphics card on the left side and the model on the right.

Selecting the Graphics Card

Expert offers more advanced configuration possibilities. On the right side, turn your screen to the left or to a vertical position (useful for some turnable TFT screens). The entries for the BusID are only relevant if you operate several screens. Normally, nothing needs to be changed here. You should not modify the card options unless you have experience in this field and know what the options mean. If necessary, check the documentation of your graphics card.

Screen

Colors and Resolutions

Three tabs are available: Colors, Resolution, and Expert.

Colors

Depending on the hardware used, select a color depth of 16, 256, 32768, 65536, or 16.7 million colors (4, 8, 15, 16, or 24 bit). For a reasonable display quality, set at least 256 colors.

Resolution

The module offers all resolution and color depth combinations that your hardware can display correctly. This keeps the danger of damaging your hardware with incorrect settings very low in SUSE Linux. If you change the resolution manually, consult the documentation of your hardware to make sure the value set can be displayed.

Configuring the Resolution

Expert

In addition to the resolutions offered in the previous tab, this tab enables you to add your own resolutions, which will subsequently be included for selection in the tab.

Virtual Resolution

Every desktop has a certain resolution that is displayed over the full screen of the monitor. Additionally, it is possible to set the resolution larger than the visible area of the screen. If you move the mouse beyond the margins of the desktop, the virtual part of the desktop is displayed on screen. This increases the available work space.

Configuring the Virtual Resolution

The virtual resolution can be set in two different ways. To set it using Drag&Drop, move the mouse pointer over the monitor image so it turns into crosshairs. Keep the left mouse button pressed and move the mouse to enlarge the raster image, which corresponds with the virtual resolution. This method is best if you are not quite sure how much virtual space you want on your desktop.

By selection from the pop-up menu, the pop-up menu in the middle of the raster image displays the currently used virtual resolution. To use one of the default virtual resolutions, select one from the menu.

3D Acceleration

If you did not activate 3D acceleration during the initial installation or when you installed a new graphics card, you can do this here.

Image Position and Size

Under these two tabs, precisely adjust the size and the position of the image with the arrows. If you have a multihead environment (more than one screen), use Next screen to switch to the other monitors to adjust their sizes and positions. Press Save to save your settings.

Adjusting the Image Geometry

Multihead

If you have installed more than one graphics card in your computer or a graphics card with multiple outputs, you can connect more than one screen to your system. If you operate two screens, this is referred to as dualhead. More than two is referred to as multihead. SaX2 automatically detects multiple graphics cards in the system and prepares the configuration accordingly. Set the multihead mode and the arrangement of the screens in the multihead dialog. Three modes are offered: Traditional (default), One screen (Xinerama), and Clone mode.

Traditional Multihead

Each monitor represents an individual unit. The mouse pointer can switch between the screens.

Cloned Multihead

In this mode, all monitors display the same contents. The mouse is only visible on the main screen.

Xinerama Multihead

All screens combine to form a single large screen. Program windows can be positioned freely on all screens or scaled to a size that fills more than one monitor.

The layout of a multihead environment describes the arrangement of and the relationship between the individual screens. By default, SaX2 configures a standard layout that follows the sequence of the detected graphics cards, arranging all screens in a row from left to right. In the Layout dialog of the multihead tool, determine the way the monitors are arranged by using the mouse to move the screen symbols in the grid. After completing the layout dialog, verify the new configuration by clicking Test.

Linux currently does not offer 3D support for Xinerama multihead environments. In this case, SaX2 deactivates the 3D support.

ServerLayout

This item shows you the configured server layout summary.

You saw a bit of repetition in the above help content, but it is better to repeat one's self than leave out an important explanation.

In the list of common configurations that can prevent a newbie from being able to access their system or use its services correctly I had mouse, netcard, printer, runlevel, and services in addition to xconf which has been developed above.

These last five are less complex and the scripts are more or less similar. They all use a "YaST" module to configure. Here is the script /usr/local/FIXIT/mouse/bin/conview:

#! /bin/sh

#confview

#list configs

#fixit dir

FIXITM="/usr/local/FIXIT/mouse"

# tmp file

rm -f $FIXITM/tmp/clist.txt

#set Config file

#Insert Overview as first item

echo "Overview \"\" off \\" > $FIXITC/tmp/clist.txt

echo "Mouse \"\" on \\" >> $FIXITM/tmp/clist.txt

cat $FIXITM/share/dial1 $FIXITM/tmp/clist.txt $FIXITM/share/dial2 > $FIXITM/tmp/fixitl

sh $FIXITM/tmp/fixitl

The dial1 script is the same for all, so you can copy the xconf version to the mouse folder. This is the mouse dial2 script:

2> $tempfile


retval=$?

choice=`cat $tempfile`

case $retval in

   0)

      rm -f $tmpfile

      sh /usr/local/FIXIT/mouse/bin/conf $choice;;

   1)

      rm -f $tmpfile

      sh /usr/local/FIXIT/bin/fixit;;

   2) temptext=/usr/local/FIXIT/mouse/tmp/ftext$$

      trap "rm -f $temptext" 0 1 2 5 15

      if [ ${#choice} -gt 0 ]

      then

         HELP=`echo $choice |cut -d" " -f2`

         TEXT="/usr/local/FIXIT/mouse/share/doc/$HELP"

      else

         TEXT="/usr/local/FIXIT/mouse/share/doc/help"

      fi

      test -f $TEXT

      cat $TEXT | expand >> $temptext

      rm -f $tmpfile

      $DIALOG --keep-window --title "HELP MESSAGE" --textbox "$temptext" 22 77

      case $? in

         0) rm -f $temptext

            sh /usr/local/FIXIT/mouse/tmp/fixitl;;

         255) rm -f $temptext

            sh /usr/local/FIXIT/mouse/tmp/fixitl;;

      esac

      ;;

   3) rm -f $tmpfile

      yast mouse

      sh /usr/local/FIXIT/mouse/tmp/fixitl;;

   255)

      rm -f $tmpfile

      sh /usr/local/FIXIT/bin/fixit;;

esac

You can see that all the paths relate to the mouse folder. I have left the argument $choice for the conf script, but it is not used. I did this to make the script reusable for those that have these options, and all I have to do is change the path folder reference, when I copy it to the next item tree.

Also you will see that "yast mouse" is set as the configuration tool. This launches the YaST mouse module. You can launch other command line YaST modules in this way to save time.

A full list can be obtained by typing "yast -l".

This is the mouse/bin/conf script:

#!/bin/sh

#Show text and return to section list

#fixit dir

FIXITM="/usr/local/FIXIT/mouse"

rm -f $FIXITM/tmp/conflist.txt

MCONF="/etc/sysconfig/mouse"

cat $MCONF >> $FIXITM/tmp/conflist.txt

#Show the config

sh $FIXITM/bin/textbox

#Return to the config list

sh $FIXITM/tmp/fixitl

The configuration is kept in "/etc/sysconfig/mouse". This is where most of the other configurations can be found – always a good place to look if you are browsing the file system looking for answers to problems.

The path in the line starting "TEXT=" in the file mouse/bin/textbox has to be changed to reflect the mouse folder. This file can be copied and changed from the xconf folder.

Finally, I have three files in mouse/share/doc called "help", "Overview", and "Mouse". Overview and help have the same content. You can save space by creating a symbolic link from the Overview file to "help" instead with:

ln -s Overview help

Here is the Overview file which shows how to use YaST modules in text mode:

General Help for YaST Modules

Various buttons or selection fields in the module contain a letter with a different color (yellow by default).
Use Alt-yellow_letter to select a button directly instead of navigating there with Tab.
Exit the YaST Control Center by pressing the 'Exit' button or by selecting 'Exit' in the category overview and pressing Enter.

Navigation in Modules

The following description of the control elements in the YaST modules assumes that all function keys and Alt key combinations work and are not assigned different global functions.

Navigation among Buttons and Selection Lists

Use Tab and Alt-Tab or Shift-Tab to navigate among the buttons and the frames containing selection lists.

Navigation in Selection Lists

Use the arrow keys (up arrow and down arrow) to navigate among the individual elements in an active frame containing a selection list.

If individual entries within a frame exceed its width, use Shift-left arrow or Shift-right arrow to scroll horizontally to the right and left. Alternatively, use Ctrl-E or Ctrl-A. This combination can also be used if using left arrow or right arrow would result in changing the active frame or the current selection list, as in the Control Center.

Buttons, Radio Buttons, and Check Boxes

To select buttons with empty square brackets (check boxes) or empty parentheses (radio buttons), press Space or Enter.

Alternatively, radio buttons and check boxes can be selected directly with Alt-yellow_letter. In this case, you do not need to confirm with Enter.

If you navigate to an item with Tab, press Enter to execute the selected action or activate the respective menu item.

Function Keys

The F keys (F1 to F12) enable quick access to the various buttons.

Which function keys are actually mapped to which buttons depends on the active YaST module, because the different modules offer different buttons (Details, Info, Add, Delete, etc.). Use F10 for 'OK', 'Next', and 'Finish'.

Press F1 to access the YaST help, which shows the functions mapped to the individual F keys.

Because this particular Overview file is going to be used several times, you could save it as "/usr/local/FIXIT/share/yastoverview" and make all the links for the YaST module help and Overview names point to this file. Thus:

ln -s /usr/local/FIXIT/share/yastoverview /usr/local/FIXIT/mouse/share/doc/help

ln -s /usr/local/FIXIT/share/yastoverview /usr/local/FIXIT/mouse/share/doc/Overview

Here is the "mouse/share/doc/Mouse" file:

To select the mouse type, use the up arrow and the down arrow. Consult your mouse documentation for information about the mouse type. After selecting a mouse type, use Alt-T to test whether the device works correctly without making the selection permanent. If the mouse does not behave as expected, use the keyboard to select another type and test again. Use Tab and Enter to make the current selection permanent.

I found all of this help in the administration manual which is in "/usr/share/doc/manuals", and selected those bits that were relevant, and saved them as a text file, without explanatory pictures.

Networking is the next module, which can have more than one problem. Problems could be the device configuration, or it could be a wrongly defined route, or it could be your firewall blocking needed traffic, or it could be your cabling. We shall have a look at developing the fixit module for this one in the next article.

By the time you have finished this series, you will know how to help all of your Linux friends as well as yourself. Spread the word; anyone can learn how to be a Linux expert at Novell Cool Solutions.


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell