diff --git a/doc/rascsi.1 b/doc/rascsi.1 index 37d767d9..32f60a29 100644 --- a/doc/rascsi.1 +++ b/doc/rascsi.1 @@ -73,7 +73,7 @@ The rascsi server port, default is 6868. .BR \-r\fI " " \fIRESERVED_IDS Comma-separated list of IDs to reserve. .BR \-p\fI " " \fITYPE -The optional case-insensitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, SCBR, SCDP). If no type is specified for devices that support an image file, rascsi tries to derive the type from the file extension. +The optional case-insensitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, SCBR, SCDP, SCHS). If no type is specified for devices that support an image file, rascsi tries to derive the type from the file extension. .TP .BR \-v\fI " " \fI Display the rascsi version. @@ -84,7 +84,7 @@ Overrides the default locale for client-faces error messages. The client can ove .BR \-ID\fIn[:u] " " \fIFILE n is the SCSI ID number (0-7). u (0-31) is the optional LUN (logical unit). The default LUN is 0. .IP -FILE is the name of the image file to use for the SCSI device. For devices that do not support an image file (SCBR, SCDP) a dummy name must be provided. +FILE is the name of the image file to use for the SCSI device. For devices that do not support an image file (SCBR, SCDP, SCHS) a dummy name must be provided. .TP .BR \-HD\fIn[:u] " " \fIFILE n is the SASI ID number (0-15). The effective SASI ID is calculated as n/2, the effective SASI LUN is calculated is the remainder of n/2. Alternatively the n:u syntax can be used, where ns is the SASI ID (0-7) and u the LUN (0-1). @@ -101,7 +101,7 @@ Launch RaSCSI with an Apple hard drive image as ID 0 and a CD-ROM as ID 2 rascsi -ID0 /path/to/harddrive.hda -ID2 /path/to/cdimage.iso Launch RaSCSI with a removable SCSI drive image as ID 0 and the raw device file /dev/hdb (e.g. a USB stick) and a DaynaPort network adapter as ID 6: - rascsi -ID0 -t scrm /dev/hdb -ID6 -t scdp DUMMY_FILENAME + rascsi -ID0 -t scrm /dev/hdb -ID6 -t scdp daynaport To create an empty, 100MB HD image, use the following command: dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800 diff --git a/doc/rascsi_man_page.txt b/doc/rascsi_man_page.txt index 1a384b32..4ff5553e 100644 --- a/doc/rascsi_man_page.txt +++ b/doc/rascsi_man_page.txt @@ -93,9 +93,9 @@ OPTIONS -r RESERVED_IDS Comma-separated list of IDs to reserve. -p TYPE The optional case-insensitive device type (SAHD, SCHD, SCRM, SCCD, SCMO, - SCBR, SCDP). If no type is specified for devices that support an - image file, rascsi tries to derive the type from the file exten‐ - sion. + SCBR, SCDP, SCHS). If no type is specified for devices that sup‐ + port an image file, rascsi tries to derive the type from the + file extension. -v Display the rascsi version. @@ -108,8 +108,8 @@ OPTIONS (logical unit). The default LUN is 0. FILE is the name of the image file to use for the SCSI device. - For devices that do not support an image file (SCBR, SCDP) a - dummy name must be provided. + For devices that do not support an image file (SCBR, SCDP, SCHS) + a dummy name must be provided. -HDn[:u] FILE n is the SASI ID number (0-15). The effective SASI ID is calcu‐ @@ -133,7 +133,7 @@ EXAMPLES Launch RaSCSI with a removable SCSI drive image as ID 0 and the raw de‐ vice file /dev/hdb (e.g. a USB stick) and a DaynaPort network adapter as ID 6: - rascsi -ID0 -t scrm /dev/hdb -ID6 -t scdp DUMMY_FILENAME + rascsi -ID0 -t scrm /dev/hdb -ID6 -t scdp daynaport To create an empty, 100MB HD image, use the following command: dd if=/dev/zero of=/path/to/newimage.hda bs=512 count=204800 diff --git a/doc/rasctl.1 b/doc/rasctl.1 index eb7e50f6..1159ee1d 100644 --- a/doc/rasctl.1 +++ b/doc/rasctl.1 @@ -148,7 +148,8 @@ Specifies the device type. This type overrides the type derived from the file ex cd: CD-ROM mo: Magneto-Optical disk bridge: Bridge device (Only applicable to the Sharp X68000) - daynaport: DaynaPORT network adapter + daynaport: DaynaPort network adapter + services: Host services device .TP .BR \-n\fI " " \fIVENDOR:PRODUCT:REVISION The vendor, product and revision for the device, to be returned with the INQUIRY data. A complete set of name components must be provided. VENDOR may have up to 8, PRODUCT up to 16, REVISION up to 4 characters. Padding with blanks to the maxium length is automatically applied. Once set the name of a device cannot be changed. diff --git a/doc/rasctl_man_page.txt b/doc/rasctl_man_page.txt index f109a0f5..03413ee6 100644 --- a/doc/rasctl_man_page.txt +++ b/doc/rasctl_man_page.txt @@ -128,7 +128,8 @@ OPTIONS cd: CD-ROM mo: Magneto-Optical disk bridge: Bridge device (Only applicable to the Sharp X68000) - daynaport: DaynaPORT network adapter + daynaport: DaynaPort network adapter + services: Host services device -n VENDOR:PRODUCT:REVISION The vendor, product and revision for the device, to be returned diff --git a/python/common/src/rascsi/common_settings.py b/python/common/src/rascsi/common_settings.py index 27fe45a7..0bd83a84 100644 --- a/python/common/src/rascsi/common_settings.py +++ b/python/common/src/rascsi/common_settings.py @@ -7,6 +7,7 @@ from os import getcwd WORK_DIR = getcwd() REMOVABLE_DEVICE_TYPES = ("SCCD", "SCRM", "SCMO") +NETWORK_DEVICE_TYPES = ("SCDP", "SCBR") # 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/README.md b/python/oled/README.md index afea157c..f1ae8744 100644 --- a/python/oled/README.md +++ b/python/oled/README.md @@ -9,7 +9,7 @@ $ python3 -m venv venv $ source venv/bin/activate # Install requirements $ pip3 install -r requirements.txt -$ python3 src/rascsi_oled_monitor.py +$ PYTHONPATH=$PWD/src:$(dirname $PWD)/common/src python3 src/rascsi_oled_monitor.py ``` ### Parameters @@ -20,7 +20,7 @@ The script takes two positional parameters: Ex. ``` -$ python3 rascsi_oled_monitor.py 180 64 +$ python3 rascsi_oled_monitor.py --rotation 180 --height 64 ``` _Note:_ Both parameters must be passed for the script to read them. Ordering is also important. diff --git a/python/oled/src/rascsi_oled_monitor.py b/python/oled/src/rascsi_oled_monitor.py index 109ef5cb..90ba7d29 100755 --- a/python/oled/src/rascsi_oled_monitor.py +++ b/python/oled/src/rascsi_oled_monitor.py @@ -43,6 +43,11 @@ from pi_cmds import get_ip_and_host from rascsi.ractl_cmds import RaCtlCmds from rascsi.socket_cmds import SocketCmds +from rascsi.common_settings import ( + REMOVABLE_DEVICE_TYPES, + NETWORK_DEVICE_TYPES, +) + parser = argparse.ArgumentParser(description="RaSCSI OLED Monitor script") parser.add_argument( "--rotation", @@ -174,20 +179,17 @@ def formatted_output(): output.append("Permission denied!") elif rascsi_list: for line in rascsi_list: - if line["device_type"] in ("SCCD", "SCRM", "SCMO"): + if line["device_type"] in REMOVABLE_DEVICE_TYPES: # Print image file name only when there is an image attached if line["file"]: output.append(f"{line['id']} {line['device_type'][2:4]} " f"{line['file']} {line['status']}") else: output.append(f"{line['id']} {line['device_type'][2:4]} {line['status']}") - # Special handling for the DaynaPort device - elif line["device_type"] == "SCDP": + # Special handling for network devices + elif line["device_type"] in NETWORK_DEVICE_TYPES: output.append(f"{line['id']} {line['device_type'][2:4]} {line['vendor']} " f"{line['product']}") - # Special handling for the Host Bridge device - elif line["device_type"] == "SCBR": - output.append(f"{line['id']} {line['device_type'][2:4]} {line['product']}") # Print only the Vendor/Product info if it's not generic RaSCSI elif line["vendor"] not in "RaSCSI": output.append(f"{line['id']} {line['device_type'][2:4]} {line['file']} " diff --git a/python/web/src/device_utils.py b/python/web/src/device_utils.py index cf28883f..e5abdff7 100644 --- a/python/web/src/device_utils.py +++ b/python/web/src/device_utils.py @@ -57,7 +57,7 @@ def extend_device_names(device_types): Takes a (list) of (str) device_types with the four letter device acronyms Returns a (dict) of device_type:device_name mappings of localized device names """ - mapped_device_types = [] + mapped_device_types = {} for device_type in device_types: if device_type is "SAHD": device_name = _("SASI Hard Drive") @@ -75,6 +75,6 @@ def extend_device_names(device_types): device_name = _("DaynaPORT SCSI/Link") else: device_name = _("Unknown Device") - mapped_device_types.append({device_type: device_name}) + mapped_device_types[device_type] = device_name return mapped_device_types diff --git a/python/web/src/templates/index.html b/python/web/src/templates/index.html index 47560eef..667f230a 100644 --- a/python/web/src/templates/index.html +++ b/python/web/src/templates/index.html @@ -260,27 +260,19 @@ {% if file["detected_type"] != "UNDEFINED" %} - {% for device in device_types %} - {% for key, value in device.items() %} - {% if file["detected_type"] == key %} - {{ value }} - {% endif %} - {% endfor %} - {% endfor %} + {{ file['detected_type_name'] }} {% else %} {% endif %} @@ -310,7 +302,7 @@ {{ _("Attach Network Adapter") }}