X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=config%2Fcfgroot%2Fgeneral-functions.pl;h=3cdb36fbd4709229edd93b2f39893a145a17425f;hp=90eacbdb011487e2f4af8e60eb8cc42e249f3620;hb=57097305a610383d013c87ef32ae117c18846e46;hpb=b63dc827f21fa617246ec0aa1d8a690f46b4f58e;ds=sidebyside diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 90eacbdb0..3cdb36fbd 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1008,4 +1008,26 @@ 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; +} + 1;