diff --git a/python/common/src/rascsi/common_settings.py b/python/common/src/rascsi/common_settings.py index 0bd83a84..2a975c1a 100644 --- a/python/common/src/rascsi/common_settings.py +++ b/python/common/src/rascsi/common_settings.py @@ -8,6 +8,7 @@ WORK_DIR = getcwd() REMOVABLE_DEVICE_TYPES = ("SCCD", "SCRM", "SCMO") NETWORK_DEVICE_TYPES = ("SCDP", "SCBR") +SUPPORT_DEVICE_TYPES = ("SCHS", ) # There may be a more elegant way to get the HOME dir of the user that installed RaSCSI HOME_DIR = "/".join(WORK_DIR.split("/")[0:3]) diff --git a/python/oled/src/rascsi_oled_monitor.py b/python/oled/src/rascsi_oled_monitor.py index 90ba7d29..7ecd750a 100755 --- a/python/oled/src/rascsi_oled_monitor.py +++ b/python/oled/src/rascsi_oled_monitor.py @@ -46,6 +46,7 @@ from rascsi.socket_cmds import SocketCmds from rascsi.common_settings import ( REMOVABLE_DEVICE_TYPES, NETWORK_DEVICE_TYPES, + SUPPORT_DEVICE_TYPES, ) parser = argparse.ArgumentParser(description="RaSCSI OLED Monitor script") @@ -186,8 +187,8 @@ def formatted_output(): f"{line['file']} {line['status']}") else: output.append(f"{line['id']} {line['device_type'][2:4]} {line['status']}") - # Special handling for network devices - elif line["device_type"] in NETWORK_DEVICE_TYPES: + # Special handling of devices that don't use image files + elif line["device_type"] in (NETWORK_DEVICE_TYPES + SUPPORT_DEVICE_TYPES): output.append(f"{line['id']} {line['device_type'][2:4]} {line['vendor']} " f"{line['product']}") # Print only the Vendor/Product info if it's not generic RaSCSI diff --git a/python/web/src/device_utils.py b/python/web/src/device_utils.py index e5abdff7..02711483 100644 --- a/python/web/src/device_utils.py +++ b/python/web/src/device_utils.py @@ -59,20 +59,22 @@ def extend_device_names(device_types): """ mapped_device_types = {} for device_type in device_types: - if device_type is "SAHD": - device_name = _("SASI Hard Drive") - elif device_type is "SCHD": - device_name = _("SCSI Hard Drive") - elif device_type is "SCRM": - device_name = _("Removable Drive") - elif device_type is "SCMO": - device_name = _("Magneto-Optical Drive") - elif device_type is "SCCD": - device_name = _("CD-ROM Drive") - elif device_type is "SCBR": + if device_type == "SAHD": + device_name = _("SASI Hard Disk") + elif device_type == "SCHD": + device_name = _("SCSI Hard Disk") + elif device_type == "SCRM": + device_name = _("Removable Disk") + elif device_type == "SCMO": + device_name = _("Magneto-Optical") + elif device_type == "SCCD": + device_name = _("CD-ROM / DVD") + elif device_type == "SCBR": device_name = _("X68000 Host Bridge") - elif device_type is "SCDP": + elif device_type == "SCDP": device_name = _("DaynaPORT SCSI/Link") + elif device_type == "SCHS": + device_name = _("Host Service") else: device_name = _("Unknown Device") mapped_device_types[device_type] = device_name diff --git a/python/web/src/templates/index.html b/python/web/src/templates/index.html index 667f230a..200abe91 100644 --- a/python/web/src/templates/index.html +++ b/python/web/src/templates/index.html @@ -267,7 +267,7 @@ {{ _("Select device type") }} {% for key, value in device_types.items() %} - {% if key not in NETWORK_DEVICE_TYPES %} + {% if key not in (NETWORK_DEVICE_TYPES + SUPPORT_DEVICE_TYPES) %} @@ -360,6 +360,50 @@

{{ _("Install Macproxy to browse the Web with any vintage browser. It's not just for Macs!", url="https://github.com/akuker/RASCSI/wiki/Vintage-Web-Proxy#macproxy") }}

{% endif %} +
+
+ + {{ _("Attach Support Device (EXPERIMENTAL)") }} + + +
+ + + + +
+
+ + + + + + + +
+
+
diff --git a/python/web/src/web.py b/python/web/src/web.py index aa16c820..b0885602 100644 --- a/python/web/src/web.py +++ b/python/web/src/web.py @@ -55,6 +55,7 @@ from rascsi.common_settings import ( PROPERTIES_SUFFIX, REMOVABLE_DEVICE_TYPES, NETWORK_DEVICE_TYPES, + SUPPORT_DEVICE_TYPES, RESERVATIONS, ) from rascsi.ractl_cmds import RaCtlCmds @@ -120,7 +121,7 @@ def index(): extended_image_files = [] for image in image_files["files"]: - if image["detected_type"] is not "UNDEFINED": + if image["detected_type"] != "UNDEFINED": image["detected_type_name"] = mapped_device_types[image["detected_type"]] extended_image_files.append(image) @@ -190,6 +191,7 @@ def index(): PROPERTIES_SUFFIX=PROPERTIES_SUFFIX, REMOVABLE_DEVICE_TYPES=REMOVABLE_DEVICE_TYPES, NETWORK_DEVICE_TYPES=NETWORK_DEVICE_TYPES, + SUPPORT_DEVICE_TYPES=SUPPORT_DEVICE_TYPES, ) @@ -493,6 +495,34 @@ def log_level(): return redirect(url_for("index")) +@APP.route("/scsi/attach_support", methods=["POST"]) +@login_required +def attach_support_device(): + """ + Attaches a support device + """ + scsi_id = request.form.get("scsi_id") + unit = request.form.get("unit") + device_type = request.form.get("type") + kwargs = {"unit": int(unit), "device_type": device_type} + process = ractl.attach_image(scsi_id, **kwargs) + process = ReturnCodeMapper.add_msg(process) + if process["status"]: + flash(_( + ( + "Attached support device of type %(device_type)s " + "to SCSI ID %(id_number)s LUN %(unit_number)s" + ), + device_type=device_type, + id_number=scsi_id, + unit_number=unit, + )) + return redirect(url_for("index")) + + flash(process["msg"], "error") + return redirect(url_for("index")) + + @APP.route("/scsi/attach_network", methods=["POST"]) @login_required def attach_network_adapter():