summaryrefslogtreecommitdiffstats
path: root/lib/network/rfswitch.pm
diff options
context:
space:
mode:
authorNicolas Lécureuil <nlecureuil@mandriva.com>2011-08-30 13:16:42 +0000
committerNicolas Lécureuil <nlecureuil@mandriva.com>2011-08-30 13:16:42 +0000
commitc590a4a7c162d1a81dbf02ca2e174384af0385bb (patch)
tree7e1279550b8e48add99b7b41281d27d249d279f3 /lib/network/rfswitch.pm
parent39d2ee13572a6dc634c0c454dfc43e0297483279 (diff)
downloaddrakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar
drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.gz
drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.bz2
drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.tar.xz
drakx-net-c590a4a7c162d1a81dbf02ca2e174384af0385bb.zip
Create 2010.1 branch for drakx-net
Diffstat (limited to 'lib/network/rfswitch.pm')
-rw-r--r--lib/network/rfswitch.pm38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/network/rfswitch.pm b/lib/network/rfswitch.pm
new file mode 100644
index 0000000..4617990
--- /dev/null
+++ b/lib/network/rfswitch.pm
@@ -0,0 +1,38 @@
+package network::rfswitch;
+
+use strict;
+use MDK::Common;
+use detect_devices;
+
+my $conf_file = "/etc/modprobe.d/rfswitch.conf";
+
+my @settings = (
+ {
+ match => sub {
+ # CL56, with buggy BIOS
+ detect_devices::dmidecode_category('BIOS')->{Vendor} eq 'COMPAL' &&
+ detect_devices::dmidecode_category('System')->{'Product Name'} eq '<BAD INDEX>';
+ },
+ module => 'acerhk',
+ options => 'usedritek=1 autowlan=1 force_series=290',
+ install => 'echo 1 > /proc/driver/acerhk/wirelessled',
+ remove => 'echo 0 > /proc/driver/acerhk/wirelessled',
+ },
+);
+
+sub configure() {
+ my $setting = find { $_->{match}->() } @settings;
+ if ($setting) {
+ output_p($::prefix . $conf_file,
+ join("\n",
+ if_($setting->{options}, "options $setting->{module} $setting->{options}"),
+ if_($setting->{install}, "install $setting->{module} /sbin/modprobe --first-time --ignore-install $setting->{module} && $setting->{install}"),
+ if_($setting->{remove}, "remove $setting->{module} $setting->{remove}; /sbin/modprobe -r --ignore-remove $setting->{module}"),
+ "",
+ ));
+ require modules;
+ modules::set_preload_modules('rfswitch', $setting->{module});
+ }
+}
+
+1;