#!/bin/simple #usage: $me require "stdlib" # create functions to call external commands extern "ddcprobe" extern "lspci" !line_value: [line] # retrieve the value part of a "kearey: value"-line if line.contains[":"]: return line.behind[":"].trim[] return "unknown" !combine: [str_p name] # check whether there is ambiguous information about the graphcis adapter # ATTENTION: This wizard currently *cannot* configure PCs with multiple # graphics adapters! if str_p[] == "unknown": str_p name str_p[] != name: str_p "ambiguous" !retrieve_device: [device_p line] # look for common strings that identify the manufacturer of the # graphics adapter if line.contains["ati"]: combine device_p "fglrx" if line.contains["amd"]: combine device_p "fglrx" if line.contains["radeon"]: combine device_p "fglrx" if line.contains["nvidia"]: combine device_p "nvidia" if line.contains["geforce"]: combine device_p "nvidia" if line.contains["intel"]: combine device_p "intel" if line.contains["almador"]: combine device_p "intel" # use external commands and configuration files to gather informations $ddc ddcprobe[] $pci lspci[] $keymap load["/etc/keymap" 2] # declare and initialize hardware desciption variables $device "unknown" # name of the X-driver $monitor_name "unknown" $profile_monitor "" # for compatibility with original xorgwizard $profile_chip "" # for compatibility with original xorgwizard $graphics_adapter "unknown" $width 800 # default width $height 600 # default height $refresh_rate 50 # do not use 60 as a default - some TFT-displays return # default refresh rates less than 60 !update_resolution: [str] !w tonumber[str.before["x"]] !h tonumber[str.behind["x"].before["@"]] !r tonumber[str.behind["@"]] # we want at least 85Hz refresh rate - or the best available if w >= width and h >= height and (r >= refresh_rate or r >= 85): !width w !height h !refresh_rate r pci.for_each_line: [line] line.lower_case # look for graphics adapter manufacturer if line.contains["vga"]: retrieve_device !device line ddc.for_each_line: [line] $original_line line line.lower_case # look for graphics adapter manufacturer if line.contains_any["vendor:" "product:" "oem:"]: retrieve_device !device line # retrieve monitor name - this is for user information only if line.contains["monitorname:"]: combine !monitor_name line_value[original_line] # retrieve graphics adapter name - this is for user information only if line.contains["product"]: combine !graphics_adapter line_value[original_line] # retrieve screen resolution and refresh rate (supported by the monitor) # the highest resolution with an acceptable refresh rate is chosen if line.contains["timing:"]: update_resolution line_value[original_line] #detect graphics adapter and monitor id for Puppy's xorg.conf-tagging if line.contains["oem:"]: !profile_chip line_value[original_line] if line.contains_any["monitorid:" "eisa:"]: !profile_monitor line_value[original_line] if device == "ambiguous": !device "vesa" # stay on the safe side # we do not want spaces in the Puppy xorg.conf-tag profile_chip.replace_all " " "_" profile_monitor.replace_all " " "_" # map console keymap names to X11 keymap names !keymap select keymap "az" "fr" "cr" "cz" "dv" "dvorak" "sl" "si" "uk" "gb" "wa" "fr" keymap # default $fh file["/root/xorg.conf" "w+"] fh.write "ll # This file was generated by xwizard (C) 2007 Dipl.-Ing. Michael Niederle # PuppyHardwareProfile = &(profile_chip)&(profile_monitor) Section "ServerLayout" Identifier "simple configuration" Screen 0 "screen0" 0 0 InputDevice "mouse0" "CorePointer" InputDevice "keyboard0" "CoreKeyboard" EndSection Section "Files" RgbPath "/usr/X11R7/lib/X11/rgb" FontPath "/usr/X11R7/lib/X11/fonts/misc/" FontPath "/usr/X11R7/lib/X11/fonts/Type1/" FontPath "/usr/X11R7/lib/X11/fonts/TTF/" EndSection Section "Module" Load "dbe" # double buffer extension SubSection "extmod" Option "omit xfree86-dga" # don't initialise the DGA extension EndSubSection Load "type1" Load "freetype" EndSection Section "InputDevice" Identifier "keyboard0" Driver "kbd" Option "XkbRules" "xorg" Option "XkbModel" "pc102" Option "XkbLayout" "&(keymap)" EndSection Section "InputDevice" Identifier "mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/input/mice" EndSection Section "Monitor" Identifier "monitor0" ModelName "&(monitor_name)" Option "DPMS" EndSection Section "Device" Identifier "device0" #model "&(graphics_adapter)" Driver "&(device)" EndSection Section "Screen" Identifier "screen0" Device "device0" Monitor "monitor0" DefaultDepth 24 SubSection "Display" Viewport 0 0 Depth 24 Modes "&(width)x&(height)" EndSubSection EndSection fh.close