mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Fix glob for serial device names
Removing the "." that was in {,.[0-9]} allows it to match /dev/cuau10 and onward.
I added lots of comments on the glob expression, because the format of the glob expression is not the same as an ordinary regex.
This commit is contained in:
parent
57945fccf3
commit
36f90078fb
@ -442,7 +442,12 @@ $types = array("select" => gettext("Select"), "ppp" => "PPP", "pppoe" => "PPPoE"
|
||||
if (!is_dir("/var/spool/lock"))
|
||||
mwexec("/bin/mkdir -p /var/spool/lock");
|
||||
// $serialports = pfSense_get_modem_devices();
|
||||
$serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE);
|
||||
// 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);
|
||||
$serport_count = 0;
|
||||
foreach ($serialports as $port) {
|
||||
$serport_count++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user