diff options
Diffstat (limited to 'perl-install/harddrake')
-rw-r--r-- | perl-install/harddrake/TODO | 169 | ||||
-rw-r--r-- | perl-install/harddrake/autoconf.pm | 141 | ||||
-rwxr-xr-x | perl-install/harddrake/check_snd.pl | 2 | ||||
-rw-r--r-- | perl-install/harddrake/data.pm | 428 | ||||
-rw-r--r-- | perl-install/harddrake/sound.pm | 903 | ||||
-rw-r--r-- | perl-install/harddrake/v4l.pm | 318 |
6 files changed, 1248 insertions, 713 deletions
diff --git a/perl-install/harddrake/TODO b/perl-install/harddrake/TODO deleted file mode 100644 index b09b8ee5e..000000000 --- a/perl-install/harddrake/TODO +++ /dev/null @@ -1,169 +0,0 @@ --*- outline -*- - -* drakxtools -** drakxtools* need XF-{75,100}fonts that requires XFree86 - -* Harddrake TODO: -** ui -*** more usb mice infos -*** enable the user to force a module (isa, isapnp, ...) -*** print "(not loaded)" if module isn't loaded -*** add bus_position to make unique id in ui (check it does not confuse hw service) -*** cdrom (must be done by diskdrake): -**** ide-scsi / ide-cd switch (humm, the future (aka 2.6.x kernel) is ide-cd only) -*** use fbgtk+2 when booting on fbcon for smoother GUI => interactive::fbgtk -*** help: -**** print fields in black and their description in blue as for information fields -*** check there's at least one config option before showing the "condigure module" button -*** s/module/driver/ ? -** fixes -*** configure at boot-time (hw hooks shared by both harddrake & drakx ?): - all /etc/modules aliases -**** usb-interfaces (or rewrite usb service in perl for speed) -**** switch nvidia/nv in /etc/X11/XF86Config - if [[ -e /lib/modules/`uname -r`/kernel/drivers/video/NVdriver ]]; then - perl -pi -e 's!Driver "nv.*"!Driver "nvidia"!g;s!#HARDDRAKE (Load.*glx)!\1!g' /etc/X11/XF86Config-4 - else - perl -pi -e 's!Driver "nv.*"!Driver "nv"!g;s!(Load.*glx)!#HARDDRAKE \1!g' /etc/X11/XF86Config-4 - fi -*** non needed stuff to run X must be posponed after X11 startup -**** eg: scanner/audio/printer/floppy/cdrom/tape/tv/webcam/joystick/ ... -** packaging : separate version for harddrake & drakxtool -** configurators -*** new cd burner: offer to install cdrecord and one of its gui frontends -*** new dvd driver : offer to install xine||mplayer -*** draksound : -**** add a dialog so that the user choose its wavetable. -**** list all availables drivers, defaulting to first alternative, prepending old one with '*' -**** add 'ALSA/OSS': tag to modules list -** detect engine: -*** detect isapnp devices -*** set more field for fscking 0x0000:0x0000 usb controllers - -** move all drakx tools into just a small one-liner that uses real <tool>.pm - so that harddrake and mcc reduces their memory usage pattern and - be faster (the next fast step will be to use perl6/parrot) - - drawback : this would level down quite a lot the global mcc/harddrake robustness - -** check there're enough parameters in module config -** for to send a message for unknown hardware to install@mandrakesoft.com - - Subject: [UNKNOW HARDWARE] or a new other ml - -> do you konw how to configure it under linux ? - -> description - - -* #################################################################### -* #################################################################### - -* / no hope / useless : -** enable a string to be passed as detector; in that case, do ourself the =~ -** alter detect_devices in order to only probe one time -** detect *ALL* mouses if more than one (mousedrake?) - -** deeper data structure in Mandrake 9.2 ? - - "Mass storage" => (Floppy, - Disk, - Cdrom, - Tape) - - "Network" => (Ethernetcard, - Modem, - Isdn) - "Multimedia" => (Videocard, - Tvcard, - Soundcard, - Webcam) - "System" => (Bridge, - Cpu, - Memory) - - - "Publishing" => (Printer, - Scanner) - - "Pointing" => (Mouse, - Joystick) - - "Buses" => (Ideinterface, - Scsiinterface, - Usbinterface, - ); - - "Unknown/Others", - -* #################################################################### - -* Suggestions -** various -Subject: Re: [Cooker] Optional ALSA Support for SB Live! -From: Fabrice FACORAT <f.faber@netcourrier.com> -To: cooker@linux-mandrake.com -In-Reply-To: <m2ofhvtpaq.fsf@vador.mandrakesoft.com> -References: <20020311051222.47DC087CA5@yavin.mandrax.org> - <m2ofhvtpaq.fsf@vador.mandrakesoft.com> -Date: 11 Mar 2002 11:12:31 +0100 -Message-Id: <1015841551.3895.31.camel@bastard.localdomain> - -Le lun 11/03/2002 à 10:41, Thierry Vignaud a écrit : - -> > In Mandrake 8.1 rerunning Harddrake post-setup would switch over -> > to ALSA (which supports MIDI synth), however in 8.2 the only way to -> > get ALSA support is to manually edit the modules.conf file. This -> > would be disasterous for someone who isn't familar with -> > modules.conf, but had been instructed on the mandrake-expert/newbie -> > lists (as many had been) to simply rerun Harddrake on the sound card -> > to get ALSA (and hence MIDI synth support). -> -> give me the result of lspcidrake -f -v so that i switch your card -> from oss to alsa. - -no please. -just one month ago you switch SBLive from Alsa to OSS ( cause drakX -set it as OSS and harddrake as Alsa ). -There were also a discussion concerning the fact that Alsa doesn't -support emu-tools and so all available options. -Last but not least, several peoples report pbs with Alsa ( is sound is -too high you have disturbances ). So someone is going to ask you for -OSS as it want to use some features os SBLive, etc ... - -To my mind the best way for this ( but too late for 8.2 ) will be to -have a tool called soundrake. Thanks to this tools, you choose at the -beginning if you want to use OSS or alsa and then try to correctly -configure your sound card. This tool should be able to work in -embended mo in harddrake or harddrake2 ( infos concerning this so long -awaiting harddrake 2 ? ). - -In order to make this tool be a perfect tool, it should be able to -advice user concerning the advantage and the disadvantage of each -driver ( indeed alsa sometimes is better than OSS as it support full -duplex and wave mixing on more sound cards ). -It's also disturbing is harddrake set alsa by default and XrakX set -OSS by default as sometimes by lanching harddrake ( just to see what -happen ) you lose ( or seems to lose ) your sound card ( mute mixer ) - -For example : -+ launch harddrake -+ use autodetection : yes/no -+ if auto detects enable, it detects a SBLive. -+ explanations text concerning the fact that : - if I use OSS I will be able to use sounds effects, live drive and -others things ( AC-3 passthrough ) thanks to the emu10k1-tools packages -( available on CD sets and installable via Software Manager ) - if I use Alsa, I won't be able to use emu10k1-tools but at the -contrary I will be able to use midi software as alsa module support midi -+ ask user which one he wants to use : OSS / Alsa ? -+ set the sound card drivers and modules.conf according to user wishes -+ <mode= dream> if I select OSS, installed emu10k1-tools and provide a -GUI to configure them </mode = dream> -+ <mode= dream> if I select Alsa unmute at least PCM and Vol or display -a warning saying that by default Alsa mute everything ( configure alsa -service so that it save mixer settings ) -+ test the sound ( mandrake sound theme ) -+ do you hear something ? -+ yes -> your sound card have been properly set. -+ if no -> try the others drivers set or send lspcidrake -v to -somebody@somewhere.org to check for support for your sound card -+ Do you ahave another sound card ? diff --git a/perl-install/harddrake/autoconf.pm b/perl-install/harddrake/autoconf.pm index 061d738af..fba5078cd 100644 --- a/perl-install/harddrake/autoconf.pm +++ b/perl-install/harddrake/autoconf.pm @@ -1,46 +1,155 @@ package harddrake::autoconf; use common; -use any; sub xconf { - my ($modules_conf, $o) = @_; + my ($modules_conf, $o, $o_skip_fb_setup, $o_resolution_wanted) = @_; log::l('automatic XFree configuration'); require Xconfig::default; - $o->{raw_X} = Xconfig::default::configure(do_pkgs_standalone->new); + 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; - require do_pkgs; - Xconfig::main::configure_everything_auto_install($o->{raw_X}, do_pkgs_standalone->new, {}, { allowFB => 1 }); + 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 setup_ethernet_device { + my ($in, $device) = @_; + + require network::connection; + require network::connection::ethernet; + require network::connection::wireless; + my @connection_types = qw(network::connection::ethernet network::connection::wireless); + my @all_connections = map { $_->get_connections(automatic_only => 1) } @connection_types; + my $interface = network::connection::ethernet::device_to_interface($device) + or return; + my $connection = find { $_->get_interface eq $interface } @all_connections + or return; + + require network::connection_manager; + my $net = {}; + network::network::read_net_conf($net); + my $cmanager = network::connection_manager->new($in, $net); + $cmanager->set_connection($connection); + + # this will installed required packages + $cmanager->setup_connection; +} + sub network_conf { - my ($obj) = @_; - require network::network; - network::network::easy_dhcp($obj->{modules_conf}, $obj->{netc}, $obj->{intf}) and $obj->{netcnx}{type} = 'lan'; + my ($modules_conf, $in, $added) = @_; + $modules_conf->remove_alias_regexp('^(wlan|eth)[0-9]*$'); + modules::load_category($modules_conf, 'network/main|gigabit|usb|wireless|firewire|pcmcia'); + + setup_ethernet_device($in, $_) foreach @{$added || {}}; + + require network::connection::ethernet; + network::connection::ethernet::configure_eth_aliases($modules_conf); + require network::rfswitch; + network::rfswitch::configure(); + require network::shorewall; + network::shorewall::update_interfaces_list(); + $modules_conf->write; } sub mouse_conf { my ($modules_conf) = @_; require do_pkgs; require mouse; - mouse::write_conf(do_pkgs_standalone->new, $modules_conf, mouse::detect($modules_conf), 1); + 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) = @_; + # do not disable bluetooth service if adapter disappears + # (for example if disabled by Fn keys) + # systemd will automatically disable the service if needed + return if !$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("laptop-mode", $on_laptop); + services::set_status("numlock", !$on_laptop); +} - #- should be set after installing the package above otherwise the file will be renamed. - setVarsInSh("$::prefix/etc/sysconfig/pcmcia", { - PCMCIA => bool2yesno($pcic), - PCIC => $pcic, - PCIC_OPTS => "", - CORE_OPTS => "", - }); +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 index dfa007b80..4721bed40 100755 --- a/perl-install/harddrake/check_snd.pl +++ b/perl-install/harddrake/check_snd.pl @@ -10,7 +10,7 @@ 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; +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"; diff --git a/perl-install/harddrake/data.pm b/perl-install/harddrake/data.pm index 94c04810a..8d4d4de21 100644 --- a/perl-install/harddrake/data.pm +++ b/perl-install/harddrake/data.pm @@ -3,18 +3,28 @@ 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(); +my @devices = (detect_devices::probeall(), detect_devices::getSCSI()); + +foreach my $dev (@devices) { + # normalize device IDs for devices that 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|SCSI)|SYSTEM_OTHER|tape|UPS/ + 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/ + && $_->{driver} !~ /^ISDN|Mouse:USB|Removable:zip|class\|Mouse|sata|www.linmodems.org|kbd|mouse|sysrq|usbhid/ && $_->{type} ne 'network' && $_->{description} !~ /Alcatel|ADSL Modem/; } @devices; @@ -22,7 +32,7 @@ sub unknown() { my @alrd_dected; sub f { - my @devs = grep { !member(pciusb_id($_), @alrd_dected) } @_; + my @devs = grep { !member(pciusb_id($_), @alrd_dected) } grep { $_ } @_; push @alrd_dected, map { pciusb_id($_) } @devs; @devs; } @@ -34,29 +44,126 @@ sub f { # FIXME: add translated items -sub is_removable { $_[0] =~ /FLOPPY|ZIP|DVDROM|CDROM|BURNER/ } +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) = @_; - return "/usr/sbin/diskdrake --removable=$device->{device}" if is_removable($class); + is_removable($class) ? "/usr/sbin/diskdrake --removable=$device->{device}" : undef; } -sub set_removable_auto_configurator { - my ($class, $device) = @_; - return "/usr/sbin/drakupdate_fstab --no-flag --auto --add $device->{device}" if is_removable($class); -} - -sub set_removable_remover { - my ($class, $device) = @_; - return "/usr/sbin/drakupdate_fstab --no-flag --del $device->{device}" if is_removable($class); -} - 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')), + f(grep { $_->{description} =~ /AHCI/ } @devices) }, + 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", @@ -71,7 +178,13 @@ our @tree = string => N("Zip"), icon => "floppy.png", configurator => "", - detector => \&detect_devices::zips, + 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, }, @@ -83,6 +196,16 @@ our @tree = 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, }, { @@ -90,7 +213,7 @@ our @tree = string => N("CDROM"), icon => "cd.png", configurator => "", - detector => sub { grep { !(detect_devices::isBurner($_) || detect_devices::isDvdDrive($_)) } &detect_devices::cdroms }, + detector => sub { f(grep { !(detect_devices::isBurner($_) || detect_devices::isDvdDrive($_)) } &detect_devices::cdroms) }, checked_on_boot => 1, automatic => 1, }, @@ -100,7 +223,7 @@ our @tree = string => N("CD/DVD burners"), icon => "cd.png", configurator => "", - detector => \&detect_devices::burners, + detector => sub { f(detect_devices::burners()) }, checked_on_boot => 1, automatic => 1, }, @@ -110,7 +233,7 @@ our @tree = string => N("DVD-ROM"), icon => "cd.png", configurator => "", - detector => sub { grep { ! detect_devices::isBurner($_) } detect_devices::dvdroms() }, + detector => sub { f(grep { ! detect_devices::isBurner($_) } detect_devices::dvdroms()) }, checked_on_boot => 1, automatic => 1, }, @@ -124,22 +247,41 @@ our @tree = 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", - configurator_auto => "$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/bin/XawTV", - detector => sub { f(grep { $_->{media_type} =~ /MULTIMEDIA_VIDEO/ && $_->{bus} eq 'PCI' || $_->{driver} eq 'usbvision' } @devices) }, + 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, }, @@ -157,7 +299,12 @@ our @tree = string => N("Soundcard"), icon => "sound.png", configurator => "$sbindir/draksound", - detector => sub { f(grep { $_->{media_type} =~ /MULTIMEDIA_AUDIO/ } @devices) }, + detector => sub { + require list_modules; + my @modules = list_modules::category2modules('multimedia/sound'); + f(grep { $_->{media_type} =~ /MULTIMEDIA_AUDIO|PROCESSOR_CO/ || member($_->{driver}, @modules) + || $_->{description} =~ /^\|?HDA |PC Speaker/ } @devices); + }, checked_on_boot => 1, }, @@ -168,8 +315,9 @@ our @tree = configurator => "", detector => sub { require list_modules; - my @modules = list_modules::category2modules('multimedia/webcam'); - f(grep { $_->{media_type} =~ /MULTIMEDIA_VIDEO/ && $_->{bus} ne 'PCI' || member($_->{driver}, @modules) } @devices); + 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, @@ -182,7 +330,7 @@ our @tree = configurator => "", detector => sub { detect_devices::getCPUs() }, # maybe should we install schedutils? - checked_on_boot => 0, + checked_on_boot => 1, }, { @@ -190,11 +338,57 @@ our @tree = string => N("ISDN adapters"), icon => "modem.png", configurator => "$sbindir/drakconnect", - detector => sub { require network::isdn; my $isdn = network::isdn::detect_backend($modules_conf); if_(@$isdn, f(@$isdn)) }, + 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')), f(grep { $_->{description} =~ /Bluetooth Dongle/ } @devices) }, + checked_on_boot => 1, + }, + { class => "ETHERNET", string => N("Ethernetcard"), @@ -202,12 +396,12 @@ our @tree = configurator => "$sbindir/drakconnect", detector => sub { require list_modules; - require network::ethernet; 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); + || member($_->{driver}, @net_modules) + || $_->{description} =~ /WLAN/; } @devices); }, checked_on_boot => 1, @@ -218,7 +412,7 @@ our @tree = string => N("Modem"), icon => "modem.png", configurator => "$sbindir/drakconnect", - detector => sub { detect_devices::getModem($modules_conf) }, + detector => sub { f(detect_devices::getModem($modules_conf)), f(grep { $_->{description} =~ /SoftModem/ } @devices) }, # we do not check these b/c this need user interaction (auth, ...): checked_on_boot => 0, }, @@ -228,11 +422,9 @@ our @tree = string => N("ADSL adapters"), icon => "modem.png", configurator => "$sbindir/drakconnect", - detector => sub { - require network::adsl; - my $a = network::adsl::adsl_detect(); - $a ? f(grep { $_ } values %$a) : (); - }, + 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, }, @@ -240,119 +432,88 @@ our @tree = { class => "MEMORY", string => N("Memory"), - icon => "memory.png", + icon => "hw-memory.png", configurator => "", - detector => sub { grep { member($_->{name}, 'Cache', 'Memory Module') } detect_devices::dmidecode() }, + detector => sub { grep { member($_->{name}, 'Cache', 'Memory Module') || $_->{name} eq 'Memory Device' && $_->{Size} ne 'No Module Installed' } detect_devices::dmidecode() }, checked_on_boot => 0, }, { - class => "AGP", - string => N("AGP controllers"), - icon => "memory.png", - configurator => "", - detector => sub { f(modules::probe_category('various/agpgart')) }, - checked_on_boot => 1, - }, - - { class => "PRINTER", string => N("Printer"), icon => "hw_printer.png", configurator => "$sbindir/printerdrake", - detector => sub { require printer::detect; printer::detect::local_detect() }, - # we do not check these b/c this need user interaction (auth, ...): - checked_on_boot => 0, - }, - - { - class => "JOYSTICK", - string => N("Joystick"), - icon => "joystick.png", - configurator => "", detector => sub {}, + # we do not check these b/c this need user interaction (auth, ...): checked_on_boot => 0, }, - { - class => "ATA_STORAGE", - string => N("(E)IDE/ATA controllers"), - icon => "ide_hd.png", - configurator => "", - detector => sub { f(grep { $_->{media_type} =~ /STORAGE_(IDE|OTHER)/ || $_->{driver} eq '3w-xxxx' } @devices) }, - checked_on_boot => 1, - }, { - class => "SATA_STORAGE", - string => N("SATA controllers"), - icon => "ide_hd.png", + class => "GAMEPORT", + string => + #-PO: these are joysticks controllers: + N("Game port controllers"), + icon => "joystick.png", configurator => "", - detector => sub { f(grep { $_->{driver} =~ /^sata/ } @devices) }, - checked_on_boot => 1, + detector => sub { f(detect_devices::probe_category('multimedia/gameport')) }, + checked_on_boot => 0, }, { - class => "FIREWIRE_CONTROLLER", - string => N("Firewire controllers"), - icon => "usb.png", + class => "JOYSTICK", + string => N("Joystick"), + icon => "joystick.png", configurator => "", - detector => sub { f(grep { $_->{driver} =~ /ohci1394/ } @devices) }, - checked_on_boot => 1, + detector => sub { f(detect_devices::probe_category('input/joystick')), f(grep { $_->{description} =~ /Joystick/i } @devices) }, + checked_on_boot => 0, }, - { - class => "PCMCIA_CONTROLLER", - string => N("PCMCIA controllers"), - icon => "scsi.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(grep { $_->{media_type} =~ /STORAGE_SCSI/ || $_->{driver} eq 'megaraid' } @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 => "KEYBOARD", + string => N("Keyboard"), + icon => "hw-keyboard.png", + configurator => "$sbindir/keyboarddrake", + detector => sub { + f(grep { $_->{description} =~ /Keyboard/i || $_->{media_type} =~ /Keyboard/i || + # USB devices are filtered out since we already catch them through probeall(): + $_->{bus} ne 'usb' && $_->{driver} =~ /^event|kbd|^usbhid/ && $_->{description} !~ /PC Speaker/; + } @devices); + }, + checked_on_boot => 0, }, { - class => "USB_HUB", - string => N("USB ports"), - icon => "usb.png", - configurator => "", - detector => sub { f(grep { $_->{media_type} =~ /Hub/ } @devices) }, + 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 => "SMB_CONTROLLER", - string => N("SMBus controllers"), - icon => "usb.png", - configurator => "", - detector => sub { f(grep { $_->{media_type} =~ /SERIAL_SMBUS/ } @devices) }, - 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 => "BRIDGE", - string => N("Bridges and system controllers"), - icon => "memory.png", - configurator => "", - detector => sub { f(grep { $_->{media_type} =~ /BRIDGE|MEMORY_RAM|SYSTEM_OTHER/ } @devices) }, + class => "BIOMETRIC", + string => N("Biometry"), + icon => "ups.png", + detector => sub { f(grep { $_->{description} =~ /fingerprint|biometric/i } @devices) }, checked_on_boot => 0, }, @@ -366,39 +527,13 @@ our @tree = }, { - class => "KEYBOARD", - string => N("Keyboard"), - icon => "usb.png", - configurator => "$sbindir/keyboardrake", - detector => sub { - f(grep { $_->{description} =~ /Keyboard/i } @devices), - # USB devices are filtered out since we already catch them through probeall(): - grep { $_->{bus} ne 'usb' && $_->{driver} eq 'kbd' && $_->{description} !~ /PC Speaker/ } detect_devices::getInputDevices(); - }, - checked_on_boot => 0, - }, - - { - class => "MOUSE", - string => N("Mouse"), - icon => "hw_mouse.png", - configurator => "$sbindir/mousedrake", - detector => sub { - f(grep { $_->{driver} =~ /^Mouse:|^Tablet:/ } @devices), - # USB devices are filtered out since we already catch them through probeall(): - grep { $_->{bus} ne 'usb' && $_->{driver} =~ /mouse/ } detect_devices::getInputDevices(); - }, - checked_on_boot => 1, - automatic => 1, - }, - - { class => "SCANNER", string => N("Scanner"), icon => "scanner.png", configurator => "$sbindir/scannerdrake", detector => sub { - require scanner; f(scanner::detect()) }, + require scanner; f(map { $_->{val}{drakx_device} } f(scanner::detect())); + }, checked_on_boot => 0, }, @@ -423,7 +558,9 @@ sub pciusb_id { pci_device => 'usb_pci_device', vendor => 'usb_vendor', ); - join(':', map { $dev->{$alt{$_}} || $dev->{$_} } qw(bus pci_bus pci_device vendor id subvendor subid description)); + 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); } @@ -435,8 +572,7 @@ sub custom_id { N("cpu # ") . $device->{processor} . ": " . $device->{'model name'} : $device->{"Socket Designation"} ? "$device->{name} (" . $device->{"Socket Designation"} . ")" : - $device->{name} ? $device->{name} : - (defined($device->{description}) ? $device->{description} : $str)); + $device->{name} || $device->{description} || $device->{Vendor} || $str); } 1; diff --git a/perl-install/harddrake/sound.pm b/perl-install/harddrake/sound.pm index 95a6de10d..cdf24c219 100644 --- a/perl-install/harddrake/sound.pm +++ b/perl-install/harddrake/sound.pm @@ -1,14 +1,4 @@ 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) @@ -16,348 +6,659 @@ package harddrake::sound; use strict; use common; -use interactive; use run_program; use modules; use list_modules; use detect_devices; use log; +sub is_pulseaudio_enabled { + my ($in) = @_; + my $soundprofile = common::read_alternative('soundprofile'); + return $in->do_pkgs->is_installed('task-pulseaudio') && $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; +} + -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-ali5451" => [ "trident" ], - "snd-als100" => [ "sb" ], # isa - "snd-als4000" => [ "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-cmipci" => [ "cmpci" ], - "snd-cs4231" => [ "unknown" ], # isa - "snd-cs4232" => [ "cs4232" ], # isa - "snd-cs4236" => [ "ad1848" ], # isa - "snd-cs4281" => [ "cs4281" ], - "snd-cs46xx" => [ "cs46xx" ], - "snd-darla20" => [ "unknown" ], - "snd-darla24" => [ "unknown" ], - "snd-dt0197h" => [ "unknown" ], # isa - "snd-dt019x" => [ "unknown" ], # isa - "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-intelp" => [ "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-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-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" => [ "unknown" ], - "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 rooted { run_program::rooted($::prefix, @_) } - -sub unload { modules::unload(@_) if $::isStandalone || $blacklisted } +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; +} + +sub is_pipewire_wireplumber_enabled { + my ($in) = @_; + return $in->do_pkgs->is_installed('pipewire') && $in->do_pkgs->is_installed('wireplumber'); +} + +sub is_pipewire_media_session_enabled { + my ($in) = @_; + return $in->do_pkgs->is_installed('pipewire') && $in->do_pkgs->is_installed('pipewire-media-session'); +} + +sub rooted { + run_program::rooted($::prefix, @_); +} + +sub unload { modules::unload(@_) if $::isStandalone } sub load { my ($modules_conf, $name) = @_; - modules::load_and_configure($modules_conf, $name) if $::isStandalone || $blacklisted; + modules::load_and_configure($modules_conf, $name) if $::isStandalone; +} + +sub _pidof { + my ($name) = @_; + rooted('/usr/bin/pidof', $name); +} + +# return the pid of a running command +sub _pidof_pid { + my ($name) = @_; + my ($pid) = chomp_(run_program::rooted_get_stdout($::prefix, '/usr/bin/pidof', $name)); + + return $pid; +} + +# return the username of a running command +sub _user_pid { + my ($name) = @_; + my ($pid) = _pidof_pid($name); + my $user; + + if ($pid) { + ($user) = chomp_(run_program::rooted_get_stdout($::prefix, '/usr/bin/ps', '-o', 'uname=', '-p', $pid)); + } + + return $user; +} + +# stop pulseaudio for the running user +sub stop_pulseaudio { + my ($pulseaudio_user) = _user_pid('/usr/bin/pulseaudio'); + + if ($pulseaudio_user) { + if (-x $::prefix . '/usr/bin/pulseaudio') { + rooted('/usr/bin/su', '-l', $pulseaudio_user, '-c', '/usr/bin/pulseaudio --kill'); + } + } + + # try stopping again (in case the /usr/bin/pulseaudio process is still running, but the executable no longer available) + my ($pulseaudio_user) = _user_pid('/usr/bin/pulseaudio'); + if ($pulseaudio_user) { + my ($pulseaudio_pid) = _pidof_pid('/usr/bin/pulseaudio'); + if ($pulseaudio_pid) { + rooted('/usr/bin/su', '-l', $pulseaudio_user, '-c', '/usr/bin/kill -TERM ' . $pulseaudio_pid); + } + } + return $pulseaudio_user; +} + +# stop pipewire services for the running user +sub stop_pipewire { + my ($pipewire_user) = _user_pid('/usr/bin/pipewire'); + + if ($pipewire_user) { + rooted('/usr/bin/systemctl', '--machine=' . $pipewire_user . '@.host', '--user', 'stop', 'pipewire-pulse.service', 'pipewire-pulse.socket', 'pipewire.service', 'pipewire.socket'); + } + + return $pipewire_user; +} + +# start pulseaudio for the specified user +sub start_pulseaudio { + my ($pulseaudio_user) = @_; + + if ($pulseaudio_user) { + rooted('/usr/bin/su', '-l', $pulseaudio_user, '-c', '/usr/bin/pulseaudio --start'); + } +} + +# start pipewire services for the specified user +sub start_pipewire { + my ($pipewire_user) = @_; + + if ($pipewire_user) { + rooted('/usr/bin/systemctl', '--machine=' . $pipewire_user . '@.host', '--user', 'start', 'pipewire.socket', 'pipewire.service', 'pipewire-pulse.socket', 'pipewire-pulse.service'); + } +} + +# stop wireplumber services for the running user +sub stop_wireplumber { + my ($pipewire_user) = _user_pid('/usr/bin/wireplumber'); + + if ($pipewire_user) { + rooted('/usr/bin/systemctl', '--machine=' . $pipewire_user . '@.host', '--user', 'stop', 'wireplumber.service'); + } + + return $pipewire_user; +} + +# start wireplumber +sub start_wireplumber { + my ($pipewire_user) = @_; + + if ($pipewire_user) { + rooted('/usr/bin/systemctl', '--machine=' . $pipewire_user . '@.host', '--user', 'start', 'wireplumber.service'); + } +} + +# stop pipewire-media-session services for the running user +sub stop_pipewire_media_session { + my ($pipewire_user) = _user_pid('/usr/bin/pipewire-media-session'); + + if ($pipewire_user) { + rooted('/usr/bin/systemctl', '--machine=' . $pipewire_user . '@.host', '--user', 'stop', 'pipewire-media-session.service'); + } + + return $pipewire_user; +} + +# start pipewire-media-session services for the specified user +sub start_pipewire_media_session { + my ($pipewire_user) = @_; + + if ($pipewire_user) { + rooted('/usr/bin/systemctl', '--machine=' . $pipewire_user . '@.host', '--user', 'start', 'pipewire-media-session.service'); + } +} + +sub configure_pipewire_wireplumber { + my ($in) = @_; + my ($pipewire_wp_user); + + # preserve pulseaudio user + my ($pulseaudio_user) = _user_pid('/usr/bin/pulseaudio'); + + # stop pipewire and pipewire-media-session services (if any) before removing any packages + # and preserve pipewire-media-session user + $pipewire_wp_user = stop_pipewire_media_session(); + stop_pipewire(); + + my $plasma_installed = $in->do_pkgs->is_installed('plasma-desktop'); + my @pkgs = ( + 'task-pipewire', + 'wireplumber', + ); + if (!$in->do_pkgs->is_installed('pavucontrol-qt')) { + if ($plasma_installed) { + push(@pkgs, 'pavucontrol-qt'); + } + else { + push(@pkgs, 'pavucontrol'); + } + } + + + my $required_installed = $in->do_pkgs->ensure_are_installed( + \@pkgs + ); + + if (!$required_installed) + { + $in->ask_warn(N("Couldn't install the required packages"), + N("Please check the repositories are correctly configured") + ); + return; + } + + set_pulseaudio(0); + + # first of all disabling what has to be disabled to avoid conflicts + if ($in->do_pkgs->is_installed('pipewire-media-session')) { + rooted('/usr/bin/systemctl', '--global', 'disable', 'pipewire-media-session.service'); + } + + if ($in->do_pkgs->is_installed('pipewire')) { + foreach ('pipewire.socket', 'pipewire.service') { + rooted('/usr/bin/systemctl', '--global', 'enable', $_); + } + } + + if ($in->do_pkgs->is_installed('pipewire-pulseaudio')) { + foreach ('pipewire-pulse.socket', 'pipewire-pulse.service') { + rooted('/usr/bin/systemctl', '--global', 'enable', $_); + } + } + + if ($in->do_pkgs->is_installed('wireplumber')) { + rooted('/usr/bin/systemctl', '--global', 'enable', 'wireplumber.service'); + } + + + # stop pulseaudio process if still floating after the switch + stop_pulseaudio(); + + if ($pulseaudio_user) { + # restart pipewire and wireplumber with the same user as initial pulseaudio + start_pipewire($pulseaudio_user); + start_wireplumber($pulseaudio_user); + } + else { + if ($pipewire_wp_user) { + # restart pipewire and wireplumber with the same user as pipewire-media-session + start_pipewire($pipewire_wp_user); + start_wireplumber($pipewire_wp_user); + } + } + + #Plasma tricks + if ($plasma_installed) { + $in->do_pkgs->ensure_is_installed('kpipewire'); + } +} + +sub configure_pipewire_media_session { + my ($in) = @_; + my ($pipewire_ms_user); + + # preserve pulseaudio user + my ($pulseaudio_user) = _user_pid('/usr/bin/pulseaudio'); + + # stop pipewire and wireplumber services (if any) before removing any package + # and preserve wireplumber user + $pipewire_ms_user = stop_wireplumber(); + stop_pipewire(); + + + my $plasma_installed = $in->do_pkgs->is_installed('plasma-desktop'); + my @pkgs = ( + 'task-pipewire', + 'pipewire-media-session', + ); + if (!$in->do_pkgs->is_installed('pavucontrol-qt')) { + if ($plasma_installed) { + push(@pkgs, 'pavucontrol-qt'); + } + else { + push(@pkgs, 'pavucontrol'); + } + } + + my $required_installed = $in->do_pkgs->ensure_are_installed( + \@pkgs + ); + + if (!$required_installed) + { + $in->ask_warn(N("Couldn't install the required packages"), + N("Please check the repositories are correctly configured") + ); + return; + } + + set_pulseaudio(0); + + # first of all disabling what has to be disabled to avoid conflicts + if ($in->do_pkgs->is_installed('wireplumber')) { + rooted('/usr/bin/systemctl', '--global', 'disable', 'wireplumber.service'); + } + + if ($in->do_pkgs->is_installed('pipewire')) { + foreach ('pipewire.socket', 'pipewire.service') { + rooted('/usr/bin/systemctl', '--global', 'enable', $_); + } + } + + if ($in->do_pkgs->is_installed('pipewire-pulseaudio')) { + foreach ('pipewire-pulse.socket', 'pipewire-pulse.service') { + rooted('/usr/bin/systemctl', '--global', 'enable', $_); + } + } + + if ($in->do_pkgs->is_installed('pipewire-media-session')) { + rooted('/usr/bin/systemctl', '--global', 'enable', 'pipewire-media-session.service'); + } + + # stop pulseaudio process if still floating after the switch + stop_pulseaudio(); + + if ($pulseaudio_user) { + # restart pipewire and wireplumber with the same user as initial pulseaudio + start_pipewire($pulseaudio_user); + start_pipewire_media_session($pulseaudio_user); + } + else { + if ($pipewire_ms_user) { + # restart pipewire and wireplumber with the same user as pipewire-media-session + start_pipewire($pipewire_ms_user); + start_pipewire_media_session($pipewire_ms_user); + } + } + + #Plasma tricks + if ($plasma_installed) { + $in->do_pkgs->ensure_is_installed('kpipewire'); + } } -sub get_alternative { - my ($driver) = @_; - $alsa2oss{$driver} || $oss2alsa{$driver}; +sub disable_all_pipewire { + my ($in) = @_; + + if ($in->do_pkgs->is_installed('wireplumber')) { + rooted('/usr/bin/systemctl', '--global', 'disable', 'wireplumber.service'); + } + + if ($in->do_pkgs->is_installed('pipewire-media-session')) { + rooted('/usr/bin/systemctl', '--global', 'disable', 'pipewire-media-session.service'); + } + + if ($in->do_pkgs->is_installed('pipewire-pulseaudio')) { + foreach ('pipewire-pulse.socket', 'pipewire-pulse.service') { + rooted('/usr/bin/systemctl', '--global', 'disable', $_); + } + } + + if ($in->do_pkgs->is_installed('pipewire')) { + foreach ('pipewire.socket', 'pipewire.service') { + rooted('/usr/bin/systemctl', '--global', 'disable', $_); + } + } } -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); - $modules_conf->set_sound_slot("sound-slot-$index", $new_driver); - $modules_conf->write; - if ($new_driver =~ /^snd-/) { # new driver is an alsa one - $in->do_pkgs->ensure_binary_is_installed('alsa-utils', 'alsactl'); - 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 configure_pulseaudio { + my ($in) = @_; + + # preserve pipewire running user + my ($pipewire_user) = _user_pid('/usr/bin/pipewire'); + + # stop pipewire, wireplumber and pipewire-media-session services (if any) before removing any packages + my ($wireplumber_user) = stop_wireplumber(); + my ($pipewire_media_session_user) = stop_pipewire_media_session(); + my ($pipewire_user_preserve) = stop_pipewire(); + + # now packages + $in->do_pkgs->remove('pipewire-alsa'); + + my $plasma_installed = $in->do_pkgs->is_installed('plasma-desktop'); + my @pkgs = 'task-pulseaudio'; + if (!$in->do_pkgs->is_installed('pavucontrol-qt')) { + if ($plasma_installed) { + push(@pkgs, 'pavucontrol-qt'); + } + else { + push(@pkgs, 'pavucontrol'); + } + } + + my $required_installed = $in->do_pkgs->ensure_are_installed( + \@pkgs + ); + + if (!$required_installed) + { + $in->ask_warn(N("Couldn't install the required packages"), + N("Please check the repositories are correctly configured") + ); + + # restore previous pipewire (if any) processes if something goes wrong with pulseaudio installation + if ($pipewire_user_preserve) { + start_pipewire($pipewire_user_preserve); + } + + if ($wireplumber_user) { + start_wireplumber($wireplumber_user); + } + + if ($pipewire_media_session_user) { + start_pipewire_media_session($pipewire_media_session_user); + } + + return; + } + + + # disable all the pipewire stuff before managing packages + disable_all_pipewire($in); + + # start pulseaudio with same pipewire preserved user + if ($pipewire_user) { + start_pulseaudio($pipewire_user); + } } -sub switch { +sub config { my ($in, $modules_conf, $device) = @_; my $driver = $device->{current_driver} || $device->{driver}; - foreach (@blacklist) { $blacklisted = 1 if $driver eq $_ } - my @alternative = @{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; + my @alternative = $driver ne $device->{driver} ? $device->{driver} : (); + if ($driver eq "unknown") { + $in->ask_warn(N("No known driver"), + N("There's no known driver for your sound card (%s)", + $device->{description})); + } else { push @alternative, $driver; my %des = modules::category2modules_and_description('multimedia/sound'); + + my $is_pulseaudio_enabled_val = is_pulseaudio_enabled($in); + my $is_pulseaudio_glitchfree_enabled_val = is_pulseaudio_glitchfree_enabled(); + + my $audiosystem = 'None'; + if ($is_pulseaudio_enabled_val && $is_pulseaudio_glitchfree_enabled_val) { + $audiosystem = 'PulseAudioGF'; + } elsif ($is_pulseaudio_enabled_val) { + $audiosystem = 'PulseAudio'; + } elsif (is_pipewire_wireplumber_enabled($in) || _pidof('/usr/bin/wireplumber')) { + $audiosystem = 'PipeWireWP'; + } elsif (is_pipewire_media_session_enabled($in) || _pidof('/usr/bin/pipewire-media-session')) { + $audiosystem = 'PipeWireMS'; + } + + my $write_config = sub { + if ($audiosystem eq 'None') { + #### ALSA alone + disable_all_pipewire($in); + set_pulseaudio(0); + set_pulseaudio_glitchfree(0); + # TODO check if adding autospawn = no to /etc/pulse/client.conf is needed + } elsif ($audiosystem eq 'PulseAudio') { + #### PulseAudio + configure_pulseaudio($in); + set_pulseaudio(1); + set_pulseaudio_glitchfree(0); + my $lib = get_libdir(); + $in->do_pkgs->ensure_is_installed($lib . 'alsa-plugins-pulseaudio', + '/usr/' . $lib . '/alsa-lib/libasound_module_pcm_pulse.so'); + } elsif ($audiosystem eq 'PulseAudioGF') { + #### PulseAudio with Glitch-Free mode + configure_pulseaudio($in); + set_pulseaudio(1); + set_pulseaudio_glitchfree(1); + my $lib = get_libdir(); + $in->do_pkgs->ensure_is_installed($lib . 'alsa-plugins-pulseaudio', + '/usr/' . $lib . '/alsa-lib/libasound_module_pcm_pulse.so'); + } elsif ($audiosystem eq 'PipeWireWP') { + #### PipeWire with WirePlumber + configure_pipewire_wireplumber($in); + } elsif ($audiosystem eq 'PipeWireMS') { + #### PipeWire with PipeWire Media Session + configure_pipewire_media_session($in); + } else { + #### Unmanaged value + #TODO Error here + } + + $in->ask_warn('', N("You need to reboot for changes to take effect")) if $::isStandalone; + + }; + + my $warn_both = ($in->do_pkgs->is_installed('pipewire') && $in->do_pkgs->is_installed('pulseaudio') && (-e $::prefix . '/etc/systemd/user/sockets.target.wants/pipewire.socket' || -e $::prefix . '/etc/systemd/user/sockets.target.wants/pipewire.service')) ? + N("Warning: both pulseaudio and pipewire are installed and can conflict each other. Please fix your config by applying a choice") : + ""; + + my $is_pipewire_available = $in->do_pkgs->is_available('task-pipewire'); + my $warn_pipewire_unavailable = !$is_pipewire_available ? + N("Warning: task-pipewire is not available in any media sources, so only pulseaudio could be set up. Please fix your repo configuration.") : + ""; - if ($new_driver eq 'unknown') { - $in->ask_from(N("No alternative driver"), - N("There's no known OSS/ALSA alternative driver for your sound card (%s) which currently uses \"%s\"", - $device->{description}, $driver), - [ - get_any_driver_entry($in, $modules_conf, $driver, $device), - ] - ); + my @service_list = ( + 'None', + 'PulseAudio', + 'PulseAudioGF', + ); + if ($is_pipewire_available) { + push @service_list, 'PipeWireWP'; + push @service_list, 'PipeWireMS'; + } + my @common = ( + { + label => N("Select the sound server"), + title => 1, + }, + { + val => \$audiosystem, + list => \@service_list, + format => sub { + my ($choice) = @_; + +{ + 'None' => N("None"), + 'PulseAudio' => N("PulseAudio"), + 'PulseAudioGF' => N("PulseAudio with Glitch-Free mode"), + 'PipeWireWP' => N("PipeWire with WirePlumber"), + 'PipeWireMS' => N("PipeWire with PipeWire Media Session"), + }->{$choice}; + }, + type => 'list', + }, + { + advanced => 1, + val => N("Reset sound mixer to default values"), + clicked => sub { run_program::run('reset_sound') } + }, + { + val => N("Troubleshooting"), disabled => sub {}, + clicked => sub { &trouble($in) } + }, + ); + + my @messages = ("<b><i>" . $device->{description} . "</i></b>", + N("Your card uses the <b>\"%s\"</b> driver\n", $driver)); + + if ($warn_both) { + push @messages, ("<b>" . $warn_both . "</b>"); + } + if (!$is_pipewire_available) { + push @messages, "<b>" . $warn_pipewire_unavailable . "</b>"; + } + if ($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 use the %s\"%s\" driver (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. -"); - }, + interactive_help_id => 'soundConfig', + messages => \@messages }, - [ - { - label => N("Driver:"), val => \$new_driver, list => \@alternative, default => $new_driver, sort =>1, - help => join("\n\n", map { qq("$_": ) . $des{$_} } @alternative), - allow_empty_list => 1, - }, - { - val => N("Trouble shooting"), disabled => sub {}, - clicked => sub { &trouble($in) } - }, - get_any_driver_entry($in, $modules_conf, $driver, $device), - ])) + \@common, + )) { - 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; + $write_config->(); } - } 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) ]); - } else { - $in->ask_warn(N("Unknown driver"), - N("Error: The \"%s\" driver for your sound card is unlisted", - $driver)); } - end: } -sub config { - my ($in, $modules_conf, $device) = @_; - switch($in, $modules_conf, $device); -} - - sub trouble { my ($in) = @_; - $in->ask_warn(N("Sound trouble shooting"), + $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: + N("Below are some basic tips to help debug audio problems, but for accurate and up-to-date tips and tricks, please see: + +https://wiki.mageia.org/en/Support:DebuggingSoundProblems + + + +- General Recommendation: Enable PulseAudio. If you have opted to not to use PulseAudio, we would strongly advise you enable it. For the vast majority of desktop use cases, PulseAudio is the recommended and best supported option. + + + +- \"kmix\" (KDE), \"gnome-control-center sound\" (GNOME) and \"pavucontrol\" (generic) will launch graphical applications to allow you to view your sound devices and adjust volume levels + +- \"ps aux | grep pulseaudio\" will check that PulseAudio is running. -- \"lspcidrake -v | fgrep AUDIO\" will tell you which driver your card uses -by default -- \"grep sound-slot /etc/modules.conf\" will tell you what driver it -currently uses +- \"pactl stat\" will check that you can connect to the PulseAudio daemon correctly. -- \"/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're configured to be run on -initlevel 3 +- \"pactl list sink-inputs\" will tell you which programs are currently playing sound via PulseAudio. -- \"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. +- \"systemctl status osspd.service\" will tell you the current state of the OSS Proxy Daemon. This is used to enable sound from legacy applications which use the OSS sound API. You should install the \"ossp\" package if you need this functionality. + + +- \"pacmd ls\" will give you a LOT of debug information about the current state of your audio. + + +- \"lspcidrake -v | grep -i audio\" will tell you which low-level driver your card uses by default. + + +- \"/usr/sbin/lsmod | grep snd\" will enable you to check which sound related kernel modules (drivers) are loaded. + + +- \"alsamixer -c 0\" will give you a text-based mixer to the low level ALSA mixer controls for first sound card + + +- \"/usr/sbin/fuser -v /dev/snd/pcm* /dev/dsp\" will tell which programs are currently using the sound card directly (normally this should only show PulseAudio) "))); } -sub get_any_driver_entry { - my ($in, $modules_conf, $driver, $device) = @_; - return () if $::isInstall; - +{ - 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 in 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(); } - 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})) { + if (!member($default_driver, $_->{driver})) { $altered ||= $default_driver; - $modules_conf->set_sound_slot("sound-slot-$::i", $_->{driver}); + configure_one_sound_slot($modules_conf, $::i, $_->{driver}); } } detect_devices::getSoundDevices(); $modules_conf->write if $altered && $::isStandalone; diff --git a/perl-install/harddrake/v4l.pm b/perl-install/harddrake/v4l.pm index aa005b664..bd7c649bb 100644 --- a/perl-install/harddrake/v4l.pm +++ b/perl-install/harddrake/v4l.pm @@ -3,9 +3,7 @@ package harddrake::v4l; use strict; use common; -use interactive; use detect_devices; -use lang; use log; use modules; @@ -47,7 +45,7 @@ my %tuners_lst = 28 => "LG|PAL_BG+FM (TPI8PSB01D)", 29 => "LG|PAL_BG (TPI8PSB11D)", 30 => "Temic|PAL* auto + FM (4009 FN5)", - 31 => "SHARP|NTSC_JP (2U5JF5540)", + 31 => "SHARP NTSC_JP (2U5JF5540)", 32 => "Samsung|PAL TCPM9091PD27", 33 => "MT20xx universal", 34 => "Temic|PAL_BG (4106 FH5)", @@ -62,6 +60,33 @@ my %tuners_lst = 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", + ); @@ -75,27 +100,27 @@ my $cards_lst = { "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, + "D|Diamond DTV2000" => 5, "A|AVerMedia|TVPhone" => 6, - "M|MATRIX-Vision|MV-Delta" => 7, + "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, + "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, - "Z|Zoltrix|TV-Max" => 15, + "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, + "C|CEI Raffles Card" => 20, "L|Lifeview|FlyVideo 98" => 21, - "L|Lucky Star|Image World ConferenceTV LR50" => 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, @@ -105,13 +130,13 @@ my $cards_lst = { N("Unknown|CPH05X (bt878) [many vendors]") => 24, N("Unknown|CPH06X (bt878) [many vendors]") => 24, "T|Terratec|Terra TV+ Version 1.0 (Bt848)" => 25, - "Vobis|TV-Boostar" => 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, + "I|Imagenation PXC200" => 29, "L|Lifeview|FlyVideo 98 LR50" => 30, "Formac|iProTV" => 31, "Formac|iProTV I (bt848)" => 31, @@ -121,7 +146,7 @@ my $cards_lst = { "L|Leadtek|WinFast TV 2000" => 34, "L|Leadtek|WinFast VC 100" => 35, "L|Lifeview|FlyVideo 98 LR50" => 35, - "C|Chronos|Video Shuttle II" => 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, @@ -131,19 +156,19 @@ my $cards_lst = { "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, - "Z|Zoltrix|Genie TV/FM" => 46, + "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, + "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, + "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, @@ -164,7 +189,7 @@ my $cards_lst = { "A|Askey|CPH061" => 62, "Bestbuy|Easy TV (bt878)" => 62, "L|Lifetec|LT9306" => 62, - "M|Medion|MD9306" => 62, + "M|Medion MD9306" => 62, "A|ATI|TV-Wonder" => 63, "A|ATI|TV-Wonder VE" => 64, "L|Lifeview|FlyVideo 2000S LR90" => 65, @@ -178,95 +203,233 @@ my $cards_lst = { # "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, + "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, + "C|Canopus WinDVR PCI (COMPAQ Presario 3524JP, 5112JP)" => 76, "G|GrandTec|Multi Capture Card (Bt878)" => 77, - "Jetway|TV/Capture JW-TV878-FBK" => 78, - "Kworld|KW-TV878RF" => 78, - "D|DSP Design|TCVIDEO" => 79, + "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, - "O|Osprey|100/150 (878)" => 82, - "O|Osprey|100/150 (848)" => 83, - "O|Osprey|101 (848)" => 84, - "O|Osprey|101/151" => 85, - "O|Osprey|101/151 w/ svid" => 86, - "O|Osprey|200/201/250/251" => 87, - "O|Osprey|200/250" => 88, - "O|Osprey|210/220" => 89, - "O|Osprey|500" => 90, - "O|Osprey|540" => 91, - "O|Osprey|2000" => 92, - "I|IDS|Eagle" => 93, + "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|Grand X-Guard / Trust 814PCI" => 103, - "N|Nebula Electronics|DigiTV" => 104, + "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, + "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, + "T|Teppro TEV-560/InterVision IV-560" => 115, + "S|SIMUS GVC1100" => 116, + "N|NGS NGSTV+" => 117, "L|LMLBT4" => 118, - "T|Tekram|M205 PRO" => 119, + "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, + "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/KuroutoShikou SAA7130-TVPCI" => 10, + "Kworld|SAA7130-TVPCI" => 10, + "KuroutoShikou SAA7130-TVPCI" => 10, "Terratec|Cinergy 600 TV" => 11, "Medion|7134" => 12, - "ELSA|EX-VISION 300TV" => 13, - "ELSA|EX-VISION 500TV" => 14, - "ASUS|TV-FM 7134" => 15, - "AOPEN|VA1000 POWER" => 16, - "10MOONS PCI TV CAPTURE CARD" => 17, + "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, - "Medion|2819" => 21, - "BMK|MPEX Tuner" => 22, - "Medion|2819 / AverMedia M156" => 23, - "AVerMedia|M156" => 23, - "BMK|MPEX Tuner alternative" => 24, + "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" => 27, - "Manli|MuchTV M-TV001" => 28, + "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, + "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, + } }; @@ -286,6 +449,7 @@ sub config { 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; @@ -302,30 +466,24 @@ sub config { $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}}; - $conf{pll} = -1 if !defined $pll_lst{$conf{tuner}}; - $conf{radio} = 0 if $conf{radio} !~ /(0|1)/; + 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."), +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 ], type => 'combo', default => -1, sort =>1, separator => '|' }, + { 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 => '|' }, - { label => N("Number of capture buffers:"), val => \$conf{gbuffers}, min => $min_gbuffers, max => $max_gbuffers, sort => 1, default => 0, type => 'range', advanced => 1, help => N("number of capture buffers for mmap'ed capture") }, - if_($driver eq 'bttv', - { label => N("PLL setting:"), val => \$conf{pll}, list => [keys %pll_lst], format => sub { $pll_lst{$_[0]} }, sort => 1, default => 0, advanced =>1 }, - { label => N("Radio support:"), val => \$conf{radio}, type => "bool", text => N("enable radio support") }), ] )) { $conf{card} = $cards_list{$conf{card}}; - - my $options = - 'radio=' . ($conf{radio} ? 1 : 0) . ' ' . - join(' ', map { if_($conf{$_} ne -1, "$_=$conf{$_}") } qw(card pll tuner gbuffers)); - if ($options) { + 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; +# log::explanations("modified file /etc/modprobe.conf ($options)") if $::isStandalone; $modules_conf->set_options($driver, $options); } return 1; |