X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=config%2Fcfgroot%2Fgeneral-functions.pl;fp=config%2Fcfgroot%2Fgeneral-functions.pl;h=41643d8d7451c25aebda2475600b0f9c170845a4;hp=fbca601e4a62e2e31febfe24f66128b16d4335e4;hb=3e862ce4f99059002b60994addc87a013d298b38;hpb=5ced384b719877abfe0c78d9345a645f4531e38a diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index fbca601e4..41643d8d7 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1008,6 +1008,28 @@ sub MakeUserAgent() { return $user_agent; } +sub RedIsWireless() { + # This function checks if a network device is a wireless device. + + my %settings = (); + &readhash("${General::swroot}/ethernet/settings", \%settings); + + # Find the name of the network device. + my $device = $settings{'RED_DEV'}; + + # Exit, if no device is configured. + return 0 if ($device eq ""); + + # Return 1 if the device is a wireless one. + my $path = "/sys/class/net/$device/wireless"; + if (-d $path) { + return 1; + } + + # Otherwise return zero. + return 0; +} + # Function to read a file with UTF-8 charset. sub read_file_utf8 ($) { my ($file) = @_; @@ -1017,7 +1039,7 @@ sub read_file_utf8 ($) { my $all = <$in>; close $in; - return $all; + return $all; } # Function to write a file with UTF-8 charset.