Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6112cf5
initial commit to add scripts/paths
Jul 16, 2026
4f050a2
fix syntax, add fan setup
Jul 16, 2026
87d9bc1
fixed missing space
Jul 16, 2026
ec1600d
added hw info widget; working on fan control page
brandontolbird Jul 22, 2026
5af62c0
more work on fan control; re-add ichsmb to init script
brandontolbird Jul 26, 2026
7ec2d68
Merge branch 'opnsense:master' into sysutils/vep-hw
brandontolbird Jul 27, 2026
d4f1446
fix formatting issues and execute permissions
brandontolbird Jul 27, 2026
cb02945
fix function name
brandontolbird Jul 27, 2026
fb5b364
fix base class of sc; fix typos
brandontolbird Jul 27, 2026
baf4f10
add temp to widget; fix backend return to avoid warning message
brandontolbird Jul 27, 2026
b48ae76
more widget tweaking
brandontolbird Jul 27, 2026
d96d93c
more widget tweaking
brandontolbird Jul 27, 2026
a740d04
more widget tweaking
brandontolbird Jul 27, 2026
6d60bae
more widget tweaking
brandontolbird Jul 27, 2026
00e4095
more widget tweaking
brandontolbird Jul 27, 2026
7cd73e5
more widget tweaking
brandontolbird Jul 27, 2026
fbe3235
even more widget tweaking
brandontolbird Jul 28, 2026
8f1f271
added LED controls and fan control mode switch; more backend scripts
brandontolbird Jul 28, 2026
8ad309d
more backend work for LEDs and board id
brandontolbird Jul 28, 2026
d94db2a
fixed php namespace; changed widget base class
brandontolbird Jul 31, 2026
06e04cd
fixed widget code; added code to ignore fan settings in backend
brandontolbird Jul 31, 2026
ec8a45c
fixed widget code
brandontolbird Jul 31, 2026
61eeb4e
add units to widget display
brandontolbird Jul 31, 2026
f3bcf74
fix spacing issues
brandontolbird Jul 31, 2026
3058103
fix spacing and remove unneeded punctuation
brandontolbird Jul 31, 2026
d13c4c9
added start action to service controller
brandontolbird Aug 5, 2026
6d340c2
Merge branch 'opnsense:master' into sysutils/vep-hw
brandontolbird Aug 10, 2026
e375678
start renaming files; add template to restore settings on startup
Aug 10, 2026
dd76b9c
fixed typos; added back actual service reload logic
brandontolbird Aug 10, 2026
aa3e9d2
renamed paths and classes to vep1400 to clarify use-case
brandontolbird Aug 14, 2026
1e09f0b
missed changing a reference/name
brandontolbird Aug 14, 2026
9a62a17
Merge branch 'opnsense:master' into sysutils/vep1400-hw
brandontolbird Aug 14, 2026
813df68
added etherswitch dev node check to init script
brandontolbird Aug 14, 2026
3c904e2
Delete sysutils/vep1400-hw/nbproject directory
brandontolbird Aug 15, 2026
1aeeadb
fixed script paths in post_install scripts
brandontolbird Aug 15, 2026
a260bca
rename init script to follow recommendations; add configd restart to …
brandontolbird Aug 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sysutils/vep1400-hw/+POST_INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/usr/local/etc/rc.syshook.d/early/50-vep1400-init
/usr/local/etc/rc.syshook.d/start/99-vep1400-init-complete
/usr/local/etc/rc.configure_plugins POST_INSTALL
service configd restart
8 changes: 8 additions & 0 deletions sysutils/vep1400-hw/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PLUGIN_NAME= vep1400-hw
PLUGIN_VERSION= 1.1
PLUGIN_REVISION= 1
PLUGIN_COMMENT= Dell EMC VEP1400 initialization scripts
PLUGIN_MAINTAINER= brandontolbird@proton.me
PLUGIN_TIER= 2

.include "../../Mk/plugins.mk"
2 changes: 2 additions & 0 deletions sysutils/vep1400-hw/pkg-descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This includes a couple of rc.syshook scripts to handle setting up
the various interfaces and chips on a Dell VEP1400 board.
60 changes: 60 additions & 0 deletions sysutils/vep1400-hw/src/etc/rc.syshook.d/early/50-vep1400-init
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

#ichsmb has to load first, so that ismt is at /dev/smb1 (or adjust the script)
needed_klds="ichsmb ismt smb"

kldload $needed_klds &> /dev/null
sleep 1

ismt_dev=/dev/smb1

board_id=$(smbmsg -f $ismt_dev -s 0x62 -c 0x00 -i 1 | cut -c 4-5)

if [ ! -z $board_id ]; then

# Disable PIC Watch Dog
smbmsg -f $ismt_dev -s 0x44 -c 0 -o 1 0
# Set PIC Watch Dog default count to 0 (offset 0x0=LSB; 0x1=MSB)
smbmsg -f $ismt_dev -s 0x48 -c 0x0 -o 1 0x0
sleep 1
smbmsg -f $ismt_dev -s 0x48 -c 0x1 -o 1 0x0



if [ x"$board_id" = x"8" ] || [ x"$board_id" = x"a" ] || [ x"$board_id" = x"b" ]; then
logger -t "vep1400-hw" "VEP1400-X detected, doing init"
# VEP1400-X stuff
# fetch board type
# smbmsg -f $ismt_dev -s 0x62 -c 0x00 -i 1 | cut -c 4-5
# if 8, 10(a) or 11(b), do the following
# i2cset -y 1 0x31 0x1 0xff

#enable the i350 GbE ports
smbmsg -f $ismt_dev -s 0x62 -c 0x01 -o 1 0xff

# more VEP1400-x stuff
# Communicate with CPLD/FPGA to turn off SFP TX disable (DAC cables aren't affected by this)
# for ix1
smbmsg -f $ismt_dev -s 0x62 -c 0x10 -o 1 0x07
# for ix0
smbmsg -f $ismt_dev -s 0x62 -c 0x11 -o 1 0x07
fi

if [ x"$board_id" = x"0" ]; then
logger -t "vep1400-hw" "VEP1400 detected, doing init"
#Communicate with CPLD/FPGA to turn off SFP TX disable (DAC cables aren't affected by this)
# for ix3
smbmsg -f $ismt_dev -s 0x62 -c 0x10 -o 1 0
# for ix2
smbmsg -f $ismt_dev -s 0x62 -c 0x11 -o 1 0
if [ -e /dev/etherswitch0 ]; then
etherswitchcfg config vlan_mode dot1q
etherswitchcfg port1 pvid 2 port2 pvid 2 port3 pvid 2 port4 pvid 2 port5 pvid 2 port6 pvid 3 port9 pvid 3 port10 pvid 2 vlangroup0 vlan 2 members 1,2,3,4,5,10 vlangroup1 vlan 3 members 6,9
echo "Marvell 88E6190 configured. LAN ports are 1-5 and are connected to ix0. WAN is on port 6 and is connected to ix1."
logger -t "vep1400-hw" "Marvell 88E6190 configured. LAN is on ports 1-5 and is connected to ix0. WAN is on port 6 and is connected to ix1."
else
logger -t "vep1400-hw" "VEP1400 detected, but no etherswitch dev found. Is patched kernel installed?"
fi
fi
fi

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

board_id=$(smbmsg -f /dev/smb1 -s 0x62 -c 0x00 -i 1 | cut -c 4-5)
conf_file=/usr/local/etc/vep1400/vep1400.conf

if [ -f $conf_file ]; then
. $conf_file
else
RED=0x00
GREEN=0xff
BLUE=0x00
FANCONTROL=0
FANDUTY=0
fi

if [ -z "$RED" ]; then
RED=0x00
GREEN=0xff
BLUE=0x00
FANCONTROL=0
FANDUTY=0
fi

if [ ! -z "$board_id" ]; then
# set front LED to green (or custom color if settings have been saved)
# format is -c (red) -o 2 (green) (blue) (some models lack a blue led)
smbmsg -f /dev/smb1 -s 0x40 -c $RED -o 2 $GREEN $BLUE

if [ x"$board_id" != x"0" ] && [ x"$board_id" != x"1" ]; then
# set fan speed. At address 36 is a TC654
# set control register to allow SMBus control of duty cycle
if [ "$FANCONTROL" == "0" ]; then
smbmsg -f $ismt_dev -s 0x36 -c 0x04 -o 1 0x14
elif [ "$FANCONTROL" == "1" ]; then
smbmsg -f $ismt_dev -s 0x36 -c 0x04 -o 1 0x34
# set duty cycle, range is 0x00 to 0x0f
# 0x0d is 90.67% duty cycle per datasheet
smbmsg -f $ismt_dev -s 0x36 -c 0x06 -o 1 $FANDUTY
fi
fi
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/*
* Copyright (C) 2023 Deciso B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\vep1400hw\Api;

use OPNsense\Base\ApiControllerBase;
use OPNsense\Core\Backend;

class InfoController extends ApiControllerBase
{
public function fanStatusAction()
{
$result = ["status" => "failed"];
$status = parse_ini_string((new Backend())->configdRun('vep1400hw getfan'));

if (!empty($status)) {
$result["status"] = "OK";
$result = array_merge($result, $status);
}

return $result;
}

public function tempStatusAction()
{
$result = ["status" => "failed"];
$status = trim((new Backend())->configdRun('vep1400hw gettemp'));

if (!empty($status)) {
$result["status"] = "OK";
$temp["temp"] = $status;
$result = array_merge($result, $temp);
}

return $result;
}

public function boardIdAction()
{
$result = ["status" => "failed"];
$status = trim((new Backend())->configdRun('vep1400hw getid'));

if (!empty($status)) {
$result["status"] = "OK";
$id["boardid"] = $status;
$result = array_merge($result, $id);
}

return $result;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

namespace OPNsense\vep1400hw\Api;

use OPNsense\Base\ApiMutableServiceControllerBase;
use OPNsense\Core\Backend;


class ServiceController extends ApiMutableServiceControllerBase
{

protected static $internalServiceClass = '\OPNsense\vep1400hw\vep1400hw';
protected static $internalServiceTemplate = 'OPNsense/vep1400hw';
protected static $internalServiceEnabled = 'general.enabled';
protected static $internalServiceName = 'vep1400hw';


/**
* reconfigure vep1400hw
*/
public function reloadAction()
{
$status = "failed";
if ($this->request->isPost()) {
$status = strtolower(trim((new Backend())->configdRun('template reload ' . self::$internalServiceTemplate)));
}
return ["status" => $status];
}//*/

/**
* apply
*/
public function applyAction()
{
if ($this->request->isPost()) {
$mdl = $this->getModel();
$boardtype = trim((new Backend())->configdRun('vep1400hw getid'));
$boardnibble = substr($boardtype, -1);
if ($boardnibble != "0" && $boardnibble != "1"){
$fanc_enabled = $mdl->general->FanControl;
$fan_dc = $mdl->general->FanDutyCycle;
$fanresult = trim((new Backend())->configdRun(sprintf("vep1400hw setfan %s %s", $fanc_enabled, $fan_dc)));
}
else {
$fanresult = "OK"; //we can't set fan settings on boards without them so fake an OK
}
$ledr = $mdl->led->red; $ledg = $mdl->led->green; $ledb = $mdl->led->blue;
$ledresult = trim((new Backend())->configdRun(sprintf("vep1400hw setled %s %s %s", $ledr, $ledg, $ledb)));
if ($fanresult == "OK" && $ledresult == "OK") {
// only return valid json type responses
return ["message" => "Hardware settings applied successfully"];
}
}
return ["message" => "Hardware settings weren't applied."];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/*
* Copyright (C) 2015-2019 Deciso B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace OPNsense\vep1400hw\Api;

use OPNsense\Base\ApiMutableModelControllerBase;

/**
* Class SettingsController Handles settings related API actions for the VepHW module
* @package OPNsense\vep1400hw
*/
class SettingsController extends ApiMutableModelControllerBase
{
protected static $internalModelClass = 'OPNsense\vep1400hw\vep1400hw';
protected static $internalModelName = 'vep1400hw';


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* Copyright (C) 2015 Deciso B.V.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/

namespace OPNsense\vep1400hw;

/**
* Class IndexController
* @package OPNsense\VepHW
*/
class IndexController extends \OPNsense\Base\IndexController
{
public function indexAction()
{
// pick the template to serve to our users.
$this->view->pick('OPNsense/vep1400hw/index');
// fetch form data "general" in
$this->view->generalForm = $this->getForm("general");
}
}
Loading