From 89a14b9204e0caad6d143949e0ea9c4cf2173df9 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 5 Aug 2005 04:23:39 +0000 Subject: move is_xbox from common to detect_devices --- perl-install/Xconfig/monitor.pm | 2 +- perl-install/Xconfig/resolution_and_depth.pm | 4 ++-- perl-install/Xconfig/xfree.pm | 3 ++- perl-install/any.pm | 4 ++-- perl-install/bootloader.pm | 2 +- perl-install/detect_devices.pm | 5 +++++ perl-install/diskdrake/interactive.pm | 2 +- perl-install/harddrake/sound.pm | 2 +- perl-install/install_any.pm | 2 +- perl-install/install_steps_gtk.pm | 3 ++- perl-install/keyboard.pm | 2 +- perl-install/mouse.pm | 4 ++-- perl-install/partition_table/raw.pm | 2 +- perl-install/pkgs.pm | 2 +- 14 files changed, 23 insertions(+), 16 deletions(-) (limited to 'perl-install') diff --git a/perl-install/Xconfig/monitor.pm b/perl-install/Xconfig/monitor.pm index 20eae5966..4c592e783 100644 --- a/perl-install/Xconfig/monitor.pm +++ b/perl-install/Xconfig/monitor.pm @@ -11,7 +11,7 @@ use log; sub good_default_monitor() { - is_xbox() ? 'Generic|640x480 @ 60 Hz' : + detect_devices::is_xbox() ? 'Generic|640x480 @ 60 Hz' : arch() =~ /ppc/ ? (detect_devices::get_mac_model() =~ /^iBook/ ? 'Apple|iBook 800x600' : 'Apple|iMac/PowerBook 1024x768') : (detect_devices::isLaptop() ? 'Generic|Flat Panel 1024x768' : 'Generic|1024x768 @ 70 Hz'); diff --git a/perl-install/Xconfig/resolution_and_depth.pm b/perl-install/Xconfig/resolution_and_depth.pm index b99e62bac..8ae9bab7f 100644 --- a/perl-install/Xconfig/resolution_and_depth.pm +++ b/perl-install/Xconfig/resolution_and_depth.pm @@ -42,10 +42,10 @@ sub bios_vga_modes() { @bios_vga_modes } sub size2default_resolution { my ($size) = @_; #- size in inch + require detect_devices; if (arch() =~ /ppc/) { - require detect_devices; return "1024x768" if detect_devices::get_mac_model() =~ /^PowerBook|^iMac/; - } elsif (is_xbox()) { + } elsif (detect_devices::is_xbox()) { return "640x480"; } diff --git a/perl-install/Xconfig/xfree.pm b/perl-install/Xconfig/xfree.pm index f9b6eaa54..e47748615 100644 --- a/perl-install/Xconfig/xfree.pm +++ b/perl-install/Xconfig/xfree.pm @@ -692,7 +692,8 @@ Section "ServerFlags" AllowMouseOpenFail # allows the server to start up even if the mouse does not work END -$default_header .= <<'END_XBOX' if is_xbox(); +require detect_devices; +$default_header .= <<'END_XBOX' if detect_devices::is_xbox(); Option "PciProbe1" "false" Option "PciProbe2" "false" Option "PciForceConfig1" "false" diff --git a/perl-install/any.pm b/perl-install/any.pm index 8823bbca3..87454ef10 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -132,7 +132,7 @@ sub setupBootloader { sub installBootloader { my ($in, $b, $all_hds) = @_; - return if is_xbox(); + return if detect_devices::is_xbox(); install_acpi_pkgs($in->do_pkgs, $b); eval { run_program::rooted($::prefix, 'echo | lilo -u') } if $::isInstall && !$::o->{isUpgrade} && -e "$::prefix/etc/lilo.conf" && glob("$::prefix/boot/boot.*"); @@ -254,7 +254,7 @@ sub setupBootloader__mbr_or_not { sub setupBootloader__general { my ($in, $b, $all_hds, $fstab, $security) = @_; - return if is_xbox(); + return if detect_devices::is_xbox(); my @method_choices = bootloader::method_choices($all_hds); my $prev_force_acpi = my $force_acpi = bootloader::get_append_with_key($b, 'acpi') !~ /off|ht/; my $prev_force_noapic = my $force_noapic = bootloader::get_append_simple($b, 'noapic'); diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index f308b4296..4e5ab621f 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -860,7 +860,7 @@ sub method2text { sub method_choices_raw { my ($b_prefix_mounted) = @_; - is_xbox() ? 'cromwell' : + detect_devices::is_xbox() ? 'cromwell' : arch() =~ /ppc/ ? 'yaboot' : arch() =~ /ia64/ ? 'lilo' : ( diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 7b03bd391..7855019f1 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -905,6 +905,11 @@ sub is_i586() { $cpuinfo =~ /^cpu family\s*:\s*(\d+)/m && $1 < 6 || !has_cpu_flag('cmov'); } + +sub is_xbox() { + any { $_->{vendor} == 0x10de && $_->{id} == 0x02a5 } detect_devices::pci_probe(); +} + sub has_cpu_flag { my ($flag) = @_; cat_('/proc/cpuinfo') =~ /^flags.*\b$flag\b/m; diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm index 917d6f75f..49ed8085c 100644 --- a/perl-install/diskdrake/interactive.pm +++ b/perl-install/diskdrake/interactive.pm @@ -319,7 +319,7 @@ sub hd_possible_actions_interactive { sub Clear_all { my ($in, $hd, $all_hds) = @_; - return if is_xbox(); #- do not let them wipe the OS + return if detect_devices::is_xbox(); #- do not let them wipe the OS my @parts = partition_table::get_normal_parts($hd); foreach (@parts) { RemoveFromLVM($in, $hd, $_, $all_hds) if isPartOfLVM($_); diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 9f4c7770f..4bbe45e93 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -359,7 +359,7 @@ sub configure_sound_slots { if (!member($default_driver, @{get_alternative($_->{driver})}, $_->{driver})) { $altered ||= $default_driver; $modules_conf->set_sound_slot("sound-slot-$::i", $_->{driver}); - $modules_conf->set_options($_->{driver}, "xbox=1") if $_->{driver} eq "snd-intel8x0" && is_xbox(); + $modules_conf->set_options($_->{driver}, "xbox=1") if $_->{driver} eq "snd-intel8x0" && detect_devices::is_xbox(); } } detect_devices::getSoundDevices(); $modules_conf->write if $altered && $::isStandalone; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index c1984523b..63f0290d9 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -989,7 +989,7 @@ sub ejectCdrom { #- D state if the cdrom is already removed $o_mountpoint and eval { fs::mount::umount($o_mountpoint) }; $@ and warnAboutFilesStillOpen(); - return if is_xbox(); + return if detect_devices::is_xbox(); openCdromTray($cdrom); } diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index fb325a578..470f145b7 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -132,7 +132,8 @@ sub new($$) { } OK: $ENV{DISPLAY} = $wanted_DISPLAY; - if (is_xbox()) { + require detect_devices; + if (detect_devices::is_xbox()) { modules::load('xpad'); run_program::run('xset', 'm', '1/8', '1'); } diff --git a/perl-install/keyboard.pm b/perl-install/keyboard.pm index 81b3b371f..bc35c1b2a 100644 --- a/perl-install/keyboard.pm +++ b/perl-install/keyboard.pm @@ -360,7 +360,7 @@ sub KEYBOARD2text { $keyboards{$_[0]} && $keyboards{$_[0]}[0] } sub keyboards() { map { { KEYBOARD => $_ } } keys %keyboards } sub keyboard2one { my ($keyboard, $nb) = @_; - ref $keyboard or (is_xbox() ? return undef : internal_error()); + ref $keyboard or (detect_devices::is_xbox() ? return undef : internal_error()); my $l = $keyboards{$keyboard->{KEYBOARD}} or return; $l->[$nb]; } diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index f11fcc3d5..e991514cc 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -86,7 +86,7 @@ my %mice = N_("Universal") => [ [ 'input/mice' ], [ [ 7, 'ps/2', 'ExplorerPS/2', N_("Any PS/2 & USB mice") ], - if_(is_xbox(), [ 5, 'ps/2', 'IMPS/2', N_("Microsoft Xbox Controller S") ]), + if_(detect_devices::is_xbox(), [ 5, 'ps/2', 'IMPS/2', N_("Microsoft Xbox Controller S") ]), ] ], ), @@ -295,7 +295,7 @@ sub detect { if (c::kernel_version() =~ /^\Q2.6/) { $modules_conf->get_probeall("usb-interface") and eval { modules::load('usbhid') }; if (cat_('/proc/bus/input/devices') =~ /^H: Handlers=mouse/m) { - if (is_xbox()) { + if (detect_devices::is_xbox()) { return fullname2mouse('Universal|Microsoft Xbox Controller S'); } my $univ_mouse = fullname2mouse('Universal|Any PS/2 & USB mice', wacom => \@wacom); diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm index 0887915c7..52f8e3cab 100644 --- a/perl-install/partition_table/raw.pm +++ b/perl-install/partition_table/raw.pm @@ -208,7 +208,7 @@ sub zero_MBR { bless $hd, default_type(); $hd->{primary} = $hd->clear_raw; delete $hd->{extended}; - if (is_xbox()) { + if (detect_devices::is_xbox()) { my $part = { start => 1, size => 15632048, pt_type => 0x0bf, isFormatted => 1 }; partition_table::dos::compute_CHS($hd, $part); $hd->{primary}{raw}[0] = $part; diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 920ab3125..a7de73565 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -193,7 +193,7 @@ sub bestKernelPackage { } my @preferred_exts = $::build_globetrotter ? '' : - is_xbox() ? '-xbox' : + detect_devices::is_xbox() ? '-xbox' : detect_devices::is_i586() ? '-i586-up-1GB' : !detect_devices::has_cpu_flag('pae') ? ('-i686-up-4GB', '-i586-up-1GB') : detect_devices::hasSMP() ? '-smp' : -- cgit v1.2.1