Menu

#3 unloading of wlan module does not work correctly

open
nobody
None
5
2005-03-30
2005-03-30
msteamix
No

Hello Matthew,

as of wlan-ui 0.4 unloading the WLAN module
does not work correctly.

wlan-ui handles the two cases

1) loading the module
2) unloading the module

exactly the same which doesn't work as it uses the
same checks whether the action is necessary and
whether it has been successful. This checks only
works for loading the module.

I solved this by replacing:

# load / unload if needed; return undef or error
string if error
sub wlan_mod {
my ($cmd_key, $module, $cmds) = @_;
my ($res);

return undef unless $module;

if (`$cmds->{lsmod}` !~ /$module/g) {
$res = `$cmds->{$cmd_key}`;
return "$res: could not $cmd_key $module"
if (`$cmds->{lsmod}` !~ /$module/g);
}
return undef;
}

with

# load / unload if needed; return undef or error
string if error
sub wlan_mod {
my ($cmd_key, $module, $cmds) = @_;
my ($res);

return undef unless $module;

# Teamix: added different handling for load and
unload cases as otherwise the lsmod related if
statements do not work out
if ($cmd_key =~ "load") {
if (`$cmds->{lsmod}` !~ /$module/g) {
$res = `$cmds->{$cmd_key}`;
print STDERR `$cmds->{$cmd_key}`;
return "$res: could not $cmd_key
$module"
if (`$cmds->{lsmod}` !~ /$module/g);
}
}
if ($cmd_key =~ "unload") {
if (`$cmds->{lsmod}` =~ /$module/g) {
$res = `$cmds->{$cmd_key}`;
print STDERR `$cmds->{$cmd_key}`;
return "$res: could not $cmd_key
$module"
if (`$cmds->{lsmod}` =~ /$module/g);
}
}
return undef;
}

Since I do not have that much Perl experience
there might be a more efficient or elegant bug
fix ;-).

Regards,
Martin Steigerwald - team(ix) GmbH -
http://www.teamix.de

Discussion


Log in to post a comment.