Skip to content

Commit

Permalink
Merge branch 'develop' into issue_1179
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Sep 27, 2023
2 parents 4a468d3 + 65c1b19 commit 9e82368
Show file tree
Hide file tree
Showing 29 changed files with 1,064 additions and 2,042 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build_code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ on:
- 'cpp/**'
- '.github/workflows/build_code.yml'
- '.github/workflows/arm_cross_compile.yml'
pull_request:
paths:
- 'cpp/**'
- '.github/workflows/build_code.yml'
- '.github/workflows/arm_cross_compile.yml'
types:
- assigned
- opened
- synchronize
- reopened
branches:
- 'develop'
- 'main'

jobs:
fullspec:
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ on:
paths:
- 'cpp/**'
- '.github/workflows/cpp.yml'
pull_request:
paths:
- 'cpp/**'
- '.github/workflows/cpp.yml'
types:
- assigned
- opened
- synchronize
- reopened
branches:
- 'develop'
- 'main'

env:
APT_PACKAGES: libspdlog-dev libpcap-dev protobuf-compiler libgtest-dev libgmock-dev
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ on:
- 'python/common/**'
- '.github/workflows/web.yml'
- 'easyinstall.sh'
pull_request:
paths:
- 'python/web/**'
- 'python/common/**'
- '.github/workflows/web.yml'
- 'easyinstall.sh'
types:
- assigned
- opened
- synchronize
- reopened
branches:
- 'develop'
- 'main'

jobs:
backend_checks:
Expand Down Expand Up @@ -123,8 +137,12 @@ jobs:
id: npm

- name: Stylelint
run: npx stylelint src/static/themes/modern/style.css
run: |
npx stylelint src/static/themes/modern/style.css
npx stylelint src/static/themes/classic/style.css
- name: Prettier
run: npx prettier --check src/static/themes/modern/style.css
run: |
npx prettier --check src/static/themes/modern/style.css
npx prettier --check src/static/themes/classic/style.css
if: success() || failure() && steps.npm.outcome == 'success'
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Please check out the full story with much more detail on the [wiki](https://gith
# How do I contribute?
PiSCSI is using the <a href="https://datasift.github.io/gitflow/IntroducingGitFlow.html">Gitflow Workflow</a>. A quick overview:

- The *master* branch should always reflect the contents of the last stable release
- The *main* branch should always reflect the contents of the last stable release
- The *develop* branch should contain the latest tested & approved updates. Pull requests should be used to merge changes into develop.
- The rest of the feature branches are for developing new features
- A tag will be created for each "release". The releases will be named <year>.<month>.<release number> where the release number is incremented for each subsequent release tagged in the same calendar month. The first release of the month of January 2021 is called "21.01.01", the second one in the same month "21.01.02" and so on.
Expand Down
4 changes: 2 additions & 2 deletions cpp/hal/gpiobus_raspberry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ bool GPIOBUS_Raspberry::Init(mode_e mode)
// GPIO chip open
fd = open("/dev/gpiochip0", 0);
if (fd == -1) {
LOGERROR("Unable to open /dev/gpiochip0. Is PiSCSI or RaSCSI already running?")
LOGERROR("Unable to open /dev/gpiochip0. If PiSCSI is running, please shut it down first.")
return false;
}

Expand All @@ -199,7 +199,7 @@ bool GPIOBUS_Raspberry::Init(mode_e mode)

// Get event request
if (ioctl(fd, GPIO_GET_LINEEVENT_IOCTL, &selevreq) == -1) {
LOGERROR("Unable to register event request. Is PiSCSI or RaSCSI already running?")
LOGERROR("Unable to register event request. If PiSCSI is running, please shut it down first.")
close(fd);
return false;
}
Expand Down
4 changes: 3 additions & 1 deletion doc/scsimon.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ To quit scsimon, press Control + C.
None

.SH EXAMPLES
Launch scsimon to capture all SCSI traffic available to the PiSCSI hardware:
Make sure you've stopped the piscsi service. Then launch scsimon to capture all SCSI traffic available to the PiSCSI hardware:
scsimon

If you're trying to capture a specific scenario, you'll want to wait to start scsimon until immediately before the scenario.

.SH SEE ALSO
scsictl(1), piscsi(1), scsidump(1)

Expand Down
22 changes: 14 additions & 8 deletions doc/scsimon_man_page.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
!! ------ The native file is scsimon.1. Re-run 'make docs' after updating


scsimon(1) General Commands Manual scsimon(1)
scsimon(1) General Commands Manual scsimon(1)

NAME
scsimon - Acts as a data capture tool for all traffic on the SCSI bus. Data is stored in a Value Change Dump (VCD) file.
scsimon - Acts as a data capture tool for all traffic on the SCSI bus. Data is stored in a Value Change Dump
(VCD) file.

SYNOPSIS
scsimon

DESCRIPTION
scsimon monitors all of the traffic on the SCSI bus, using a PiSCSI device. The data is cached in memory while the tool is
running. A circular buffer is used so that only the most recent 1,000,000 transactions are stored. The tool will continue
to run until the user presses CTRL-C, or the process receives a SIGINT signal.
scsimon monitors all of the traffic on the SCSI bus, using a PiSCSI device. The data is cached in memory while
the tool is running. A circular buffer is used so that only the most recent 1,000,000 transactions are stored.
The tool will continue to run until the user presses CTRL-C, or the process receives a SIGINT signal.

The logged data is stored in a file called "log.vcd" in the current working directory from where scsimon was launched.
The logged data is stored in a file called "log.vcd" in the current working directory from where scsimon was
launched.

Currently, scsimon doesn't accept any arguments.

Expand All @@ -25,12 +27,16 @@ OPTIONS
None

EXAMPLES
Launch scsimon to capture all SCSI traffic available to the PiSCSI hardware:
Make sure you've stopped the piscsi service. Then launch scsimon to capture all SCSI traffic available to the
PiSCSI hardware:
scsimon

If you're trying to capture a specific scenario, you'll want to wait to start scsimon until immediately before
the scenario.

SEE ALSO
scsictl(1), piscsi(1), scsidump(1)

Full documentation is available at: <https://www.piscsi.com>

scsimon(1)
scsimon(1)
95 changes: 82 additions & 13 deletions easyinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,10 @@ function installPiscsi() {

# install
sudo make install CONNECT_TYPE="$CONNECT_TYPE" </dev/null
}

# update launch parameters
# Update the systemd configuration for piscsi
function configurePiscsiService() {
if [[ -f $SECRET_FILE ]]; then
sudo sed -i "\@^ExecStart.*@ s@@& -F $VIRTUAL_DRIVER_PATH -P $SECRET_FILE@" "$SYSTEMD_PATH/piscsi.service"
echo "Secret token file $SECRET_FILE detected. Using it to enable back-end authentication."
Expand Down Expand Up @@ -567,9 +569,18 @@ function fetchHardDiskDrivers() {
function setupWiredNetworking() {
echo "Setting up wired network..."

LAN_INTERFACE=eth0
if [[ -z $HEADLESS ]]; then
LAN_INTERFACE=`ip -o addr show scope link | awk '{split($0, a); print $2}' | grep 'eth\|enx' | head -n 1`
else
LAN_INTERFACE="eth0"
fi

echo "$LAN_INTERFACE will be configured for network forwarding with DHCP."
if [[ -z "$LAN_INTERFACE" ]]; then
echo "No usable wired network interfaces detected. Have you already enabled the bridge? Aborting..."
return 1
fi

echo "Network interface '$LAN_INTERFACE' will be configured for network forwarding with DHCP."
echo ""
echo "WARNING: If you continue, the IP address of your Pi may change upon reboot."
echo "Please make sure you will not lose access to the Pi system."
Expand All @@ -581,7 +592,7 @@ function setupWiredNetworking() {

if [ "$REPLY" == "N" ] || [ "$REPLY" == "n" ]; then
echo "Available wired interfaces on this system:"
echo `ip -o addr show scope link | awk '{split($0, a); print $2}' | grep eth`
echo `ip -o addr show scope link | awk '{split($0, a); print $2}' | grep 'eth\|enx'`
echo "Please type the wired interface you want to use and press Enter:"
read SELECTED
LAN_INTERFACE=$SELECTED
Expand Down Expand Up @@ -634,9 +645,19 @@ function setupWirelessNetworking() {
CIDR="24"
ROUTER_IP=$NETWORK.1
ROUTING_ADDRESS=$NETWORK.0/$CIDR
WLAN_INTERFACE="wlan0"

echo "$WLAN_INTERFACE will be configured for network forwarding with static IP assignment."
if [[ -z $HEADLESS ]]; then
WLAN_INTERFACE=`ip -o addr show scope link | awk '{split($0, a); print $2}' | grep 'wlan\|wlx' | head -n 1`
else
WLAN_INTERFACE="wlan0"
fi

if [[ -z "$WLAN_INTERFACE" ]]; then
echo "No usable wireless network interfaces detected. Have you already enabled the bridge? Aborting..."
return 1
fi

echo "Network interface '$WLAN_INTERFACE' will be configured for network forwarding with static IP assignment."
echo "Configure your Macintosh or other device with the following:"
echo "IP Address (static): $IP"
echo "Router Address: $ROUTER_IP"
Expand All @@ -648,7 +669,7 @@ function setupWirelessNetworking() {

if [ "$REPLY" == "N" ] || [ "$REPLY" == "n" ]; then
echo "Available wireless interfaces on this system:"
echo `ip -o addr show scope link | awk '{split($0, a); print $2}' | grep wlan`
echo `ip -o addr show scope link | awk '{split($0, a); print $2}' | grep 'wlan\|wlx'`
echo "Please type the wireless interface you want to use and press Enter:"
read -r WLAN_INTERFACE
echo "Base IP address (ex. 10.10.20):"
Expand Down Expand Up @@ -734,7 +755,7 @@ function createFileSharingDir() {

# Downloads, compiles, and installs Netatalk (AppleShare server)
function installNetatalk() {
NETATALK_VERSION="230302"
NETATALK_VERSION="230701"
NETATALK_CONFIG_PATH="/etc/netatalk"
NETATALK_OPTIONS="--cores=$CORES --share-name='$FILE_SHARE_NAME' --share-path='$FILE_SHARE_PATH'"

Expand Down Expand Up @@ -854,6 +875,8 @@ function installMacproxy {

# Installs vsftpd (FTP server)
function installFtp() {
echo
echo "Installing packages..."
sudo apt-get update && sudo apt-get install vsftpd --assume-yes --no-install-recommends </dev/null

echo
Expand Down Expand Up @@ -883,11 +906,11 @@ function installSamba() {
fi
fi

echo ""
echo "Installing dependencies..."
echo
echo "Installing packages..."
sudo apt-get update || true
sudo apt-get install samba --no-install-recommends --assume-yes </dev/null
echo ""
echo
echo "Modifying $SAMBA_CONFIG_PATH/smb.conf ..."
if [[ `sudo grep -c "server min protocol = NT1" $SAMBA_CONFIG_PATH/smb.conf` -eq 0 ]]; then
# Allow Windows XP clients and earlier to connect to the server
Expand All @@ -905,6 +928,38 @@ function installSamba() {
sudo smbpasswd -a "$USER"
}

# Installs and configures Webmin
function installWebmin() {
WEBMIN_PATH="/usr/share/webmin"
WEBMIN_MODULE_VERSION="1.0"

if [ -d "$WEBMIN_PATH" ]; then
echo
echo "Webmin dir $WEBMIN_PATH already exists."
echo "This installation process may overwrite existing software."
echo
echo "Do you want to proceed with the installation? [y/N]"
read -r REPLY
if ! [ "$REPLY" == "y" ] || [ "$REPLY" == "Y" ]; then
exit 0
fi
fi

echo
echo "Installing packages..."
sudo apt-get install curl --no-install-recommends --assume-yes </dev/null
curl -o setup-repos.sh https://raw.githubusercontent.com/webmin/webmin/master/setup-repos.sh
sudo sh setup-repos.sh
rm setup-repos.sh
sudo apt-get install webmin --install-recommends
echo
echo "Downloading and installing Webmin module..."
rm netatalk2-wbm.tgz || true
wget -O netatalk2-wbm.tgz "https://github.com/Netatalk/netatalk-webmin/releases/download/netatalk2-$WEBMIN_MODULE_VERSION/netatalk2-wbm-$WEBMIN_MODULE_VERSION.tgz" </dev/null
sudo /usr/share/webmin/install-module.pl netatalk2-wbm.tgz
rm netatalk2-wbm.tgz
}

# updates configuration files and installs packages needed for the OLED screen script
function installPiscsiScreen() {
if [[ -f "$SECRET_FILE" && -z "$TOKEN" ]] ; then
Expand Down Expand Up @@ -1162,6 +1217,7 @@ function runChoice() {
compilePiscsi
backupPiscsiService
installPiscsi
configurePiscsiService
enablePiscsiService
preparePythonCommon
if [[ $(isPiscsiScreenInstalled) -eq 0 ]]; then
Expand Down Expand Up @@ -1204,6 +1260,7 @@ function runChoice() {
backupPiscsiService
preparePythonCommon
installPiscsi
configurePiscsiService
enablePiscsiService
if [[ $(isPiscsiScreenInstalled) -eq 0 ]]; then
echo "Detected piscsi oled service; will run the installation steps for the OLED monitor."
Expand Down Expand Up @@ -1369,6 +1426,16 @@ function runChoice() {
installPackagesStandalone
compilePiscsi
;;
17)
echo "Install Webmin"
echo "This script will make the following changes to your system:"
echo "- Add a 3rd party apt repository"
echo "- Install and start the Webmin webapp"
echo "- Install the netatalk2 Webmin module"
installWebmin
echo "Install Webmin - Complete!"
echo "The Webmin webapp should now be listening to port 10000 on this system"
;;
99)
echo "Hidden setup mode for running the pi-gen utility"
echo "This shouldn't be used by normal users"
Expand All @@ -1381,6 +1448,7 @@ function runChoice() {
fetchHardDiskDrivers
compilePiscsi
installPiscsi
configurePiscsiService
enablePiscsiService
preparePythonCommon
cachePipPackages
Expand All @@ -1401,8 +1469,8 @@ function runChoice() {
function readChoice() {
choice=-1

until [ $choice -ge "0" ] && ([ $choice -eq "99" ] || [ $choice -le "16" ]) ; do
echo -n "Enter your choice (0-16) or CTRL-C to exit: "
until [ $choice -ge "0" ] && ([ $choice -eq "99" ] || [ $choice -le "17" ]) ; do
echo -n "Enter your choice (0-17) or CTRL-C to exit: "
read -r choice
done

Expand Down Expand Up @@ -1435,6 +1503,7 @@ function showMenu() {
echo "EXPERIMENTAL FEATURES"
echo " 15) Share the images dir over AppleShare (requires Netatalk)"
echo " 16) Compile PiSCSI binaries"
echo " 17) Install Webmin to manage Netatalk and Samba"
}

# parse arguments passed to the script
Expand Down
1 change: 1 addition & 0 deletions python/common/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
protobuf==3.19.5
requests==2.31.0
vcgencmd==0.1.1
8 changes: 8 additions & 0 deletions python/common/src/piscsi/return_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,11 @@ class ReturnCodes:
EXTRACTIMAGE_NO_FILES_SPECIFIED = 91
EXTRACTIMAGE_NO_FILES_EXTRACTED = 92
EXTRACTIMAGE_COMMAND_ERROR = 93
UNDER_VOLTAGE_DETECTED = 100
ARM_FREQUENCY_CAPPED = 101
CURRENTLY_THROTTLED = 102
SOFT_TEMPERATURE_LIMIT_ACTIVE = 103
UNDER_VOLTAGE_HAS_OCCURRED = 116
ARM_FREQUENCY_CAPPING_HAS_OCCURRED = 117
THROTTLING_HAS_OCCURRED = 118
SOFT_TEMPERATURE_LIMIT_HAS_OCCURRED = 119
Loading

0 comments on commit 9e82368

Please sign in to comment.