diff --git a/.github/workflows/build_code.yml b/.github/workflows/build_code.yml index a17b01ba..e0c38852 100644 --- a/.github/workflows/build_code.yml +++ b/.github/workflows/build_code.yml @@ -32,6 +32,16 @@ jobs: with: connect-type: "STANDARD" + aibom: + uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop + with: + connect-type: "AIBOM" + + gamernium: + uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop + with: + connect-type: "GAMERNIUM" + # The fullspec connection board is the most common debug-fullspec: uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop diff --git a/cpp/Makefile b/cpp/Makefile index 425b6f9e..c5d0b83d 100644 --- a/cpp/Makefile +++ b/cpp/Makefile @@ -14,7 +14,7 @@ CXX = $(CROSS_COMPILE)g++ DEBUG ?= 0 ifeq ($(DEBUG), 1) # Debug compiler flags - CXXFLAGS += -Og -g -Wall -Wextra -DDEBUG + CXXFLAGS += -O0 -g -Wall -Wextra -DDEBUG else # Release compiler flags CXXFLAGS += -O3 -Wall -Werror -Wextra -DNDEBUG @@ -39,7 +39,7 @@ CXXFLAGS += $(EXTRA_FLAGS) CONNECT_TYPE ?= FULLSPEC ifdef CONNECT_TYPE -CXXFLAGS += -DCONNECT_TYPE_$(CONNECT_TYPE) + CXXFLAGS += -DCONNECT_TYPE_$(CONNECT_TYPE) endif PISCSI = piscsi @@ -67,9 +67,13 @@ BIN_ALL = \ $(BINDIR)/$(PISCSI) \ $(BINDIR)/$(SCSICTL) \ $(BINDIR)/$(SCSIMON) \ - $(BINDIR)/$(SCSIDUMP) \ $(BINDIR)/$(SCSILOOP) +# scsidump requires initiator support +ifeq ($(CONNECT_TYPE), FULLSPEC) + BIN_ALL += $(BINDIR)/$(SCSIDUMP) +endif + SRC_PROTOC = piscsi_interface.proto SRC_GENERATED = $(GENERATED_DIR)/piscsi_interface.pb.cpp @@ -128,6 +132,22 @@ OBJ_SHARED := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SHARED:%.cpp=%.o))) OBJ_PROTOBUF := $(addprefix $(OBJDIR)/,$(notdir $(SRC_PROTOBUF:%.cpp=%.o))) OBJ_GENERATED := $(addprefix $(OBJDIR)/,$(notdir $(SRC_GENERATED:%.cpp=%.o))) +BINARIES = $(USR_LOCAL_BIN)/$(SCSICTL) \ + $(USR_LOCAL_BIN)/$(PISCSI) \ + $(USR_LOCAL_BIN)/$(SCSIMON) \ + $(USR_LOCAL_BIN)/$(SCSILOOP) +ifeq ($(CONNECT_TYPE), FULLSPEC) + BINARIES += $(USR_LOCAL_BIN)/$(SCSIDUMP) +endif + +MAN_PAGES = $(MAN_PAGE_DIR)/piscsi.1 \ + $(MAN_PAGE_DIR)/scsictl.1 \ + $(MAN_PAGE_DIR)/scsimon.1 \ + $(MAN_PAGE_DIR)/scsiloop.1 +ifeq ($(CONNECT_TYPE), FULLSPEC) + MAN_PAGES += $(MAN_PAGE_DIR)/scsidump.1 +endif + GENERATED_DIR := generated # For the unit tests, the following functions will be "wrapped" by the linker, meaning the @@ -232,16 +252,8 @@ clean: ## * sudo systemctl start piscsi .PHONY: install install: \ - $(MAN_PAGE_DIR)/piscsi.1 \ - $(MAN_PAGE_DIR)/scsictl.1 \ - $(MAN_PAGE_DIR)/scsimon.1 \ - $(MAN_PAGE_DIR)/scsiloop.1 \ - $(MAN_PAGE_DIR)/scsidump.1 \ - $(USR_LOCAL_BIN)/$(SCSICTL) \ - $(USR_LOCAL_BIN)/$(PISCSI) \ - $(USR_LOCAL_BIN)/$(SCSIMON) \ - $(USR_LOCAL_BIN)/$(SCSILOOP) \ - $(USR_LOCAL_BIN)/$(SCSIDUMP) \ + $(MAN_PAGES) \ + $(BINARIES) \ $(SYSTEMD_CONF) \ $(RSYSLOG_CONF) \ $(RSYSLOG_LOG) diff --git a/cpp/devices/ctapdriver.cpp b/cpp/devices/ctapdriver.cpp index 6f394ae6..85fc2adc 100644 --- a/cpp/devices/ctapdriver.cpp +++ b/cpp/devices/ctapdriver.cpp @@ -337,7 +337,7 @@ bool CTapDriver::HasPendingPackets() const fds.revents = 0; poll(&fds, 1, 0); spdlog::trace(to_string(fds.revents) + " revents"); - return !(fds.revents & POLLIN); + return fds.revents & POLLIN; } // See https://stackoverflow.com/questions/21001659/crc32-algorithm-implementation-in-c-without-a-look-up-table-and-with-a-public-li diff --git a/cpp/hal/connection_type/connection_aibom.h b/cpp/hal/connection_type/connection_aibom.h new file mode 100644 index 00000000..1328f5bc --- /dev/null +++ b/cpp/hal/connection_type/connection_aibom.h @@ -0,0 +1,56 @@ +//--------------------------------------------------------------------------- +// +// SCSI Target Emulator PiSCSI +// for Raspberry Pi +// +// Powered by XM6 TypeG Technology. +// Copyright (C) 2016-2020 GIMONS +// +//--------------------------------------------------------------------------- + +#pragma once + +#include + +// +// RaSCSI Adapter Aibom version +// + +const std::string CONNECT_DESC = "AIBOM PRODUCTS version"; // Startup message + +// Select signal control mode +const static int SIGNAL_CONTROL_MODE = 2; // SCSI positive logic specification + +// Control signal output logic +#define ACT_ON ON // ACTIVE SIGNAL ON +#define ENB_ON ON // ENABLE SIGNAL ON +#define IND_IN OFF // INITIATOR SIGNAL INPUT +#define TAD_IN OFF // TARGET SIGNAL INPUT +#define DTD_IN OFF // DATA SIGNAL INPUT + +// Control signal pin assignment (-1 means no control) +const static int PIN_ACT = 4; // ACTIVE +const static int PIN_ENB = 17; // ENABLE +const static int PIN_IND = 27; // INITIATOR CTRL DIRECTION +const static int PIN_TAD = -1; // TARGET CTRL DIRECTION +const static int PIN_DTD = 18; // DATA DIRECTION + +// SCSI signal pin assignment +const static int PIN_DT0 = 6; // Data 0 +const static int PIN_DT1 = 12; // Data 1 +const static int PIN_DT2 = 13; // Data 2 +const static int PIN_DT3 = 16; // Data 3 +const static int PIN_DT4 = 19; // Data 4 +const static int PIN_DT5 = 20; // Data 5 +const static int PIN_DT6 = 26; // Data 6 +const static int PIN_DT7 = 21; // Data 7 +const static int PIN_DP = 5; // Data parity +const static int PIN_ATN = 22; // ATN +const static int PIN_RST = 25; // RST +const static int PIN_ACK = 10; // ACK +const static int PIN_REQ = 7; // REQ +const static int PIN_MSG = 9; // MSG +const static int PIN_CD = 11; // CD +const static int PIN_IO = 23; // IO +const static int PIN_BSY = 24; // BSY +const static int PIN_SEL = 8; // SEL diff --git a/cpp/hal/connection_type/connection_gamernium.h b/cpp/hal/connection_type/connection_gamernium.h new file mode 100644 index 00000000..70751560 --- /dev/null +++ b/cpp/hal/connection_type/connection_gamernium.h @@ -0,0 +1,56 @@ +//--------------------------------------------------------------------------- +// +// SCSI Target Emulator PiSCSI +// for Raspberry Pi +// +// Powered by XM6 TypeG Technology. +// Copyright (C) 2016-2020 GIMONS +// +//--------------------------------------------------------------------------- + +#pragma once + +#include + +// +// RaSCSI Adapter GAMERnium.com version +// + +const std::string CONNECT_DESC = "GAMERnium.com version"; // Startup message + +// Select signal control mode +const static int SIGNAL_CONTROL_MODE = 0; // SCSI logical specification + +// Control signal output logic +#define ACT_ON ON // ACTIVE SIGNAL ON +#define ENB_ON ON // ENABLE SIGNAL ON +#define IND_IN OFF // INITIATOR SIGNAL INPUT +#define TAD_IN OFF // TARGET SIGNAL INPUT +#define DTD_IN ON // DATA SIGNAL INPUT + +// Control signal pin assignment (-1 means no control) +const static int PIN_ACT = 14; // ACTIVE +const static int PIN_ENB = 6; // ENABLE +const static int PIN_IND = 7; // INITIATOR CTRL DIRECTION +const static int PIN_TAD = 8; // TARGET CTRL DIRECTION +const static int PIN_DTD = 5; // DATA DIRECTION + +// SCSI signal pin assignment +const static int PIN_DT0 = 21; // Data 0 +const static int PIN_DT1 = 26; // Data 1 +const static int PIN_DT2 = 20; // Data 2 +const static int PIN_DT3 = 19; // Data 3 +const static int PIN_DT4 = 16; // Data 4 +const static int PIN_DT5 = 13; // Data 5 +const static int PIN_DT6 = 12; // Data 6 +const static int PIN_DT7 = 11; // Data 7 +const static int PIN_DP = 25; // Data parity +const static int PIN_ATN = 10; // ATN +const static int PIN_RST = 22; // RST +const static int PIN_ACK = 24; // ACK +const static int PIN_REQ = 15; // REQ +const static int PIN_MSG = 17; // MSG +const static int PIN_CD = 18; // CD +const static int PIN_IO = 4; // IO +const static int PIN_BSY = 27; // BSY +const static int PIN_SEL = 23; // SEL diff --git a/cpp/hal/data_sample_raspberry.h b/cpp/hal/data_sample_raspberry.h index 9951d661..a0b5e1e7 100644 --- a/cpp/hal/data_sample_raspberry.h +++ b/cpp/hal/data_sample_raspberry.h @@ -18,6 +18,10 @@ #include "hal/connection_type/connection_standard.h" #elif defined CONNECT_TYPE_FULLSPEC #include "hal/connection_type/connection_fullspec.h" +#elif defined CONNECT_TYPE_AIBOM +#include "hal/connection_type/connection_aibom.h" +#elif defined CONNECT_TYPE_GAMERNIUM +#include "hal/connection_type/connection_gamernium.h" #else #error Invalid connection type or none specified #endif @@ -102,4 +106,4 @@ class DataSample_Raspberry final : public DataSample private: uint32_t data = 0; -}; +}; \ No newline at end of file diff --git a/cpp/hal/gpiobus.h b/cpp/hal/gpiobus.h index 7dbff55c..fe774115 100644 --- a/cpp/hal/gpiobus.h +++ b/cpp/hal/gpiobus.h @@ -26,11 +26,17 @@ //--------------------------------------------------------------------------- //#define CONNECT_TYPE_STANDARD // Standard (SCSI logic, standard pin assignment) //#define CONNECT_TYPE_FULLSPEC // Full spec (SCSI logic, standard pin assignment) +//#define CONNECT_TYPE_AIBOM // AIBOM version (positive logic, unique pin assignment) +//#define CONNECT_TYPE_GAMERNIUM // GAMERnium.com version (standard logic, unique pin assignment) #if defined CONNECT_TYPE_STANDARD #include "hal/connection_type/connection_standard.h" #elif defined CONNECT_TYPE_FULLSPEC #include "hal/connection_type/connection_fullspec.h" +#elif defined CONNECT_TYPE_AIBOM +#include "hal/connection_type/connection_aibom.h" +#elif defined CONNECT_TYPE_GAMERNIUM +#include "hal/connection_type/connection_gamernium.h" #else #error Invalid connection type or none specified #endif diff --git a/cpp/scsiloop/scsiloop_gpio.cpp b/cpp/scsiloop/scsiloop_gpio.cpp index 97d53192..9a803ce2 100644 --- a/cpp/scsiloop/scsiloop_gpio.cpp +++ b/cpp/scsiloop/scsiloop_gpio.cpp @@ -18,6 +18,10 @@ #include "hal/connection_type/connection_standard.h" #elif defined CONNECT_TYPE_FULLSPEC #include "hal/connection_type/connection_fullspec.h" +#elif defined CONNECT_TYPE_AIBOM +#include "hal/connection_type/connection_aibom.h" +#elif defined CONNECT_TYPE_GAMERNIUM +#include "hal/connection_type/connection_gamernium.h" #else #error Invalid connection type or none specified #endif diff --git a/easyinstall.sh b/easyinstall.sh index 67b3f8a3..6421e4db 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -948,6 +948,7 @@ function installSamba() { # Installs and configures Webmin function installWebmin() { WEBMIN_PATH="/usr/share/webmin" + WEBMIN_MODULE_CONFIG="/etc/webmin/netatalk2/config" WEBMIN_MODULE_VERSION="1.0" if [ -d "$WEBMIN_PATH" ]; then @@ -968,14 +969,23 @@ function installWebmin() { 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 + sudo apt-get install webmin --install-recommends /dev/null || true wget -O netatalk2-wbm.tgz "https://github.com/Netatalk/netatalk-webmin/releases/download/netatalk2-$WEBMIN_MODULE_VERSION/netatalk2-wbm-$WEBMIN_MODULE_VERSION.tgz" div a { + display: none; +} + td.inactive { text-align: center; background-color: tan; diff --git a/python/web/src/static/themes/modern/icons/manual copy.svg b/python/web/src/static/themes/modern/icons/home.svg similarity index 55% rename from python/web/src/static/themes/modern/icons/manual copy.svg rename to python/web/src/static/themes/modern/icons/home.svg index 12ffcbc4..7bb31b23 100644 --- a/python/web/src/static/themes/modern/icons/manual copy.svg +++ b/python/web/src/static/themes/modern/icons/home.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/python/web/src/static/themes/modern/icons/manual.svg b/python/web/src/static/themes/modern/icons/manual.svg deleted file mode 100644 index 12ffcbc4..00000000 --- a/python/web/src/static/themes/modern/icons/manual.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/python/web/src/static/themes/modern/style.css b/python/web/src/static/themes/modern/style.css index cd296c76..e057da98 100644 --- a/python/web/src/static/themes/modern/style.css +++ b/python/web/src/static/themes/modern/style.css @@ -545,7 +545,7 @@ div.flash > div { } div.flash > div a { - display: inline-block !important; + display: inline-block; padding: 0.25rem 0.75rem; margin-left: auto; color: #fff; @@ -948,27 +948,6 @@ section#system div.power-control { } } -/* - ------------------------------------------------------------------------------ - Index > Section: Manual - ------------------------------------------------------------------------------ - */ -section#manual { - margin: 2rem 0 1rem; -} - -section#manual a { - margin: auto; - display: block; - padding: 0.25rem 0 0.25rem 2rem; - background: url("icons/manual.svg") no-repeat left center; - font-weight: bold; -} - -section#manual a p { - margin: 0; -} - /* ------------------------------------------------------------------------------ Admin > Section: Services @@ -1072,3 +1051,18 @@ body.page-manpage div.content p.home { margin-top: 2rem; font-weight: bold; } + +/* + ------------------------------------------------------------------------------ + Base > Back + ------------------------------------------------------------------------------ + */ +a.back { + padding: 0.25rem 0 0.25rem 2rem; + font-weight: bold; + background: url("icons/home.svg") no-repeat left center; +} + +a.back span.separator { + display: none; +} diff --git a/python/web/src/templates/admin.html b/python/web/src/templates/admin.html index d3c9d343..c28d41a4 100644 --- a/python/web/src/templates/admin.html +++ b/python/web/src/templates/admin.html @@ -189,6 +189,5 @@ -

{{ _("Go to Home") }}

- +
{% endblock content %} diff --git a/python/web/src/templates/base.html b/python/web/src/templates/base.html index 4ebdfd6a..0c555f72 100644 --- a/python/web/src/templates/base.html +++ b/python/web/src/templates/base.html @@ -95,7 +95,7 @@ {% else %}
{{ message }}
{% endif %} - + {% endfor %} {% endif %} @@ -105,7 +105,15 @@ {{ content_class }} {% block content %}{% endblock content %} + {% if not is_root_page %} + + {% endif %} -

{{ _("Go to Home") }}

+
{% endblock content %} diff --git a/python/web/src/web.py b/python/web/src/web.py index bb61968f..2e85722c 100644 --- a/python/web/src/web.py +++ b/python/web/src/web.py @@ -261,6 +261,7 @@ def index(): return response( template="index.html", page_title=_("PiSCSI Control Page"), + is_root_page=True, netinfo=piscsi_cmd.get_network_info(), bridge_configured=sys_cmd.is_bridge_setup(), devices=formatted_devices, @@ -347,6 +348,7 @@ def upload_page(): return response( template="upload.html", page_title=_("PiSCSI File Upload"), + is_root_page=True, images_subdirs=file_cmd.list_subdirs(server_info["image_dir"]), shared_subdirs=file_cmd.list_subdirs(FILE_SERVER_DIR), file_server_dir_exists=Path(FILE_SERVER_DIR).exists(), diff --git a/python/web/src/web_utils.py b/python/web/src/web_utils.py index f407c9c7..69af618b 100644 --- a/python/web/src/web_utils.py +++ b/python/web/src/web_utils.py @@ -298,9 +298,8 @@ def is_bridge_configured(interface): return_msg = _( "Configure the network bridge for %(interface)s first: ", interface=interface ) - return {"status": False, "msg": return_msg + ", ".join(to_configure)} - return {"status": True, "msg": return_msg} + return {"status": True, "msg": return_msg + ", ".join(to_configure)} def is_safe_path(file_name):