summaryrefslogtreecommitdiffstats
path: root/move/make_live_tree_boot
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-05-25 08:39:32 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-05-25 08:39:32 +0000
commit6a4d28e4af2721d2bdef908fd90ce617bd1ebee7 (patch)
tree6aa3cfa8c5792c3057f5ddf7870fe78a9e5a8d67 /move/make_live_tree_boot
parent11e4520bf87137662d05badea0f997fe42c8d89a (diff)
downloaddrakx-6a4d28e4af2721d2bdef908fd90ce617bd1ebee7.tar
drakx-6a4d28e4af2721d2bdef908fd90ce617bd1ebee7.tar.gz
drakx-6a4d28e4af2721d2bdef908fd90ce617bd1ebee7.tar.bz2
drakx-6a4d28e4af2721d2bdef908fd90ce617bd1ebee7.tar.xz
drakx-6a4d28e4af2721d2bdef908fd90ce617bd1ebee7.zip
use newly introduced my_exit() in order to display better messages
Diffstat (limited to 'move/make_live_tree_boot')
0 files changed, 0 insertions, 0 deletions
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
package Xconfig; # $Id$

use diagnostics;
use strict;

use any;
use common;
use mouse;
use devices;
use keyboard;
use Xconfigurator;


sub keyboard_from_kmap {
    my ($loadkey) = @_;
    foreach (keyboard::keyboards()) {
	keyboard::keyboard2kmap($_) eq $loadkey and return keyboard::keyboard2xkb($_);
    }
    '';
}


sub getinfo {
    my $o = shift || {};
    getinfoFromDDC($o);
    getinfoFromSysconfig($o);

    my ($mouse) = mouse::detect();
    add2hash($o->{mouse}, $mouse) unless $o->{mouse}{XMOUSETYPE};
    add2hash($o->{mouse}{auxmouse}, $mouse->{auxmouse}) unless $o->{mouse}{auxmouse}{XMOUSETYPE};
    $o->{mouse}{auxmouse}{XMOUSETYPE} or delete $o->{mouse}{auxmouse};

    $o->{mouse}{device} ||= "mouse" if -e "/dev/mouse";
    $o;
}

sub getinfoFromXF86Config {
    my $o = shift || {}; #- original $::o->{X} which must be changed only if sure!
    my $prefix = shift || "";
    my (%keyboard, %mouse, %wacom, %card, %monitor);
    my (%c, $depth, $driver);

    local $_;
    local *G; open G, "$prefix/etc/X11/XF86Config-4";
    while (<G>) {
	if (my $i = /^Section "InputDevice"/ .. /^EndSection/) {
	    %c = () if $i == 1;

	    $c{driver} = $1 if /^\s*Driver\s+"(.*?)"/;
	    $c{id} = $1 if /^\s*Identifier\s+"[^\d"]*(\d*)"/;
	    $c{xkb_model} ||= $1 if /^\s*Option\s+"XkbModel"\s+"(.*?)"/;
	    $c{xkb_keymap} ||= $1 if /^\s*Option\s+"XkbLayout"\s+"(.*?)"/;
	    $c{XMOUSETYPE} ||= $1 if /^\s*Option\s+"Protocol"\s+"(.*?)"/;
	    $c{device} ||= $1 if /^\s*Option\s+"Device"\s+"\/dev\/(.*?)"/;
	    $c{chordmiddle} ||= $1 if /^\s*Option\s+"ChordMiddle"\s+"\/dev\/(.*?)"/;
	    $c{nbuttons}   = 2 if /^\s*Option\s+"Emulate3Buttons"\s+/;
	    $c{nbuttons} ||= 5 if /^\s*#\s*Option\s+"ZAxisMapping"\s.*5/;
	    $c{nbuttons}   = 7 if /^\s*#\s*Option\s+"ZAxisMapping"\s.*7/;

	    if ($i =~ /E0/) {
		@keyboard{qw(xkb_keymap)} = @c{qw(xkb_keymap)}
		  if $c{driver} =~ /keyboard/i;
		@{$mouse{auxmouse}}{qw(XMOUSETYPE device chordmiddle nbuttons)} = @c{qw(XMOUSETYPE device chordmiddle nbuttons)}
		  if $c{driver} =~ /mouse/i && $c{id} > 1;
		@mouse{qw(XMOUSETYPE device chordmiddle nbuttons)} = @c{qw(XMOUSETYPE device chordmiddle nbuttons)}
		  if $c{driver} =~ /mouse/i && $c{id} < 1;
		$wacom{$c{device}} = undef
		  if $c{driver} =~ /wacom/i;
	    }
	} elsif (/^Section "Monitor"/ .. /^EndSection/) {
	    $monitor{type} ||= $1 if /^\s*Identifier\s+"(.*?)"/;
	    $monitor{hsyncrange} ||= $1 if /^\s*HorizSync\s+(.*)/;
	    $monitor{vsyncrange} ||= $1 if /^\s*VertRefresh\s+(.*)/;
	    $monitor{vendor} ||= $1 if /^\s*VendorName\s+"(.*?)"/;
	    $monitor{model} ||= $1 if /^\s*ModelName\s+"(.*?)"/;
	    $monitor{modelines_}{"$1_$2"} = $_ if /^\s*Mode[lL]ine\s+(\S+)\s+(\S+)\s+/;
	} elsif (my $s = /^Section "Screen"/ .. /^EndSection/) {
	    $card{default_depth} ||= $1 if /^\s*DefaultColorDepth\s+(\d+)/;
	    if (my $i = /^\s*Subsection\s+"Display"/ .. /^\s*EndSubsection/) {