summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-07-16 10:52:28 +0545
committerRenato Botelho <renato@netgate.com>2015-07-16 16:03:02 -0300
commit3eed76d729a8c5bbd45637157fd0170df67ec739 (patch)
treeffa90892af4733233d1bd3f4f2768cfb7296e4b4
parent31ae45d2535e73f58b307f18227ba29a9061d2af (diff)
downloadpfsense-3eed76d729a8c5bbd45637157fd0170df67ec739.zip
pfsense-3eed76d729a8c5bbd45637157fd0170df67ec739.tar.gz
Make serial ports glob cope with many more possibilities
It originally coped with things like cuau1 cuau1.1 Then I made it cope with things like cuau1 cuau11 but it stopped working for cuau1.1 This one copes with: cuau1 cuau1.1 cuau1.11 cuau11 cuau11.1 cuau11.11 That should allow for all sorts of reasonable device name files without matching other stuff in /dev (like cuau1.init cuau1.lock) that we need to ignore. Please think if I have covered the bases here.
-rw-r--r--usr/local/www/interfaces_ppps_edit.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php
index 77bc825..860b4a3 100644
--- a/usr/local/www/interfaces_ppps_edit.php
+++ b/usr/local/www/interfaces_ppps_edit.php
@@ -451,9 +451,9 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
// Match files in /dev starting with "cua" then:
// ? = any single character e.g. like "cuau"
// [0-9] = a digit from 0 to 9
- // {,[0-9]} = nothing (the empty before the comma) or a digit from 0 to 9
- // This supports up to 100 devices (0 to 99), e.g. cuau0 cuau1 ... cuau10 cuau11 ... cuau99
- $serialports = glob("/dev/cua?[0-9]{,[0-9]}", GLOB_BRACE);
+ // stuff in {} = the various possible digit and dot combinations to allow an optional 2nd digit, dot, followed by 1 or 2 optional digits
+ // This supports up to 100 devices (0 to 99), e.g. cuau0 cuau1 ... cuau10 cuau11 ... cuau99 and also possibilities like cuau1.1 cuau1.11 cuau11.1 cuau11.11
+ $serialports = glob("/dev/cua?[0-9]{,.[0-9],.[0-9][0-9],[0-9],[0-9].[0-9],[0-9].[0-9][0-9]}", GLOB_BRACE);
$serport_count = 0;
foreach ($serialports as $port) {
$serport_count++;
OpenPOWER on IntegriCloud