Port the SCSI2Pi Host Services execute-operation and result-retrieval commands, including binary, JSON and text protobuf formats. Route commands through PiSCSI's command handler without socket transport or lock re-entry, and configure attached Host Services devices automatically.
Validate CDB formats and payloads, support transfers larger than the controller's default buffer, correct Mode Sense response lengths, and cover the new protocol with unit tests.
Restore the SCBR device as an X68000 Host Bridge, including the Human68k-compatible host file-system service and the bridge-specific SCSI message handlers. Back its Ethernet path with the TAP driver, derive a stable locally administered MAC address, preserve the driver minimum-frame/FCS expectations, and restrict received traffic to its own unicast frames and broadcasts.
Match the RASCTL/RASETHER/RASDRV bridge protocol that originated in the parent RaSCSI project: dispatch its non-standard message format on READ(10)/WRITE(10) (0x28/0x2a), with type, function, phase, and a three-byte byte count carried in the CDB. Advertise the legacy control channel required by RASCTL, translate its list and device-management commands to PiSCSI operations, and defer stop or system-shutdown requests until after the response is sent, while gating this insecure interface behind a new '-c disabled|media|full' runtime option. Preserve the type-1 Ethernet exchange used by RASETHER and the type-2, phased filesystem exchange used by RASDRV.
Register the device in the factory, protobuf API, controller transfer path, command-line tooling, device listings, and web UI. Share the explicit bridge and proxy-ARP topology workflow with DaynaPort so both adapters validate and use the same mode/interface pair.
Add build support for iconv where needed, extend unit coverage for device creation, RAS* protocol handling, CLI parsing, web attachment, and topology selection, and update the man pages and network-profile documentation for Host Bridge operation and its networking limits.
Move GPIO mappings into a single module and select a board profile at process startup instead of at compile time: Build every GPIO-facing utility for every supported profile. At the same time, we remove support for the historical AIBOM board type since it's the only one using positive logic, the other three variants share the same electrical behavior.
Run piscsi, scsimon, scsiloop, scsidump, or sasidump with -C=STANDARD, FULLSPEC, or GAMERNIUM. FULLSPEC remains the default. To select a profile for the systemd service, set PISCSI_CONNECTION_TYPE and restart the service.
Use the validated image sector size to derive SCSIHD_NEC's sector shift count, instead of the complete image size. This restores correct capacity and MODE SENSE geometry for PC-98 HDN images.
Port the X68000 SASI probe handling and completion-message behavior from the older RaSCSI SASI implementation.
Borrow BlueSCSI v2-compatible Assign Disk Parameters (0xC2) handling: accept its six-byte CDB and consume the ten-byte parameter payload.
Introduce a SASI controller and SAHD disk implementation alongside the existing SCSI path. Select the appropriate controller when attaching a device, prevent SASI and SCSI devices from sharing a target ID, and implement SASI-specific selection, message, status, timing, and LUN handling.
Restore SAHD in the protocol and expose it consistently through the device factory, command-line client, configuration validation, web interface, drive profiles, and manual. Enforce the two-LUN limit for SASI targets wherever device definitions are created or parsed.
Bring back handling of the hdf image format and map it to the SAHD device type. The hdf file ending is the established one for SASI raw disk images used in the X68000 emulation community, however it is a raw data format without any special header.
Add focused C++ and Go coverage for SASI devices, controller selection, LUN validation, and web-facing behavior.
Refactor the DaynaPort TAP driver around explicit bridge and proxy-ARP profiles. Validate the selected interface and profile before creating piscsi0, attach it only to the preconfigured bridge when appropriate, derive a stable DaynaPort MAC address from the uplink, and make TAP setup and cleanup robust.
Add managed host networking profiles for wired bridging and Wi-Fi proxy ARP. Install the PiSCSI NetworkManager templates, profile-management command, parprouted and DHCP relay system services, udev/sysctl hooks, and configuration file so a selected Wi-Fi uplink can provide proxy-ARP networking without altering connectivity during package installation.
Expose DaynaPort profiles consistently through the protocol, daemon, scsictl, and web UI. Report interface type, state, and supported modes; require or default explicit mode/interface pairs on attach; present eligible wired-bridge and Wi-Fi proxy-ARP choices; and validate selections before attaching an SCDP device.
Package and document the new networking workflow. Add the profile utility and required runtime assets to Debian packages, expand the manual-page set and web manual index, update DaynaPort command help, and extend unit and handler tests for the profile-aware behavior.
READ TOC receives its allocation length from the initiator’s CDB and accepts values up to 65535 bytes. The controller’s transfer buffer is normally only 4096 bytes, so using that value directly could overrun the buffer and report more data than can be transferred.
Clamp the response length to the available buffer size and clear only that bounded range before constructing the response. Also bound the start-track scan before dereferencing the track vector, allowing a lead-out (0xAA) request to safely produce its descriptor when no matching track exists.
Add regression tests for the maximum allocation length and for READ TOC lead-out handling.
Resolve symlinked default image folders with canonical() so relative link targets are evaluated from their link location. Replace the tautological default-folder assertion with coverage for missing folders, relative paths, and relative symlink targets.
Reject MODE SELECT Format Device pages whose length differs from the 24-byte page returned by MODE SENSE. Use a complete valid page in the truncation regression and cover both invalid page lengths and transfer lengths exceeding the buffer.
Forward command-line arguments to GoogleTest and mark the Meson target as gtest protocol so filtering, seeds, and individual results are available. Harden the service tests against unavailable socket capabilities and environment-dependent privileged ports, and skip the Linux-only interface assertion elsewhere.
Validate that the declared MODE SELECT parameter list fits in the transfer buffer and contains a complete command header. Validate the block-descriptor list against the remaining parameter-list length before skipping it.
Reject truncated mode-page headers and page bodies before reading them. Report ILLEGAL REQUEST / PARAMETER LIST LENGTH ERROR for truncated headers, block descriptors, and mode pages, as required by SCSI-2 8.2.8; retain INVALID FIELD IN PARAMETER LIST for complete but invalid fields.
Update the hard-disk and magneto-optical fixtures to send complete Format Device pages with their actual MODE SELECT parameter-list lengths. Add regression coverage for truncated headers, descriptors, page headers, and page bodies.
Introduce a server-rendered Go control panel for managing PiSCSI devices, disk images, saved configurations, archives, uploads, system settings, embedded themes and translations, PWA assets, a mock daemon, installation and systemd support, generated protobuf bindings, tests, and CI builds for supported Raspberry Pi targets.
This is built for feature parity with the Python Web UI, with a few notable differences: piscsi-web runs as a non-privileged user, there is no user authentication, the upload form uses a plain stream with no Javascript, the ability to set 'pretty hostname' is removed, and reserved ID memos are removed too.
Update piscsi core to use /var/lib/piscsi/images as its default and resolve relative image folders from the server working directory. Allow valid folders outside the user's home directory, and align the tests, protocol comments, service example, and man pages with the new behavior.
Ship a script and makefile target for migrating user data from old to new file system locations.
The scsictl command parser looks for single letter shorthands for each device type;
this adds 't' for SCTP and changes SCLP to 'p'
Now you can do '-t tape' and '-t printer' for an easy to remember command
Also moves the SCTP default product/vendor into the device factory,
updates the unit tests, and an overhauls the man pages
The X68000 host bridge and associated host file system module
has not been functional for many years, as reported by multiple users
Removing the code will reduce complexity for users -
the SCBR device has caused some misunderstandings in the past -
while eliminating code that has been flagged as insecure by SonarQube
* Revert "Don't ResizeCache on sector change if no filename is defined (#1438)"
This reverts commit dd9a3296d4.
* Revert "Add ModeSense page 0x25 (DEC special function control page) (#1412)"
This reverts commit 1121b8d9d6.
* Revert "DiskCache needs a size"
This reverts commit 7cc8df271c.
* Revert "Honor sector size change via ModeSelect6 in scsicd (#1406)"
This reverts commit b7f65d33e2.
* Revert "Multiple fixes for ModeSelect (#1405)"
This reverts commit ad5eae93e7.
* Add tests for issue#1426
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* add test without medium
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Don't resize DiskCache without a file
DiskCache computes its size from a file.
Skip ResizeCache Without file (i.e. 'empty' CD)
Fixes#1426
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Add ModeSense page 0x25 (DECSpecialFunctionControlPage)
VAXServer 3100 (CPU KA41-E) console firmware issues ModeSense(6)
page 0x25 when probing for disks. A disk won't be recognized if
this returns an error.
The DEC SCSI specification[1], section 8.5 documents this page.
[1] https://manx-docs.org/collections/antonio/dec/dec-scsi.pdfFixes#1410
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Make ModeSelect() non-const
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Implement ModeSelect for scsicd
and honor sector size setting.
DEC's VMS can't handle 2k sector sizes and uses ModeSelect6 to set the
sector size to 512 bytes.
Fixes#1397
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Test sector size setting via ModeSelect in SCSICD
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Re-calculate total blocks when sector size changes
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Reset CD data tracks after sector size change
The track calculation is based on sector size and must be reset after
change of sector size.
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* resize cache after change of sector size
The disk cache is based on sector size and must be resized when the
sector size changes.
Disk::ResizeCache needs a `raw` parameter, make this value accessible
from the current cache.
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Make GetRawMode const
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
---------
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Allow 'empty' ModeSelect6
tl;dr
Treat a computed length of 0 as `has_valid_page_code`.
Details:
The SRM console (aka 'BIOS') of DEC Alpha sends an empty
ModeSelect6 with the following data:
~~~
ModeSelect6, CDB $151000000c00
~~~
That makes 12 byte(s) as follows
~~~
0 1 2 3 4 5 6 7 8 9 10 11
00 00 00 08 00 00 00 00 00 00 02 00
~~~
decoding it (accoring to [1], Section 8.3.3, Table 94) gives us
Mode Data Length 0
Medium Type 0
Device-specific 0
Block desc len 8
Density Code 0
Number of blks 0
Reserved 0
Block length 512
`scsi_command_util::ModeSelect` computes
~~~
offset = 4 + buf[3];
~~~
giving 12 and
~~~
length -= offset;
~~~
giving 0.
Thus it never enters the `while` loop and `has_valid_page_code` stays
`false`, raising an error.
[1] [Small Computer System Interface - 2 rev 10L.pdf](https://dn790004.ca.archive.org/0/items/SCSISpecificationDocumentsSCSIDocuments/Small%20Computer%20System%20Interface%20-%202%20rev%2010L.pdf)
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Allow ModeSelect with page code 1
OpenVMS Alpha (the operating system, not the SRM BIOS) uses
ModeSelect6 with a page code of 1.
The semantics are unknown, just accepting it works for me.
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Fix page length computation in ModeSelect
tl;dr
The 'skip to next ModeSelect page' computation was off-by-one, either not
taking the page code itself into account or missing the fact that the
page length is given as `n - 1`.
Fix:
Add 1 to the computed length.
Details:
OpenVMS Alpha sends a ModeSelect6 as follows
~~~
command:
ModeSelect6, CDB $151000001900
payload:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
00 00 00 08 00 00 00 00 00 00 02 00 01 0a 24 00 00 00 00 00 00 00 00 00 00
~~~
This translates to (accoring to [1], Section 8.3.3)
~~~
Mode Data Length 0
Medium Type 0
Device-specific 0
Block desc len 8
~~~
with the following offset / length computation _before_ the `while` loop
~~~
offset = 12
length = 13
~~~
The first payload section is
~~~
4 5 6 7 8 9 10 11
00 00 00 00 00 00 02 00
~~~
translating to
~~~
Density Code 0
Number of blks 0
Reserved 0
Block length 0x200 512
~~~
Then follows a pagecode 1 as
~~~
12 13 14 15 16 17 18 19 20 21 22 23 24
01 0a 24 00 00 00 00 00 00 00 00 00 00
~~~
translating to
~~~~
Page code 1
Page length -1 10
Mode parameters 24 00 00 00 00 00 00 00 00 00 00
~~~
computing (inside the `while` loop, as `// Advance to the next page`)
~~~
size = 10 + 2 = 12
~~~
followed by new `offset` and `length` values
~~~
offset = 25
length = 1
~~~
So it stays in the `while` loop (and has a larger-than-buffer `offset`
value)
Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
* Improve how commands are internally executed
* Use const CommandContext for execution
* Update error handling
* Fix SonarQube issues
* Remove duplicate code
* Use mutex instead of atomic_bool
* Add hasher
* Add param_map
* Do not log unknown operations as an error for backward/foward compatibility