summaryrefslogtreecommitdiffstats
path: root/perl-install/harddrake
diff options
context:
space:
mode:
authorDexter Morgan <dmorgan@mageia.org>2011-06-02 20:51:35 +0000
committerDexter Morgan <dmorgan@mageia.org>2011-06-02 20:51:35 +0000
commita9b2bdafaf625d10aef2f476aa4014fd36c846bc (patch)
tree2364afc0ee6739b59a25c44d68c9f003bcaf03d9 /perl-install/harddrake
downloaddrakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar
drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.gz
drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.bz2
drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.xz
drakx-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.zip
Branch for updates
Diffstat (limited to 'perl-install/harddrake')
-rw-r--r--perl-install/harddrake/autoconf.pm119
-rwxr-xr-xperl-install/harddrake/check_snd.pl20
-rw-r--r--perl-install/harddrake/data.pm578
-rw-r--r--perl-install/harddrake/sound.pm500
-rw-r--r--perl-install/harddrake/v4l.pm496
5 files changed, 1713 insertions, 0 deletions
diff --git a/perl-install/harddrake/autoconf.pm b/perl-install/harddrake/autoconf.pm
new file mode 100644
index 000000000..ce22cd5ee
--- /dev/null
+++ b/perl-install/harddrake/autoconf.pm
@@ -0,0 +1,119 @@
+package harddrake::autoconf;
+
+use common;
+
+sub xconf {
+ my ($modules_conf, $o, $o_skip_fb_setup, $o_resolution_wanted) = @_;
+
+ log::l('automatic XFree configuration');
+
+ require Xconfig::default;
+ require do_pkgs;
+ my $do_pkgs = do_pkgs_standalone->new;
+ $o->{raw_X} = Xconfig::default::configure($do_pkgs);
+
+ my $old_x = { if_($o_resolution_wanted, resolution_wanted => $o_resolution_wanted) };
+
+ require Xconfig::main;
+ Xconfig::main::configure_everything_auto_install($o->{raw_X}, $do_pkgs, $old_x, { allowFB => listlength(cat_("/proc/fb")), skip_fb_setup => $o_skip_fb_setup });
+
+ #- always disable compositing desktop effects when configuring a new video card
+ require Xconfig::glx;
+ Xconfig::glx::write({});
+
+ modules::load_category($modules_conf, 'various/agpgart');
+}
+
+sub network_conf {
+ my ($obj) = @_;
+ require network::network;
+ network::network::easy_dhcp($obj->{net}, $obj->{modules_conf});
+}
+
+sub mouse_conf {
+ my ($modules_conf) = @_;
+ require do_pkgs;
+ require mouse;
+ mouse::write_conf(do_pkgs_standalone->new, $modules_conf, my $mouse = mouse::detect($modules_conf), 1);
+ mouse::load_modules($mouse);
+}
+
+sub pcmcia {
+ my ($pcic) = @_;
+ require modules;
+ modules::set_preload_modules("pcmcia", if_($pcic, $pcic));
+}
+
+sub bluetooth {
+ my ($enable) = @_;
+#- FIXME: make sure these packages are installed when needed
+# if ($enable) {
+# require do_pkgs;
+# my $do_pkgs = do_pkgs_standalone->new;
+# $do_pkgs->ensure_is_installed("bluez-utils", "/usr/bin/rfcomm");
+# }
+ require services;
+ services::set_status("bluetooth", $enable);
+ my $kbluetoothd_cfg = '/etc/kde/kbluetoothrc';
+ update_gnomekderc($kbluetoothd_cfg,
+ 'General',
+ 'AutoStart' => bool2text($enable)) if -f $kbluetoothd_cfg;
+}
+
+sub laptop {
+ my ($on_laptop) = @_;
+#- FIXME: make sure these packages are installed when needed
+# require do_pkgs;
+# my $do_pkgs = do_pkgs_standalone->new;
+# if ($on_laptop) {
+# $do_pkgs->ensure_is_installed("cpufreq", "/etc/rc.d/init.d/cpufreq");
+# $do_pkgs->ensure_is_installed("apmd", "/usr/bin/apm");
+# $do_pkgs->ensure_is_installed("hotkeys", "/usr/bin/hotkeys");
+# $do_pkgs->ensure_is_installed("laptop-mode-tools", "/usr/sbin/laptop_mode");
+# } else {
+# $do_pkgs->ensure_is_installed("numlock", "/etc/rc.d/init.d/numlock");
+# }
+ require services;
+ services::set_status("apmd", -e "/proc/apm");
+ services::set_status("cpufreq", $on_laptop);
+ services::set_status("apmd", $on_laptop);
+ services::set_status("laptop-mode", $on_laptop);
+ services::set_status("numlock", !$on_laptop);
+}
+
+sub cpufreq() {
+ require cpufreq;
+ modules::set_preload_modules("cpufreq", cpufreq::get_modules());
+}
+
+sub floppy() {
+ require detect_devices;
+ modules::set_preload_modules("floppy", if_(detect_devices::floppy(), "floppy"));
+}
+
+sub fix_aliases {
+ my ($modules_conf) = @_;
+ require modalias;
+ my %new_aliases;
+ #- first pass: find module targets whose modalias is not valid anymore
+ foreach my $module ($modules_conf->modules) {
+ if (my $aliased_to = $modules_conf->get_alias($module)) {
+ my @valid_modaliases = modalias::get_modules($module, 'skip_config') or next;
+ my ($found, $others) = partition { $_ eq $aliased_to } @valid_modaliases;
+ $new_aliases{$aliased_to} = @{$others || []} == 1 && $others->[0] if is_empty_array_ref($found);
+ }
+ }
+ #- second pass: adapt module targets that are not valid anymore
+ foreach my $module ($modules_conf->modules) {
+ if (my $aliased_to = $modules_conf->get_alias($module)) {
+ if (my $new = exists $new_aliases{$aliased_to} && $new_aliases{$aliased_to}) {
+ $modules_conf->set_alias($module, $new);
+ } else {
+ $modules_conf->remove_alias($module);
+ }
+ }
+ }
+ $modules_conf->write;
+}
+
+1;
diff --git a/perl-install/harddrake/check_snd.pl b/perl-install/harddrake/check_snd.pl
new file mode 100755
index 000000000..dfa007b80
--- /dev/null
+++ b/perl-install/harddrake/check_snd.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/perl
+
+use strict;
+use lib qw(/usr/lib/libDrakX);
+
+use common;
+use harddrake::sound;
+use list_modules;
+
+
+my @listed_modules = @{$list_modules::l{multimedia}{sound}};
+my @drivers = (keys %harddrake::sound::oss2alsa, keys %harddrake::sound::alsa2oss);
+my @alternatives = uniq map { @{$_} } values %harddrake::sound::oss2alsa, values %harddrake::sound::alsa2oss;
+
+# check harddrake::sound's data structures're coherent
+print "unknown alternative drivers : [", join(', ', difference2(\@alternatives, \@drivers)), "]\n";
+
+# check that list_modules and harddrake::sound are synced
+print "non real sound modules (submodules, tv, usb, ...) : [", join(', ', difference2(\@drivers, \@listed_modules)), "]\n";
+print "forgotten sound modules : [", join(', ', difference2(\@listed_modules, \@drivers)), "]\n";
diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm
new file mode 100644
index 000000000..9cfebe7fb
--- /dev/null
+++ b/perl-install/harddrake/data.pm
@@ -0,0 +1,578 @@
+package harddrake::data;
+
+use strict;
+use detect_devices;
+use common;
+use modules;
+
+our @ISA = qw(Exporter);
+our @EXPORT_OK = qw(version tree);
+our ($version, $sbindir, $bindir) = ("10", "/usr/sbin", "/usr/bin");
+
+my @devices = (detect_devices::probeall(), detect_devices::getSCSI());
+
+foreach my $dev (@devices) {
+ # normalize device IDs for devices cthat came from mouse.pm:
+ next if !defined $dev->{Synaptics};
+ foreach my $field (qw(vendor id subvendor subid)) {
+ next if !defined $dev->{$field};
+ $dev->{$field} = hex($dev->{$field});
+ }
+}
+
+# Update me each time you handle one more devices class (aka configurator)
+sub unknown() {
+ grep { $_->{media_type} !~ /BRIDGE|class\|Mouse|DISPLAY|Hub|MEMORY_RAM|MULTIMEDIA_(VIDEO|AUDIO|OTHER)|NETWORK|Printer|SERIAL_(USB|SMBUS)|STORAGE_(IDE|OTHER|RAID|SCSI)|SYSTEM_(OTHER|SDHCI)|tape|UPS/
+ && !member($_->{driver}, qw(cpia_usb cyber2000fb forcedeth ibmcam megaraid mod_quickcam nvnet ohci1394 ov511 ov518_decomp scanner ultracam usbvideo usbvision))
+ && $_->{driver} !~ /^ISDN|Mouse:USB|Removable:zip|class\|Mouse|sata|www.linmodems.org/
+ && $_->{type} ne 'network'
+ && $_->{description} !~ /Alcatel|ADSL Modem/;
+ } @devices;
+}
+
+my @alrd_dected;
+sub f {
+ my @devs = grep { !member(pciusb_id($_), @alrd_dected) } grep { $_ } @_;
+ push @alrd_dected, map { pciusb_id($_) } @devs;
+ @devs;
+}
+
+
+# tree format ("CLASS_ID", "type", "type_icon", configurator, detect_sub)
+# NEVER, NEVER alter CLASS_ID or you'll see harddrake2 service detect changes
+# in hw configuration ... :-(
+
+# FIXME: add translated items
+
+sub is_removable { member($_[0], qw(FLOPPY ZIP DVDROM CDROM BURNER)) }
+sub is_auto_configurable_media { !detect_devices::isKeyUsb($_[0]) }
+
+sub set_removable_configurator {
+ my ($class, $device) = @_;
+ is_removable($class) ? "/usr/sbin/diskdrake --removable=$device->{device}" : undef;
+ }
+
+my $modules_conf = modules::any_conf->read;
+
+# Format is (HW class ID, l18n class name, icon, config tool , is_to_be_detected_on_boot)
+our @tree =
+ (
+ {
+ class => "SATA_STORAGE",
+ string => N("SATA controllers"),
+ icon => "ide_hd.png",
+ configurator => "",
+ detector => sub { f(grep { $_->{driver} !~ /^pata/ } detect_devices::probe_category('disk/sata')) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "RAID_STORAGE",
+ string => N("RAID controllers"),
+ icon => "ide_hd.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('disk/hardware_raid')),
+ f(grep { $_->{media_type} =~ /STORAGE_RAID/ } @devices) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "ATA_STORAGE",
+ string => N("(E)IDE/ATA controllers"),
+ icon => "ide_hd.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('disk/ide')),
+ f(grep { $_->{driver} =~ /^pata/ && $_->{media_type} =~ /IDE|STORAGE_SATA/ } @devices),
+ f(grep { $_->{media_type} =~ /STORAGE_(IDE|OTHER)/ } @devices) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "CARD_READER",
+ string => N("Card readers"),
+ icon => "ide_hd.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('disk/card_reader')) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "FIREWIRE_CONTROLLER",
+ string => N("Firewire controllers"),
+ icon => "usb.png",
+ configurator => "",
+ detector => sub { f(grep { $_->{driver} =~ /firewire_ohci|ohci1394/ } @devices) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "PCMCIA_CONTROLLER",
+ string => N("PCMCIA controllers"),
+ icon => "hw-pcmcia.png",
+ configurator => "",
+ detector => sub { f(detect_devices::pcmcia_controller_probe()) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "SCSI_CONTROLLER",
+ string => N("SCSI controllers"),
+ icon => "scsi.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('disk/scsi'), grep { $_->{media_type} =~ /STORAGE_SCSI/ } @devices) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "USB_CONTROLLER",
+ string => N("USB controllers"),
+ icon => "usb.png",
+ configurator => "",
+ detector => sub { f(grep { $_->{media_type} eq 'SERIAL_USB' } @devices) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "USB_HUB",
+ string => N("USB ports"),
+ icon => "hw-usb.png",
+ configurator => "",
+ detector => sub { f(grep { $_->{media_type} =~ /Hub/ } @devices) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "SMB_CONTROLLER",
+ string => N("SMBus controllers"),
+ icon => "hw-smbus.png",
+ configurator => "",
+ detector => sub { f(grep { $_->{media_type} =~ /SERIAL_SMBUS/ } @devices) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "BRIDGE",
+ string => N("Bridges and system controllers"),
+ icon => "memory.png",
+ configurator => "",
+ detector => sub { f(grep { $_->{media_type} =~ /BRIDGE|MEMORY_RAM|SYSTEM_(OTHER|SDHCI)|MEMORY_OTHER|SYSTEM_PIC|COMMUNICATION_OTHER/
+ || $_->{description} =~ /Parallel Port Adapter/;
+ } @devices) },
+ checked_on_boot => 0,
+ },
+
+
+ {
+ class => "FLOPPY",
+ string => N("Floppy"),
+ icon => "floppy.png",
+ configurator => "",
+ detector => \&detect_devices::floppies,
+ checked_on_boot => 1,
+ automatic => 1,
+ },
+
+ {
+ class => "ZIP",
+ string => N("Zip"),
+ icon => "floppy.png",
+ configurator => "",
+ detector => sub {
+ my ($options) = @_;
+ if ($options->{PARALLEL_ZIP_DETECTION}) {
+ modules::load_parallel_zip($modules_conf) and $modules_conf->write;
+ }
+ detect_devices::zips();
+ },
+ checked_on_boot => 1,
+ automatic => 1,
+ },
+
+ {
+ class => "HARDDISK",
+ string => N("Hard Disk"),
+ icon => "harddisk.png",
+ configurator => "$sbindir/diskdrake",
+ detector => sub { f(detect_devices::hds()) },
+ checked_on_boot => 0,
+ automatic => 1,
+ },
+
+ {
+ class => "USB_STORAGE",
+ string => N("USB Mass Storage Devices"),
+ icon => "usb.png",
+ configurator => "",
+ detector => sub { f(grep { member($_->{driver}, qw(usb_storage ub Removable:memory_card)) } @devices) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "CDROM",
+ string => N("CDROM"),
+ icon => "cd.png",
+ configurator => "",
+ detector => sub { f(grep { !(detect_devices::isBurner($_) || detect_devices::isDvdDrive($_)) } &detect_devices::cdroms) },
+ checked_on_boot => 1,
+ automatic => 1,
+ },
+
+ {
+ class => "BURNER",
+ string => N("CD/DVD burners"),
+ icon => "cd.png",
+ configurator => "",
+ detector => sub { f(detect_devices::burners()) },
+ checked_on_boot => 1,
+ automatic => 1,
+ },
+
+ {
+ class => "DVDROM",
+ string => N("DVD-ROM"),
+ icon => "cd.png",
+ configurator => "",
+ detector => sub { f(grep { ! detect_devices::isBurner($_) } detect_devices::dvdroms()) },
+ checked_on_boot => 1,
+ automatic => 1,
+ },
+
+ {
+ class => "TAPE",
+ string => N("Tape"),
+ icon => "tape.png",
+ configurator => "",
+ detector => \&detect_devices::tapes,
+ checked_on_boot => 0,
+ },
+
+ # AGP devices must be detected prior to video cards because some DRM drivers doesn't like be loaded
+ # after agpgart thus order in /etc/modprobe.preload is important (modules.pm should enforce such sorting):
+ {
+ class => "AGP",
+ string => N("AGP controllers"),
+ icon => "memory.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('various/agpgart')) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "VIDEO",
+ string => N("Videocard"),
+ icon => "video.png",
+ configurator => "$sbindir/XFdrake",
+ detector => sub { f(grep { $_->{driver} =~ /^(Card|Server):/ || $_->{media_type} =~ /DISPLAY_VGA/ } @devices) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "DVB",
+ string => N("DVB card"),
+ icon => "tv.png",
+ detector => sub { f(detect_devices::probe_category('multimedia/dvb')) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "TV",
+ string => N("Tvcard"),
+ icon => "tv.png",
+ configurator => "/usr/sbin/drakxtv",
+ detector => sub { f(detect_devices::probe_category('multimedia/tv')),
+ f(grep { $_->{media_type} =~ /MULTIMEDIA_VIDEO/ && $_->{bus} eq 'PCI' } @devices) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "MULTIMEDIA_OTHER",
+ string => N("Other MultiMedia devices"),
+ icon => "multimedia.png",
+ configurator => "",
+ detector => sub { f(grep { $_->{media_type} =~ /MULTIMEDIA_OTHER/ } @devices) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "AUDIO",
+ string => N("Soundcard"),
+ icon => "sound.png",
+ configurator => "$sbindir/draksound",
+ detector => sub {
+ require list_modules;
+ my @modules = list_modules::category2modules('multimedia/sound');
+ f(grep { $_->{media_type} =~ /MULTIMEDIA_AUDIO|PROCESSOR_CO/ || member($_->{driver}, @modules)
+ || $_->{description} =~ /PC Speaker/ } @devices);
+ },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "WEBCAM",
+ string => N("Webcam"),
+ icon => "webcam.png",
+ configurator => "",
+ detector => sub {
+ require list_modules;
+ my @modules = (list_modules::category2modules('multimedia/webcam'), 'Removable:camera');
+ f(grep { $_->{media_type} =~ /MULTIMEDIA_VIDEO|Video\|Video Control|Imaging|Camera/ && $_->{bus} ne 'PCI'
+ || member($_->{driver}, @modules) || $_->{driver} =~ /^gpsca/ } @devices);
+ },
+ # managed by hotplug:
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "CPU",
+ string => N("Processors"),
+ icon => "cpu.png",
+ configurator => "",
+ detector => sub { detect_devices::getCPUs() },
+ # maybe should we install schedutils?
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "ISDN",
+ string => N("ISDN adapters"),
+ icon => "modem.png",
+ configurator => "$sbindir/drakconnect",
+ detector => sub { require network::connection::isdn; my $isdn = network::connection::isdn::detect_backend($modules_conf); if_(@$isdn, f(@$isdn)) },
+ # we do not check these b/c this need user interaction (auth, ...):
+ checked_on_boot => 0,
+ },
+
+
+ {
+ class => "USB_AUDIO",
+ string => N("USB sound devices"),
+ icon => "sound.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('multimedia/usb_sound')) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "RADIO",
+ string => N("Radio cards"),
+ icon => "tv.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('multimedia/radio')) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "ATM",
+ string => N("ATM network cards"),
+ icon => "hw_network.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('network/atm')) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "WAN",
+ string => N("WAN network cards"),
+ icon => "hw_network.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('network/wan')) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "BLUETOOTH",
+ string => N("Bluetooth devices"),
+ icon => "hw_network.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('bus/bluetooth')) },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "ETHERNET",
+ string => N("Ethernetcard"),
+ icon => "hw_network.png",
+ configurator => "$sbindir/drakconnect",
+ detector => sub {
+ require list_modules;
+ my @net_modules = list_modules::category2modules(list_modules::ethernet_categories());
+ f(grep {
+ $_->{media_type} && $_->{media_type} =~ /^NETWORK/
+ || $_->{type} && $_->{type} eq 'network'
+ || member($_->{driver}, @net_modules);
+ } @devices);
+ },
+ checked_on_boot => 1,
+ },
+
+ {
+ class => "MODEM",
+ string => N("Modem"),
+ icon => "modem.png",
+ configurator => "$sbindir/drakconnect",
+ detector => sub { f(detect_devices::getModem($modules_conf)) },
+ # we do not check these b/c this need user interaction (auth, ...):
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "ADSL",
+ string => N("ADSL adapters"),
+ icon => "modem.png",
+ configurator => "$sbindir/drakconnect",
+ detector => sub { f(detect_devices::get_xdsl_usb_devices()),
+ f(grep { $_->{description} =~ /Cohiba 3887 rev0/ } @devices);
+ },
+ # we do not check these b/c this need user interaction (auth, ...):
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "MEMORY",
+ string => N("Memory"),
+ icon => "hw-memory.png",
+ configurator => "",
+ detector => sub { grep { member($_->{name}, 'Cache', 'Memory Module') } detect_devices::dmidecode() },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "PRINTER",
+ string => N("Printer"),
+ icon => "hw_printer.png",
+ configurator => "$sbindir/printerdrake",
+ detector => sub {},
+ # we do not check these b/c this need user interaction (auth, ...):
+ checked_on_boot => 0,
+ },
+
+
+
+ {
+ class => "GAMEPORT",
+ string =>
+ #-PO: these are joysticks controllers:
+ N("Game port controllers"),
+ icon => "joystick.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('multimedia/gameport')) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "JOYSTICK",
+ string => N("Joystick"),
+ icon => "joystick.png",
+ configurator => "",
+ detector => sub { f(detect_devices::probe_category('input/joystick')), f(grep { $_->{description} =~ /Joystick/i } @devices) },
+ checked_on_boot => 0,
+ },
+
+
+ {
+ class => "KEYBOARD",
+ string => N("Keyboard"),
+ icon => "hw-keyboard.png",
+ configurator => "$sbindir/keyboarddrake",
+ detector => sub {
+ f(grep { $_->{description} =~ /Keyboard/i || $_->{media_type} =~ /Subclass\|Keyboard/i ||
+ # USB devices are filtered out since we already catch them through probeall():
+ $_->{bus} ne 'usb' && $_->{driver} =~ /^event|kbd/ && $_->{description} !~ /PC Speaker/;
+ } @devices);
+ },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "MISC_INPUT",
+ string => N("Tablet and touchscreen"),
+ icon => "hw_mouse.png",
+ detector => sub { f(detect_devices::probe_category('input/tablet'), detect_devices::probe_category('input/touchscreen')) },
+ configurator => "$sbindir/mousedrake",
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "MOUSE",
+ string => N("Mouse"),
+ icon => "hw_mouse.png",
+ configurator => "$sbindir/mousedrake",
+ detector => sub {
+ f(grep { $_->{driver} =~ /^Mouse:|^Tablet:|^mouse/ || $_->{media_type} =~ /class\|Mouse/ ||
+ # USB devices are filtered out since we already catch them through probeall():
+ $_->{bus} ne 'usb' && $_->{Handlers}{mouse};
+ } @devices);
+ },
+ checked_on_boot => 1,
+ automatic => 1,
+ },
+
+ {
+ class => "BIOMETRIC",
+ string => N("Biometry"),
+ icon => "ups.png",
+ detector => sub { f(grep { $_->{description} =~ /fingerprint|biometric/i } @devices) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "UPS",
+ string => N("UPS"),
+ icon => "ups.png",
+ configurator => "$sbindir/drakups",
+ detector => sub { f(detect_devices::getUPS()) },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "SCANNER",
+ string => N("Scanner"),
+ icon => "scanner.png",
+ configurator => "$sbindir/scannerdrake",
+ detector => sub {
+ require scanner; f(map { $_->{val}{drakx_device} } f(scanner::detect()));
+ },
+ checked_on_boot => 0,
+ },
+
+ {
+ class => "UNKNOWN",
+ string => N("Unknown/Others"),
+ icon => "unknown.png",
+ configurator => "",
+ detector => sub { f(unknown()) },
+ checked_on_boot => 0,
+ },
+
+ );
+
+sub pciusb_id {
+ my ($dev) = @_;
+ my %alt = (
+ bus => 'usb_bus',
+ description => 'usb_description',
+ id => 'usb_id',
+ pci_bus => 'usb_pci_bus',
+ pci_device => 'usb_pci_device',
+ vendor => 'usb_vendor',
+ );
+ my @fields = ('bus', if_($dev->{bus} =~ /pci/, qw(pci_bus pci_device)), qw(vendor id subvendor subid),
+ if_($dev->{bus} !~ /usb/i, 'description'));
+ join(':', map { uc($dev->{$alt{$_}} || $dev->{$_}) } @fields);
+}
+
+
+sub custom_id {
+ my ($device, $str) = @_;
+ return if !ref($device);
+ defined($device->{device}) ? $device->{device} :
+ (defined($device->{processor}) ?
+ N("cpu # ") . $device->{processor} . ": " . $device->{'model name'} :
+ $device->{"Socket Designation"} ?
+ "$device->{name} (" . $device->{"Socket Designation"} . ")" :
+ $device->{name} ? $device->{name} :
+ (($device->{description}) ? $device->{description} :
+ (($device->{Vendor}) ? $device->{Vendor} : $str)));
+}
+
+1;
diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm
new file mode 100644
index 000000000..5bf5c55ab
--- /dev/null
+++ b/perl-install/harddrake/sound.pm
@@ -0,0 +1,500 @@
+package harddrake::sound;
+# lists filled with Danny Tholen help, enhanced by Thierry Vignaud
+#
+# No ALSA for OSS's
+# o isa cards: msnd_pinnacle, pas2,
+# o pci cards: ad1889, sam9407
+# No OSS for ALSA's
+# o pci cards: snd_als4000, snd_es968, snd_hdsp
+# o isa cards: snd_azt2320, snd_cs4231, snd_cs4236,
+# snd_dt0197h, snd_korg1212, snd_rme32
+# o pcmcia cards: snd_vxp440 snd_vxpocket
+
+# TODO:
+# o ensure sound is not user (either dsp/midi/sequencer/mixer)
+# o fix sound/alsa services
+
+use strict;
+use common;
+use run_program;
+use modules;
+use list_modules;
+use detect_devices;
+use log;
+
+
+our %alsa2oss =
+ (
+ if_(arch() =~ /ppc/, "snd_powermac" => [ "dmasound_pmac" ]),
+ if_(arch() =~ /sparc/,
+ "snd_sun_amd7930" => [ "unknown" ],
+ "snd_sun_cs4231" => [ "unknown" ],
+ "snd_sun_dbri" => [ "unknown" ],
+ ),
+ "snd_ad1816a" => [ "ad1816" ], # isa
+ "snd_ad1848" => [ "ad1848", "pss" ], # isa
+ "snd_ad1889" => [ "ad1889" ],
+ "snd_ali5451" => [ "trident" ],
+ "snd_als100" => [ "sb" ], # isa
+ "snd_als300" => [ "unknown" ],
+ "snd_als4000" => [ "unknown" ],
+ "snd_aoa" => [ "unknown" ],
+ "snd_asihpi" => [ "unknown" ],
+ "snd_atiixp" => [ "unknown" ],
+ "snd_au8810" => [ "unknown" ],
+ "snd_au8820" => [ "unknown" ],
+ "snd_au8830" => [ "unknown" ],
+ "snd_audigyls" => [ "unknown" ], # pci, renamed as snd_ca0106
+ "snd_azt2320" => [ "unknown" ], # isa
+ "snd_azt3328" => [ "unknown" ], # isa
+ "snd_azx" => [ "unknown" ],
+ "snd_bt87x" => [ "btaudio" ],
+ "snd_ca0106" => [ "unknown" ], # pci
+ "snd_cmi8330" => [ "sb" ], # isa
+ "snd_cmi8788" => [ "unknown" ], # pci
+ "snd_cmipci" => [ "cmpci" ],
+ "snd_cs4231" => [ "unknown" ], # isa
+ "snd_cs4232" => [ "cs4232" ], # isa
+ "snd_cs4236" => [ "ad1848" ], # isa
+ "snd_cs4281" => [ "cs4281" ],
+ "snd_cs46xx" => [ "cs46xx" ],
+ "snd_cs5530" => [ "unknown" ],
+ "snd_cs5535audio" => [ "unknown" ],
+ "snd_darla20" => [ "unknown" ],
+ "snd_darla24" => [ "unknown" ],
+ "snd_dt0197h" => [ "unknown" ], # isa
+ "snd_dt019x" => [ "unknown" ], # isa
+ "snd_echo3g" => [ "unknown" ],
+ "snd_emu10k1" => [ "audigy", "emu10k1" ],
+ "snd_emu10k1x" => [ "unknown" ],
+ "snd_ens1370" => [ "es1370" ],
+ "snd_ens1371" => [ "es1371" ],
+ "snd_es1688" => [ "sb" ], # isa
+ "snd_es18xx" => [ "sb" ], # isa
+ "snd_es1938" => [ "esssolo1" ],
+ "snd_es1968" => [ "maestro" ], # isa
+ "snd_es968" => [ "sb" ],
+ "snd_fm801" => [ "forte" ],
+ "snd_gina20" => [ "unknown" ],
+ "snd_gina24" => [ "unknown" ],
+ "snd_gina3g" => [ "unknown" ],
+ "snd_gusclassic" => [ "gus" ], # isa
+ "snd_gusextreme" => [ "gus" ], # isa
+ "snd_gusmax" => [ "gus" ], # isa
+ "snd_hda_intel" => [ "unknown" ],
+ "snd_hdspm" => [ "unknown" ],
+ "snd_hdsp" => [ "unknown" ],
+ "snd_ice1712" => [ "unknown" ], # isa
+ "snd_ice1724" => [ "unknown" ], # isa
+ "snd_indi" => [ "unknown" ], # pci
+ "snd_indigo" => [ "unknown" ], # pci
+ "snd_indigodj" => [ "unknown" ], # pci
+ "snd_indigoio" => [ "unknown" ], # pci
+ "snd_intel8x0" => [ "ali5455", "i810_audio", "nvaudio" ],
+ "snd_interwave" => [ "gus" ], # isa
+ "snd_interwave_stb" => [ "unknown" ], # isa
+ "snd_korg1212" => [ "unknown" ], # isa
+ "snd_layla20" => [ "unknown" ],
+ "snd_layla24" => [ "unknown" ],
+ "snd_layla3g" => [ "unknown" ],
+ "snd_maestro3" => [ "maestro3" ],
+ "snd_mia" => [ "unknown" ],
+ "snd_mixart" => [ "unknown" ],
+ "snd_mona" => [ "unknown" ],
+ "snd_mpu401" => [ "mpu401" ],
+ "snd_nm256" => [ "nm256_audio" ],
+ "snd_opl3sa2" => [ "opl3", "opl3sa", "opl3sa2" ], # isa
+ "snd_opti92x_ad1848" => [ "unknown" ], # isa
+ "snd_opti92x_cs4231" => [ "unknown" ], # isa
+ "snd_opti93x" => [ "mad16" ],
+ "snd_pcxhr" => [ "unknown" ], # pci
+ "snd_riptide" => [ "unknown" ],
+ "snd_rme32" => [ "unknown" ], # isa
+ "snd_rme96" => [ "rme96xx" ], # pci
+ "snd_rme9652" => [ "rme96xx" ], # pci
+ "snd_sb16" => ["sscape", "sb"],
+ "snd_sb8" => [ "sb" ],
+ "snd_sbawe" => [ "awe_wave" ],
+ "snd_sgalaxy" => [ "sgalaxy" ], # isa
+ "snd_sonicvibes" => [ "sonicvibes" ],
+ "snd_sscape" => [ "sscape" ], # isa
+ "snd_trident" => [ "trident" ],
+ "snd_usb_audio" => [ "audio" ], # usb
+ "snd_usb_caiaq" => [ "unknown" ],
+ "snd_usb_usx2y" => [ "unknown" ],
+ "snd_via82xx" => [ "via82cxxx_audio" ],
+ "snd_vx222" => [ "unknown" ],
+ "snd_vxp440" => [ "unknown" ], # pcmcia
+ "snd_vxpocket" => [ "unknown" ], # pcmcia
+ "snd_wavefront" => [ "wavefront" ], # isa
+ "snd_ymfpci" => [ "ymfpci" ],
+ );
+
+
+our %oss2alsa =
+ (
+ if_(arch() =~ /ppc/, "dmasound_pmac" => [ "snd_powermac" ]),
+ "ad1816" => [ "snd_ad1816a" ],
+ "ad1848" => [ "snd_ad1848", "snd_cs4236" ],
+ "ad1889" => [ "snd_ad1889" ],
+ "ali5455" => [ "snd_intel8x0" ],
+ "audigy" => [ "snd_emu10k1" ],
+ "audio" => [ "snd_usb_audio" ], # usb
+ "awe_wave" => [ "snd_sbawe" ],
+ "btaudio" => [ "snd_bt87x" ],
+ "cmpci" => [ "snd_cmipci" ],
+ "cs4232" => [ "snd_cs4232" ],
+ "cs4281" => [ "snd_cs4281" ],
+ "cs46xx" => [ "snd_cs46xx" ],
+ "emu10k1" => [ "snd_emu10k1" ],
+ "es1370" => [ "snd_ens1370" ],
+ "es1371" => [ "snd_ens1371" ],
+ "esssolo1" => [ "snd_es1938" ],
+ "forte" => [ "snd_fm801" ],
+ "gus" => ["snd_interwave", "snd_gusclassic", "snd_gusmax", "snd_gusextreme"],
+ "i810_audio" => [ "snd_intel8x0" ],
+ "ice1712" => [ "snd_ice1712" ],
+ "mad16" => [ "snd_opti93x" ],
+ "maestro" => [ "snd_es1968" ],
+ "maestro3" => [ "snd_maestro3" ],
+ "mpu401" => [ "snd_mpu401" ],
+ "msnd_pinnacle" => [ "unknown" ],
+ "nm256_audio" => [ "snd_nm256" ],
+ "nvaudio" => [ "snd_intel8x0" ],
+ "opl3" => [ "snd_opl3sa2" ],
+ "opl3sa" => [ "snd_opl3sa2" ],
+ "opl3sa2" => [ "snd_opl3sa2" ],
+ "pas2" => [ "unknown" ],
+ "pss" => [ "snd_ad1848" ],
+ "rme96xx" => [ "snd_rme96", "snd_rme9652" ],
+ "sam9407" => [ "unknown" ],
+ "sb" => [ "snd_als100", "snd_cmi8330", "snd_es1688", "snd_es18xx", "snd_es968", "snd_sb8", "snd_sb16" ],
+ "sgalaxy" => [ "snd_sgalaxy" ],
+ "sonicvibes" => [ "snd_sonicvibes" ],
+ "sscape" => [ "snd_sb16", "snd_sscape" ],
+ "trident" => [ "snd_ali5451", "snd_trident" ],
+ "via82cxxx_audio" => [ "snd_via82xx" ],
+ "wavefront" => [ "snd_wavefront" ],
+ "ymfpci" => [ "snd_ymfpci" ],
+ );
+
+my @blacklist = qw(cs46xx cs4281);
+my $blacklisted = 0;
+
+sub is_pulseaudio_enabled() {
+ my $soundprofile = common::read_alternative('soundprofile');
+ $soundprofile =~ /pulse$/;
+}
+
+sub set_pulseaudio {
+ my ($val) = @_;
+
+ my $alterative = '/etc/sound/profiles/' . ($val ? 'pulse' : 'alsa');
+ return if ! -d $alterative;
+
+ common::symlinkf_update_alternatives('soundprofile', $alterative);
+
+ # (cg) This config file will eventually be dropped, but it is still needed for now
+ # as several packages/patches depend on it.
+ my $config_file = "$::prefix/etc/sysconfig/pulseaudio";
+ $val = 'PULSE_SERVER_TYPE=' . ($val ? 'personal' : 'none') . "\n";
+ my $done;
+ substInFile {
+ if (/^PULSE_SERVER_TYPE=/) {
+ $_ = $val;
+ $done = 1;
+ }
+ } $config_file;
+ append_to_file($config_file, $val) if !$done;
+}
+
+
+my $pa_startup_scriptfile = "$::prefix/etc/pulse/default.pa";
+
+sub is_pulseaudio_glitchfree_enabled() {
+ return -f $pa_startup_scriptfile &&
+ cat_($pa_startup_scriptfile) !~ /^load-module\s+module-(udev|hal)-detect\s+tsched=0/m;
+}
+
+sub set_pulseaudio_glitchfree {
+ my ($val) = @_;
+
+ return if ! -f $pa_startup_scriptfile;
+
+ substInFile {
+ if ($val) {
+ s/^(load-module\s+module-(udev|hal)-detect)\s+tsched=0/$1/;
+ } else {
+ s/^(load-module\s+module-(udev|hal)-detect).*/$1 tsched=0/;
+ }
+ } $pa_startup_scriptfile;
+}
+
+my $pa_client_conffile = "$::prefix/etc/pulse/client.conf";
+
+sub set_PA_autospan {
+ my ($val) = @_;
+
+ return if ! -f $pa_client_conffile;
+
+ $val = 'autospawn = ' . bool2yesno($val) . "\n";
+ my $done;
+ substInFile {
+ if (/^autospawn\s*=/) {
+ $_ = $val;
+ $done = 1;
+ }
+ } $pa_client_conffile;
+ append_to_file($pa_client_conffile, $val) if !$done;
+}
+
+
+sub rooted { run_program::rooted($::prefix, @_) }
+
+sub unload { modules::unload(@_) if $::isStandalone || $blacklisted }
+
+sub load {
+ my ($modules_conf, $name) = @_;
+ modules::load_and_configure($modules_conf, $name) if $::isStandalone || $blacklisted;
+}
+
+sub get_alternative {
+ my ($driver) = @_;
+ my $list = $alsa2oss{$driver} || $oss2alsa{$driver};
+ $list ? @$list : "unknown";
+}
+
+sub do_switch {
+ my ($in, $modules_conf, $old_driver, $new_driver, $index) = @_;
+ return if $old_driver eq $new_driver;
+ my $_wait = $in->wait_message(N("Please wait"), N("Please Wait... Applying the configuration"));
+ log::explanations("removing old $old_driver\n");
+ if ($::isStandalone) {
+ rooted("service sound stop") unless $blacklisted;
+ rooted("service alsa stop") if $old_driver =~ /^snd_/ && !$blacklisted;
+ unload($old_driver); # run_program("/sbin/modprobe -r $driver"); # just in case ...
+ }
+ $modules_conf->remove_module($old_driver);
+ configure_one_sound_slot($modules_conf, $index, $new_driver);
+ $modules_conf->write;
+ if ($new_driver =~ /^snd_/) { # new driver is an alsa one
+ $in->do_pkgs->ensure_binary_is_installed(qw(alsa-utils alsactl), 1);
+ $in->do_pkgs->ensure_binary_is_installed(qw(aoss aoss), 1);
+ rooted("service alsa start") if $::isStandalone && !$blacklisted;
+ rooted("/sbin/chkconfig --add alsa") if $::isStandalone;
+ load($modules_conf, $new_driver) if $::isStandalone; # service alsa is buggy
+ } else { rooted("/sbin/chkconfig --del alsa") }
+ log::explanations("loading new $new_driver\n");
+ rooted("/sbin/chkconfig --add sound"); # just in case ...
+ rooted("service sound start") if $::isStandalone && !$blacklisted;
+}
+
+sub switch {
+ my ($in, $modules_conf, $device) = @_;
+ my $driver = $device->{current_driver} || $device->{driver};
+
+ foreach (@blacklist) { $blacklisted = 1 if $driver eq $_ }
+ my @alternative = $driver ne 'unknown' ? get_alternative($driver) : ();
+ unless ($driver eq $device->{driver} || member($device->{driver}, @alternative)) {
+ push @alternative, get_alternative($device->{driver}), $device->{driver};
+ }
+ if (@alternative) {
+ my $new_driver = $driver;
+ push @alternative, $driver;
+ my %des = modules::category2modules_and_description('multimedia/sound');
+
+ my $is_pulseaudio_installed = (-f $pa_startup_scriptfile && -f $pa_client_conffile && -d '/etc/sound/profiles/pulse');
+ my $is_pulseaudio_enabled = is_pulseaudio_enabled();
+ my $is_pulseaudio_glitchfree_enabled = is_pulseaudio_glitchfree_enabled();
+
+ my $old_value = $is_pulseaudio_enabled;
+
+ my $write_config = sub {
+ return if !$is_pulseaudio_installed;
+ set_pulseaudio($is_pulseaudio_enabled);
+ set_pulseaudio_glitchfree($is_pulseaudio_glitchfree_enabled);
+ set_PA_autospan($is_pulseaudio_enabled);
+ if ($is_pulseaudio_enabled) {
+ my $lib = (arch() =~ /x86_64/ ? 'lib64' : 'lib');
+ $in->do_pkgs->ensure_is_installed($lib . 'alsa-plugins-pulseaudio',
+ '/usr/' . $lib . '/alsa-lib/libasound_module_pcm_pulse.so');
+ }
+ if ($old_value ne $is_pulseaudio_enabled) {
+ require any;
+ any::ask_for_X_restart($in);
+ }
+ };
+
+ my @common = (
+ get_any_driver_entry($in, $modules_conf, $driver, $device),
+ {
+ text => N("Enable PulseAudio"),
+ type => 'bool', val => \$is_pulseaudio_enabled,
+ disabled => sub { !$is_pulseaudio_installed },
+ },
+ {
+ text => N("Use Glitch-Free mode"),
+ type => 'bool', val => \$is_pulseaudio_glitchfree_enabled,
+ disabled => sub { !$is_pulseaudio_installed || !$is_pulseaudio_enabled },
+ },
+ {
+ advanced => 1,
+ val => N("Reset sound mixer to default values"),
+ clicked => sub { run_program::run('reset_sound') }
+ },
+ {
+ advanced => 1,
+ val => N("Troubleshooting"), disabled => sub {},
+ clicked => sub { &trouble($in) }
+ },
+ );
+
+ if ($new_driver eq 'unknown') {
+ if ($in->ask_from_({
+ title => N("No alternative driver"),
+ messages => N("There's no known OSS/ALSA alternative driver for your sound card (%s) which currently uses \"%s\"",
+ $device->{description}, $driver),
+ },
+ \@common,
+ )) {
+ $write_config->();
+ }
+ } elsif ($in->ask_from_({ title => N("Sound configuration"),
+ messages =>
+ N("Here you can select an alternative driver (either OSS or ALSA) for your sound card (%s).",
+ $device->{description}) .
+ #-PO: here the first %s is either "OSS" or "ALSA",
+ #-PO: the second %s is the name of the current driver
+ #-PO: and the third %s is the name of the default driver
+ N("\n\nYour card currently uses the %s\"%s\" driver (the default driver for your card is \"%s\")", ($driver =~ /^snd_/ ? "ALSA " : "OSS "), $driver, $device->{driver}),
+ interactive_help => sub {
+ N("OSS (Open Sound System) was the first sound API. It's an OS independent sound API (it's available on most UNIX(tm) systems) but it's a very basic and limited API.
+What's more, OSS drivers all reinvent the wheel.
+
+ALSA (Advanced Linux Sound Architecture) is a modularized architecture which
+supports quite a large range of ISA, USB and PCI cards.\n
+It also provides a much higher API than OSS.\n
+To use alsa, one can either use:
+- the old compatibility OSS API
+- the new ALSA API that provides many enhanced features but requires using the ALSA library.
+");
+ },
+ },
+ [
+ {
+ label => N("Driver:"), val => \$new_driver, list => \@alternative, default => $new_driver, sort =>1,
+ allow_empty_list => 1,
+ format => sub { my ($drv) = @_;
+ $drv eq 'unknown' ? $drv :
+ sprintf(($des{$drv} ? "$des{$drv} (%s [%s])"
+ : "%s [%s]"), $drv, $drv =~ /^snd_/ ? 'ALSA' : 'OSS');
+ }
+ },
+ @common,
+ ]))
+ {
+ $write_config->();
+ return if $new_driver eq $device->{current_driver};
+ log::explanations("switching audio driver from '" . $device->{current_driver} . "' to '$new_driver'\n");
+ $in->ask_warn(N("Warning"), N("The old \"%s\" driver is blacklisted.\n
+It has been reported to oops the kernel on unloading.\n
+The new \"%s\" driver will only be used on next bootstrap.", $device->{current_driver}, $new_driver)) if $blacklisted;
+ do_switch($in, $modules_conf, $device->{current_driver}, $new_driver, $device->{sound_slot_index});
+ $device->{current_driver} = $new_driver;
+ }
+ } elsif ($driver =~ /^Bad:/) {
+ $driver =~ s/^Bad://;
+ $in->ask_warn(N("No open source driver"),
+ N("There's no free driver for your sound card (%s), but there's a proprietary driver at \"%s\".",
+ $device->{description}, $driver));
+ } elsif ($driver eq "unknown") {
+ $in->ask_from(N("No known driver"),
+ N("There's no known driver for your sound card (%s)",
+ $device->{description}),
+ [ get_any_driver_entry($in, $modules_conf, $driver, $device) ]);
+ }
+ end:
+}
+
+sub config {
+ my ($in, $modules_conf, $device) = @_;
+ switch($in, $modules_conf, $device);
+}
+
+
+sub trouble {
+ my ($in) = @_;
+ $in->ask_warn(N("Sound troubleshooting"),
+ formatAlaTeX(
+ #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("The classic bug sound tester is to run the following commands:
+
+
+- \"lspcidrake -v | fgrep -i AUDIO\" will tell you which driver your card uses
+by default
+
+- \"grep sound-slot /etc/modprobe.conf\" will tell you what driver it
+currently uses
+
+- \"/sbin/lsmod\" will enable you to check if its module (driver) is
+loaded or not
+
+- \"/sbin/chkconfig --list sound\" and \"/sbin/chkconfig --list alsa\" will
+tell you if sound and alsa services are configured to be run on
+initlevel 3
+
+- \"aumix -q\" will tell you if the sound volume is muted or not
+
+- \"/sbin/fuser -v /dev/dsp\" will tell which program uses the sound card.
+")));
+}
+
+sub get_any_driver_entry {
+ my ($in, $modules_conf, $driver, $device) = @_;
+ return () if $::isInstall;
+ +{
+ advanced => 1,
+ val => N("Let me pick any driver"), disabled => sub {},
+ clicked => sub {
+ my $old_driver = $driver;
+ if ($in->ask_from(N("Choosing an arbitrary driver"),
+ formatAlaTeX(
+ #-PO: keep the double empty lines between sections, this is formatted a la LaTeX
+ N("If you really think that you know which driver is the right one for your card
+you can pick one from the above list.
+
+The current driver for your \"%s\" sound card is \"%s\" ", $device->{description}, $driver)),
+ [
+ { label => N("Driver:"), val => \$driver, list => [ category2modules("multimedia/sound") ], type => 'combo', default => $driver, sort =>1, separator => '|' },
+ ]
+ )) {
+ do_switch($in, $modules_conf, $old_driver, $driver, $device->{sound_slot_index});
+ goto end;
+ }
+ }
+ };
+}
+
+sub configure_one_sound_slot {
+ my ($modules_conf, $index, $driver) = @_;
+ $modules_conf->set_sound_slot("sound-slot-$index", $driver);
+ $modules_conf->set_options($driver, "xbox=1") if $driver eq "snd_intel8x0" && detect_devices::is_xbox();
+ $modules_conf->set_options('snd-ac97-codec', "power_save=1") if $driver =~ /^snd/ && detect_devices::isLaptop()
+ && arch() !~ /mips/;
+}
+
+sub configure_sound_slots {
+ my ($modules_conf) = @_;
+ my $altered = 0;
+ each_index {
+ my $default_driver = $modules_conf->get_alias("sound-slot-$::i");
+ if (!member($default_driver, get_alternative($_->{driver}), $_->{driver})) {
+ $altered ||= $default_driver;
+ configure_one_sound_slot($modules_conf, $::i, $_->{driver});
+ }
+ } detect_devices::getSoundDevices();
+ $modules_conf->write if $altered && $::isStandalone;
+}
+
+
+1;
diff --git a/perl-install/harddrake/v4l.pm b/perl-install/harddrake/v4l.pm
new file mode 100644
index 000000000..12d130240
--- /dev/null
+++ b/perl-install/harddrake/v4l.pm
@@ -0,0 +1,496 @@
+package harddrake::v4l;
+
+use strict;
+
+use common;
+use detect_devices;
+use log;
+use modules;
+
+# please update me on bttv update :
+
+my $default = N("Auto-detect");
+# TODO: split %tuners_lst in per driver perl source files that get transformed in Storable files
+my %tuners_lst =
+ (
+ -1 => $default,
+ 0 => "Temic|PAL (4002 FH5)",
+ 1 => "Philips|PAL_I (FI1246 and compatibles)",
+ 2 => "Philips|NTSC (FI1236, FM1236 and compatibles)",
+ 3 => "Philips|(SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",
+ 4 => "NoTuner",
+ 5 => "Philips|PAL_BG (FI1216 and compatibles)",
+ 6 => "Temic|NTSC (4032 FY5)",
+ 7 => "Temic|PAL_I (4062 FY5)",
+ 8 => "Temic|NTSC (4036 FY5)",
+ 9 => "Alps|HSBH1",
+ 10 => "Alps|TSBE1",
+ 11 => "Alps|TSBB5",
+ 12 => "Alps|TSBE5",
+ 13 => "Alps|TSBC5",
+ 14 => "Temic|PAL_BG (4006FH5)",
+ 15 => "Alps|TSCH6",
+ 16 => "Temic|PAL_DK (4016 FY5)",
+ 17 => "Philips|NTSC_M (MK2)",
+ 18 => "Temic|PAL_I (4066 FY5)",
+ 19 => "Temic|PAL* auto (4006 FN5)",
+ 20 => "Temic|PAL_BG (4009 FR5) or PAL_I (4069 FR5)",
+ 21 => "Temic|NTSC (4039 FR5)",
+ 22 => "Temic|PAL/SECAM multi (4046 FM5)",
+ 23 => "Philips|PAL_DK (FI1256 and compatibles)",
+ 24 => "Philips|PAL/SECAM multi (FQ1216ME)",
+ 25 => "LG|PAL_I+FM (TAPC-I001D)",
+ 26 => "LG|PAL_I (TAPC-I701D)",
+ 27 => "LG|NTSC+FM (TPI8NSR01F)",
+ 28 => "LG|PAL_BG+FM (TPI8PSB01D)",
+ 29 => "LG|PAL_BG (TPI8PSB11D)",
+ 30 => "Temic|PAL* auto + FM (4009 FN5)",
+ 31 => "SHARP NTSC_JP (2U5JF5540)",
+ 32 => "Samsung|PAL TCPM9091PD27",
+ 33 => "MT20xx universal",
+ 34 => "Temic|PAL_BG (4106 FH5)",
+ 35 => "Temic|PAL_DK/SECAM_L (4012 FY5)",
+ 36 => "Temic|NTSC (4136 FY5)",
+ 37 => "LG|PAL (newer TAPC series)",
+ 38 => "Philips|PAL/SECAM multi (FM1216ME)",
+ 39 => "LG|NTSC (newer TAPC series)",
+ 40 => "HITACHI V7-J180AT",
+ 41 => "Philips|PAL_MK (FI1216 MK)",
+ 42 => "Philips|1236D ATSC/NTSC daul in",
+ 43 => "Philips|NTSC MK3 (FM1236MK3 or FM1236/F)",
+ 44 => "Philips|4 in 1 (ATI TV Wonder Pro/Conexant)",
+ 45 => "Microtune|4049 FM5",
+ 46 => "Panasonic VP27s/ENGE4324D",
+ 47 => "LG|NTSC (TAPE series)",
+ 48 => "Tena|TNF 8831 BGFF",
+ 49 => "Microtune|4042 FI5 ATSC/NTSC dual in",
+ 50 => "TCL 2002N",
+ 51 => "Philips|PAL/SECAM_D (FM 1256 I-H3)",
+ 52 => "Thomson|DDT 7610 (ATSC/NTSC)",
+ 53 => "Philips|FQ1286",
+ 54 => "tda8290+75",
+ 55 => "LG|PAL (TAPE series)",
+ 56 => "Philips|PAL/SECAM multi (FQ1216AME MK4)",
+ 57 => "Philips|FQ1236A MK4",
+ 58 => "Ymec|TVision|TVF-8531MF",
+ 59 => "Ymec|TVision|TVF-5533MF",
+ 60 => "Thomson|DDT 7611 (ATSC/NTSC)",
+ 61 => "Tena|TNF9533-D/IF/TNF9533-B/DF",
+ 62 => "Philips|TEA5767HN FM Radio",
+ 63 => "Philips|FMD1216ME MK3 Hybrid Tuner",
+ 64 => "LG|TDVS-H062F/TUA6034",
+ 65 => "Ymec|TVF66T5-B/DFF",
+ 66 => "LG|NTSC (TALN mini series)",
+ 67 => "Philips|TD1316 Hybrid Tuner",
+ 68 => "Philips|TUV1236D ATSC/NTSC dual in",
+ 69 => "Tena|TNF 5335 MF",
+ 70 => "Samsung|TCPN 2121P30A",
+ 71 => "Xceive xc3028",
+
+
+ );
+
+# Tweaked from Cardlist
+my $cards_lst = {
+ 'bttv' => {
+ $default => -1,
+ N("Unknown|Generic") => 0,
+ "M|Miro|PCTV" => 1,
+ "H|Hauppauge|bt848" => 2,
+ "S|STB|Hauppauge 878" => 3,
+ "I|Intel|Create and Share PCI (bttv type 4)" => 4,
+ "I|Intel|Smart Video Recorder III (bttv type 4)" => 4,
+ "D|Diamond DTV2000" => 5,
+ "A|AVerMedia|TVPhone" => 6,
+ "M|MATRIX Vision|MV-Delta" => 7,
+ "L|Lifeview|FlyVideo II (Bt848) LR26" => 8,
+ "G|Guillemot|MAXI TV Video PCI2 LR26" => 27,
+ "G|Genius/Kye Video Wonder Pro II (848 or 878)" => 8,
+ "I|IMS/IXmicro TurboTV" => 9,
+ "H|Hauppauge|bt878" => 10,
+ "M|Miro|PCTV pro" => 11,
+ "A|ADS Technologies|Channel Surfer TV (bt848)" => 12,
+ "A|AVerMedia|TVCapture 98" => 13,
+ "A|Aimslab|Video Highway Xtreme (VHX)" => 14,
+ "Zoltrix|TV-Max" => 15,
+ "P|Prolink|Pixelview PlayTV (bt878)" => 16,
+ "L|Leadtek|WinView 601" => 17,
+ "A|AVEC|Intercapture" => 18,
+ "L|Lifeview|FlyKit LR38 Bt848 (capture only)" => 19,
+ "L|Lifeview|FlyVideo II EZ" => 19,
+ "C|CEI Raffles Card" => 20,
+ "L|Lifeview|FlyVideo 98" => 21,
+ "L|Lucky Star Image World ConferenceTV LR50" => 21,
+ "A|Askey|CPH050" => 22,
+ "P|Phoebe Micro|Tv Master + FM" => 22,
+ "M|Modular|Technology MM205 PCTV (bt878)" => 23,
+ "A|Askey|CPH06X (bt878)" => 24,
+ "G|Guillemot|Maxi TV Video 3" => 24,
+ "A|Askey|CPH05X (bt878)" => 24,
+ N("Unknown|CPH05X (bt878) [many vendors]") => 24,
+ N("Unknown|CPH06X (bt878) [many vendors]") => 24,
+ "T|Terratec|Terra TV+ Version 1.0 (Bt848)" => 25,
+ "V|Vobis TV-Boostar" => 25,
+ "T|Terratec|TV-Boostar" => 25,
+ "H|Hauppauge|WinCam newer (bt878)" => 26,
+ "L|Lifeview|FlyVideo 98" => 27,
+ "G|Guillemot|MAXI TV Video PCI2 LR50" => 27,
+ "T|Terratec|TerraTV+" => 28,
+ "I|Imagenation PXC200" => 29,
+ "L|Lifeview|FlyVideo 98 LR50" => 30,
+ "Formac|iProTV" => 31,
+ "Formac|iProTV I (bt848)" => 31,
+ "I|Intel|Create and Share PCI (bttv type 32)" => 32,
+ "I|Intel|Smart Video Recorder III (bttv type 32)" => 32,
+ "T|Terratec|TerraTValue" => 33,
+ "L|Leadtek|WinFast TV 2000" => 34,
+ "L|Leadtek|WinFast VC 100" => 35,
+ "L|Lifeview|FlyVideo 98 LR50" => 35,
+ "C|Chronos Video Shuttle II" => 35,
+ "L|Lifeview|FlyVideo 98FM LR50" => 36,
+ "T|Typhoon|TView TV/FM Tuner" => 36,
+ "P|Prolink|PixelView PlayTV pro" => 37,
+ "P|Prolink|PixelView PlayTV Theater" => 37,
+ "A|Askey|CPH06X TView99" => 38,
+ "P|Pinnacle|PCTV Studio/Rave" => 39,
+ "S|STB|STB2 TV PCI FM, P/N 6000704" => 40,
+ "A|AVerMedia|TVPhone 98" => 41,
+ "P|ProVideo|PV951" => 42,
+ "L|Little OnAir TV" => 43,
+ "S|Sigma TVII-FM" => 44,
+ "M|MATRIX Vision|MV-Delta 2" => 45,
+ "Zoltrix|Genie TV/FM" => 46,
+ "T|Terratec|TV/Radio+" => 47,
+ "A|Askey|CPH03x" => 48,
+ "D|Dynalink Magic TView" => 48,
+ "I|IODATA|GV-BCTV3/PCI" => 49,
+ "P|Prolink|PixelView PlayTV PAK" => 50,
+ "L|Lenco|MXTV-9578 CP" => 50,
+ "P|Prolink|PV-BT878P+4E" => 50,
+ "L|Lenco|MXTV-9578CP (Bt878)" => 50,
+ "E|Eagle Wireless Capricorn2 (bt878A)" => 51,
+ "P|Pinnacle|PCTV Studio Pro" => 52,
+ "T|Typhoon|KNC1 TV Station RDS" => 53,
+ "T|Typhoon|TV Tuner RDS (black package)" => 53,
+ "T|Typhoon|TView RDS + FM Stereo" => 53,
+ "L|Lifeview|FlyVideo 2000" => 54,
+ "L|Lifeview|FlyVideo A2" => 54,
+ "L|Lifetec|LT 9415 TV [LR90]" => 54,
+ "A|Askey|CPH031" => 55,
+ "L|Lenco|MXR-9571 (Bt848)" => 55,
+ "Bestbuy|Easy TV" => 55,
+ "L|Lifeview|FlyVideo 98FM LR50" => 56,
+ "G|GrandTec|Grand Video Capture (Bt848)" => 57,
+ "A|Askey|CPH060" => 58,
+ "P|Phoebe Micro|TV Master Only (No FM)" => 58,
+ "A|Askey|CPH03x TV Capturer" => 59,
+ "M|Modular|Technology MM100 PCTV" => 60,
+ "A|AG|Electronics GMV1" => 61,
+ "A|Askey|CPH061" => 62,
+ "Bestbuy|Easy TV (bt878)" => 62,
+ "L|Lifetec|LT9306" => 62,
+ "M|Medion MD9306" => 62,
+ "A|ATI|TV-Wonder" => 63,
+ "A|ATI|TV-Wonder VE" => 64,
+ "L|Lifeview|FlyVideo 2000S LR90" => 65,
+ "T|Terratec|TValueRadio" => 66,
+ "I|IODATA|GV-BCTV4/PCI" => 67,
+ "3Dfx|VoodooTV FM (Euro)" => 68,
+ "3Dfx|VoodooTV 200 (USA)" => 68,
+ "A|Active|Imaging AIMMS" => 69,
+ "P|Prolink|Pixelview PV-BT878P+ (Rev.4C)" => 70,
+ "L|Lifeview|FlyVideo 98EZ (capture only) LR51" => 71,
+# "G|Genius/Kye|Video Wonder/Genius Internet Video Kit" => 71,
+ "P|Prolink|Pixelview PV-BT878P+ (Rev.9B) (PlayTV Pro rev.9B FM+NICAM)" => 72,
+ "T|Typhoon|TV Tuner Pal BG (blue package)" => 72,
+ "S|Sensoray 311" => 73,
+ "RemoteVision|MX (RV605)" => 74,
+ "P|Powercolor|MTV878" => 75,
+ "P|Powercolor|MTV878R" => 75,
+ "P|Powercolor|MTV878F" => 75,
+ "C|Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)" => 76,
+ "G|GrandTec|Multi Capture Card (Bt878)" => 77,
+ "Jetway TV/Capture JW-TV878-FBK" => 78,
+ "K|Kworld KW-TV878RF" => 78,
+ "D|DSP Design TCVIDEO" => 79,
+ "H|Hauppauge|WinTV PVR" => 80,
+ "G|GV-BCTV5/PCI" => 81,
+ "Osprey|100/150 (878)" => 82,
+ "Osprey|100/150 (848)" => 83,
+ "Osprey|101 (848)" => 84,
+ "Osprey|101/151" => 85,
+ "Osprey|101/151 w/ svid" => 86,
+ "Osprey|200/201/250/251" => 87,
+ "Osprey|200/250" => 88,
+ "Osprey|210/220" => 89,
+ "Osprey|500" => 90,
+ "Osprey|540" => 91,
+ "Osprey|2000" => 92,
+ "I|IDS Eagle" => 93,
+ "P|Pinnacle|PCTV Sat" => 94,
+ "Formac|ProTV II (bt878)" => 95,
+ "M|MachTV" => 96,
+ "E|Euresys|Picolo" => 97,
+ "P|ProVideo|PV150" => 98,
+ "A|AD-TVK503" => 99,
+ "H|Hercules Smart TV Stereo" => 100,
+ "P|Pace TV & Radio Card" => 101,
+ "I|IVC|200" => 102,
+ "G|GrandTec|Grand X-Guard / Trust 814PCI" => 103,
+ "N|Nebula Electronics DigiTV" => 104,
+ "P|ProVideo|PV143" => 105,
+ "P|PHYTEC|VD-009-X1 MiniDIN (bt878)" => 106,
+ "P|PHYTEC|VD-009-X1 Combi (bt878)" => 107,
+ "P|PHYTEC|VD-009 MiniDIN (bt878)" => 108,
+ "P|PHYTEC|VD-009 Combi (bt878)" => 109,
+ "I|IVC|100" => 110,
+ "I|IVC|120G" => 111,
+ "P|pcHDTV HD-2000 TV" => 112,
+ "T|Twinhan DST + clones" => 113,
+ "L|Leadtek|Winfast VC100" => 114,
+ "T|Teppro TEV-560/InterVision IV-560" => 115,
+ "S|SIMUS GVC1100" => 116,
+ "N|NGS NGSTV+" => 117,
+ "L|LMLBT4" => 118,
+ "T|Tekram M205 PRO" => 119,
+ "C|Conceptronic|CONTVFMi" => 120,
+ "E|Euresys|Picolo Tetra" => 121,
+ "S|Spirit TV Tuner" => 122,
+ "A|AverMedia|AVerTV DVB-T 771" => 123,
+ "A|AverMedia|AverTV DVB-T 761" => 124,
+ "M|MATRIX Vision|Sigma-SQ" => 125,
+ "M|MATRIX Vision|Sigma-SLC" => 126,
+ "A|APAC Viewcomp 878(AMAX)" => 127,
+ "D|DViCO|FusionHDTV DVB-T Lite" => 128,
+ "V|V-Gear MyVCD" => 129,
+ "S|Super TV Tuner" => 130,
+ "T|Tibet Systems 'Progress DVR' CS16" => 131,
+ "K|Kodicom|4400R (master)" => 132,
+ "K|Kodicom|4400R (slave)" => 133,
+ "A|Adlink|RTV24" => 134,
+ "D|DViCO|FusionHDTV 5 Lite" => 135,
+ "A|Acorp|Y878F" => 136,
+ "C|Conceptronic|CTVFMi v2" => 137,
+ "P|Prolink|Pixelview PV-BT878P+ (Rev.2E)" => 138,
+ "P|Prolink|PixelView PlayTV MPEG2 PV-M4900" => 139,
+ "Osprey|440" => 140,
+ "A|Asound|Skyeye PCTV" => 141,
+ "S|Sabrent TV-FM (bttv version)" => 142,
+ "H|Hauppauge|ImpactVCB (bt878)" => 143,
+ "M|MagicTV" => 144,
+
+ },
+
+ 'cx88' => {
+ N("Unknown|Generic") => 0,
+ "Hauppauge|WinTV 34xxx models" => 1,
+ "GDI Black Gold" => 2,
+ "PixelView|???" => 3,
+ "ATI|TV Wonder Pro" => 4,
+ "Leadtek|Winfast 2000XP Expert" => 5,
+ "AVerTV|Studio 303 (M126) " => 6,
+ 'MSI|TV-@nywhere Master' => 7,
+ "Leadtek|Winfast DV2000" => 8,
+ "Leadtek|PVR 2000" => 9,
+ "IODATA|GV-VCP3/PCI" => 10,
+ "Prolink PlayTV PVR" => 11,
+ "ASUS PVR-416" => 12,
+ 'MSI|TV-@nywhere' => 13,
+ "VStream|XPert DVB-T" => 14,
+ "KWorld|XPert DVB-T" => 14,
+ "DViCO|FusionHDTV DVB-T1" => 15,
+ "KWorld|LTV883RF" => 16,
+ "DViCO|FusionHDTV 3 Gold" => 17,
+ "Hauppauge|Nova-T DVB-T" => 18,
+ "Conexant DVB-T reference design" => 19,
+ "Provideo PV259" => 20,
+ "DViCO|FusionHDTV DVB-T Plus" => 21,
+ "digitalnow|DNTV Live! DVB-T" => 22,
+ "pcHDTV HD3000 HDTV" => 23,
+ "Hauppauge|WinTV 28xxx (Roslyn) models" => 24,
+ "Digital-Logic MICROSPACE Entertainment Center (MEC)" => 25,
+ "IODATA|GV/BCTV7E" => 26,
+ "PixelView|PlayTV Ultra Pro (Stereo)" => 27,
+ "DViCO|FusionHDTV 3 Gold-T" => 28,
+ "ADS Tech Instant TV DVB-T PCI" => 29,
+ "TerraTec Cinergy 1400 DVB-T" => 30,
+ "DViCO|FusionHDTV 5 Gold" => 31,
+ "AverMedia UltraTV Media Center PCI 550" => 32,
+ "KWorld|V-Stream Xpert DVD" => 33,
+ "ATI|HDTV Wonder" => 34,
+ "WinFast DTV1000-T" => 35,
+ "AVerTV|303 (M126)" => 36,
+ "Hauppauge|Nova-S-Plus DVB-S" => 37,
+ "Hauppauge|Nova-SE2 DVB-S" => 38,
+ "KWorld|VB-S 100" => 39,
+ "Hauppauge|WinTV-HVR1100 DVB-T/Hybrid" => 40,
+ "Hauppauge|WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802]" => 41,
+ "digitalnow|DNTV Live! DVB-T Pro" => 42,
+ "VStream|XPert DVB-T with cx22702" => 43,
+ "KWorld|XPert DVB-T with cx22702" => 43,
+ "DViCO|FusionHDTV DVB-T Dual Digital" => 44,
+ "KWorld|HardwareMpegTV XPert" => 45,
+
+ },
+
+ 'saa7134' => {
+ N("Unknown|Generic") => 0,
+ "Proteus Pro [philips reference design]" => 1,
+ "LifeView|FlyVIDEO3000" => 2,
+ "LifeView|FlyVIDEO2000" => 3,
+ "EMPRESS" => 4,
+ "SKNet|Monster TV" => 5,
+ "Tevion|MD 9717" => 6,
+ "KNC|One TV-Station RDS" => 7,
+ "Typhoon|TV Tuner RDS" => 7,
+ "Terratec|Cinergy 400 TV" => 8,
+ "Medion|5044" => 9,
+ "Kworld|SAA7130-TVPCI" => 10,
+ "KuroutoShikou SAA7130-TVPCI" => 10,
+ "Terratec|Cinergy 600 TV" => 11,
+ "Medion|7134" => 12,
+ "Typhoon|TV+Radio 90031" => 13,
+ "ELSA|EX-VISION 300TV" => 14,
+ "ELSA|EX-VISION 500TV" => 15,
+ "ASUS|TV-FM 7134" => 16,
+ "AOPEN VA1000 POWER" => 17,
+ "BMK|MPEX No Tuner" => 18,
+ "Compro|VideoMate TV" => 19,
+ "Matrox CronosPlus" => 20,
+ "10MOONS PCI TV CAPTURE CARD" => 21,
+ "Medion|2819" => 22,
+ "AverMedia|M156" => 22,
+ "BMK|MPEX Tuner" => 23,
+ "KNC|One TV-Station DVR" => 24,
+ "ASUS|TV-FM 7133" => 25,
+ "Pinnacle|PCTV Stereo (saa7134)" => 26,
+ "Manli|MuchTV M-TV002/Behold TV 403 FM" => 27,
+ "Manli|MuchTV M-TV001/Behold TV 401" => 28,
+ "Nagase Sangyo TransGear 3000TV" => 29,
+ "Elitegroup|ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM)" => 30,
+ "Elitegroup|ECS TVP3XP FM1236 Tuner Card (NTSC,FM)" => 31,
+ "AVACS SmartTV" => 32,
+ "AverMedia|DVD EZMaker" => 33,
+ "Noval Prime TV 7133" => 34,
+ "AverMedia|AverTV Studio 305" => 35,
+ "UPMOST PURPLE TV" => 36,
+ "Items MuchTV Plus / IT-005" => 37,
+ "Terratec|Cinergy 200 TV" => 38,
+ "LifeView|FlyTV Platinum Mini" => 39,
+ "Compro|VideoMate TV PVR/FM" => 40,
+ "Compro|VideoMate TV Gold+" => 41,
+ "Sabrent SBT-TVFM (saa7130)" => 42,
+ "Zolid Xpert TV7134" => 43,
+ "Empire PCI TV-Radio LE" => 44,
+ "AverMedia|AVerTV Studio 307" => 45,
+ "AverMedia|Cardbus TV/Radio" => 46,
+ "Terratec|Cinergy 400 mobile" => 47,
+ "Terratec|Cinergy 600 TV MK3" => 48,
+ "Compro|VideoMate Gold+ Pal" => 49,
+ "Pinnacle|PCTV 300i DVB-T + PAL" => 50,
+ "ProVideo PV952" => 51,
+ "AverMedia|AverTV/305" => 52,
+ "ASUS|TV-FM 7135" => 53,
+ "LifeView|FlyTV Platinum FM" => 54,
+ "LifeView|FlyDVB-T DUO" => 55,
+ "AverMedia|AVerTV 307" => 56,
+ "AverMedia|AVerTV GO 007 FM" => 57,
+ "ADS Tech Instant TV (saa7135)" => 58,
+ "Kworld|V-Stream Xpert TV PVR7134" => 59,
+ "Tevion|V-Stream Xpert TV PVR7134" => 59,
+ "Typhoon|DVB-T Duo Digital/Analog Cardbus" => 60,
+ "Philips|TOUGH DVB-T reference design" => 61,
+ "Compro|VideoMate TV Gold+II" => 62,
+ "Kworld|Xpert TV PVR7134" => 63,
+ "FlyTV mini Asus Digimatrix" => 64,
+ "Kworld|V-Stream Studio TV Terminator" => 65,
+ "Yuan TUN-900 (saa7135)" => 66,
+ "Beholder BeholdTV 409 FM" => 67,
+ "GoTView 7135 PCI" => 68,
+ "Philips|EUROPA V3 reference design" => 69,
+ "Compro|Videomate DVB-T300" => 70,
+ "Compro|Videomate DVB-T200" => 71,
+ "RTD|Embedded Technologies VFG7350" => 72,
+ "RTD|Embedded Technologies VFG7330" => 73,
+ "LifeView|FlyTV Platinum Mini2" => 74,
+ "AverMedia|AVerTVHD MCE A180" => 75,
+ "SKNet|MonsterTV Mobile" => 76,
+ "Pinnacle|PCTV 40i/50i/110i (saa7133)" => 77,
+ "ASUSTeK P7131 Dual" => 78,
+ "Sedna/MuchTV PC TV Cardbus TV/Radio (ITO25 Rev:2B)" => 79,
+ "ASUS|Digimatrix TV" => 80,
+ "Philips|Tiger reference design" => 81,
+ 'MSI TV@Anywhere plus' => 82,
+ "Terratec|Cinergy 250 PCI TV" => 83,
+ "LifeView|FlyDVB Trio" => 84,
+ "AverTV DVB-T 777" => 85,
+ "LifeView|FlyDVB-T" => 86,
+ "ADS Instant TV Duo Cardbus PTV331" => 87,
+ "Tevion|DVB-T 220RF" => 88,
+ "ELSA|EX-VISION 700TV" => 89,
+ "Kworld|ATSC110" => 90,
+
+ }
+};
+
+my %pll_lst =
+ (
+ -1 => N("Default"),
+ 0 => "do not use pll",
+ 1 => "28 Mhz Crystal (X)",
+ 2 => "35 Mhz Crystal"
+ );
+
+sub config {
+ my ($in, $modules_conf, $driver) = @_;
+
+ my $min_gbuffers = 2;
+ my $max_gbuffers = 32;
+
+ my %conf = (gbuffers => 4, card => $default, tuner => -1, radio => 0, pll => -1);
+
+ return if !$cards_lst->{$driver};
+ my %cards_list = %{$cards_lst->{$driver}};
+ my %rvs_cards_list = reverse %cards_list;
+
+ # get the existing options (if there are any)
+ my $current = $modules_conf->get_options($driver);
+
+ foreach (split(/\s+/,$current)) {
+ $conf{$1} = $2 if /^(gbuffers|tuner|radio|pll)=(.+)/;
+ $conf{$1} = $rvs_cards_list{$2} if /^(card)=(.+)/;
+ }
+
+ #Sanity checks on defaults
+ $conf{gbuffers} = max($min_gbuffers, $conf{gbuffers});
+ $conf{gbuffers} = min($max_gbuffers, $conf{gbuffers});
+ $conf{card} = $default if !defined $cards_list{$conf{card}};
+ $conf{tuner} = -1 if !defined $tuners_lst{$conf{tuner}};
+ if ($driver eq 'bttv') {
+ $conf{pll} = -1 if !defined $pll_lst{$conf{tuner}};
+ $conf{radio} = 0 if $conf{radio} !~ /(0|1)/;
+ }
+
+
+ if ($in->ask_from("BTTV configuration", N("For most modern TV cards, the bttv module of the GNU/Linux kernel just auto-detect the rights parameters.
+If your card is misdetected, you can force the right tuner and card types here. Just select your TV card parameters if needed."),
+ [
+ { label => N("Card model:"), val => \$conf{card}, list => [ keys %cards_list ], default => -1, sort =>1, separator => '|' },
+ { label => N("Tuner type:"), val => \$conf{tuner}, list => [keys %tuners_lst], format => sub { $tuners_lst{$_[0]} }, sort => 1, separator => '|' },
+ ]
+ ))
+ {
+ $conf{card} = $cards_list{$conf{card}};
+ if (my $options = join(' ', if_($driver eq 'bttv', 'radio=' . ($conf{radio} ? 1 : 0)), map { if_($conf{$_} ne -1, "$_=$conf{$_}") } qw(card pll tuner gbuffers))) {
+ log::l(qq([harddrake::v4l] set "$options" options for $driver));
+# log::explanations("modified file /etc/modules.conf ($options)") if $::isStandalone;
+ $modules_conf->set_options($driver, $options);
+ }
+ return 1;
+ }
+ return 0;
+}
+
+
+
+1;