Commit Graph
135 Commits
Author SHA1 Message Date
Daniel Markstedt e9e48b7fca remove plain text man page generation 2026-08-23 17:40:58 +02:00
Daniel Markstedt 57dfca91c8 meson: rename build targets option to 'targets' 2026-08-23 14:45:47 +02:00
Daniel Markstedt f103292867 fix error in ReadProxyArpUplinkFile unit test 2026-08-23 14:45:47 +02:00
Daniel Markstedt cbf399cc30 bump release version to 26.8.1 2026-08-23 14:45:47 +02:00
Daniel Markstedt e2735813a3 parprouted bridge for SCDP adapter
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.
2026-08-23 12:15:13 +02:00
Daniel Markstedt 420d4eea21 remove compile time stamps to enable reproducible builds
while the timestamp when the binary was built can be handy for
knowing when a development build was created, it breaks reproducible
builds which is a fatal error when doing Debian deb packaging

also strips away the redundant trailing version string from the banner
2026-08-21 07:09:06 +02:00
Daniel Markstedt fa878e3133 create Debian packaging files
Debian deb packaging files for all four targets: piscsi, piscsi-web,
piscsi-oled, piscsi-ctrlboard

build instructions for Trixie specifically in README.Debian

consolidate all systemd unit files and standardize on /usr/bin
for all binaries
2026-08-21 07:09:06 +02:00
Daniel Markstedt 51ac8cb42d properly initialize piscsi controller before running test
also, add assertions to the GetInitiatorId calls right afterwards
2026-08-17 19:57:05 +02:00
Daniel Markstedt 353bb48878 bump copyright years to 2026 2026-08-17 19:56:46 +02:00
Daniel Markstedt a4b64fc1eb scsiloop: gate hardware diagnostics by platform
Replace getopt() and usleep() dependencies with portable C++ parsing and sleeps. Refuse to execute the GPIO loopback diagnostic off Linux/Raspberry Pi hardware, and omit the hardware-only target from non-Linux Meson builds.
2026-08-15 16:33:15 +02:00
Daniel Markstedt fec28e6795 bound CD-ROM READ TOC allocation length to the transfer buffer
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.
2026-08-11 07:05:54 +02:00
Daniel Markstedt 4e9d0de1f8 image: resolve default-folder symlinks canonically
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.
2026-08-02 23:18:40 +02:00
Daniel Markstedt 6593547c69 scsi: validate Format Device page length
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.
2026-08-02 23:18:40 +02:00
Daniel Markstedt 4ac28cff38 tests: make Meson unit runs diagnosable
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.
2026-08-02 23:18:40 +02:00
Daniel Markstedt 3fab138bf5 Make Meson unit tests portable to macOS 2026-08-02 23:18:40 +02:00
Daniel Markstedt beea830a12 use a fixture to clean up between tests 2026-08-02 23:18:40 +02:00
Daniel Markstedt 42f48ade04 validate MODE SELECT parameter lists
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.
2026-08-02 23:18:40 +02:00
Daniel Markstedt bb9e3b4a78 update hd and mo test with valid page data 2026-08-02 23:18:40 +02:00
Daniel Markstedt f8e35314cb protect against empty operation 2026-08-02 23:18:40 +02:00
Daniel Markstedt dba5f9be3d executor: validate existing devices without blocking ATTACH 2026-08-02 23:18:40 +02:00
Daniel Markstedt 4564e427ef create meson build scripts
Adds a suite of meson scripts for building the C++ project
2026-08-02 23:18:40 +02:00
Eric Helgeson 7bef2d72ae rewrite Web UI in Go
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.
2026-08-01 12:30:27 +02:00
Jan-Benedict Glaw 13af059d95 Fix logging for unknown commands
I'm currently debugging why NetBSD cannot access a simulated
DEC RRD42 drive. The log shows this command is received:

Mar  6 09:31:55 piscsi PISCSI[479]: [2026-03-06 09:31:55.710] [trace] (ID 5) - Received unknown command: $0Q

This is actually 0x51 (= ASCII 'Q')
2026-03-07 08:35:55 +01:00
Jan-Benedict Glaw 1bab197cae scsidump: Allow to start at a specific offset
I'm using `scsidump` to dump old SCSI drives and from time to time, I run into
errors. With this patch, I can resume a transfer (and will only lose 64 KB.)
2026-01-07 04:39:42 +09:00
Daniel Markstedt 00743d1126 force man page to plain text output to 80 char width 2026-01-02 07:09:22 +09:00
Daniel Markstedt 363760f2cc Update version numbers for release 25.12.1 2025-12-30 15:39:07 +01:00
Daniel Markstedt 6b7d140351 Reintroduce clang-format rules and remove IDE specific configuration
This reverts a previous change where configurations for the Eclipse IDE specifically was introduced.

I think it's more important to have an IDE agnostic formatting framework, which clang-format provides

Example command for formatting all C++ source code, as run from within the cpp dir:

find . -iname '*.h' -o -iname '*.cpp' | xargs clang-format -i
2025-12-24 09:53:51 +01:00
Daniel Markstedt 7dc49d2311 Reduce overly detailed usage help text and refer to the man pages
This will reduce the recurring maintenance overhead of keeping the same information up to date in multiple places

Only the most common use cases are covered in the usage help text now
2025-12-24 01:03:47 +01:00
Daniel Markstedt a99e1c51b9 Move the protobuf source into its own dir in the repo root
The protobuf source file is used by more than just the C++ code,
so let's move it into its own location for consistency and discoverability
2025-12-03 23:20:46 +01:00
Daniel Markstedt db31ba291f have all objects depend on generated protobuf code (#1437)
Protect against compiler errors due to the protobuf header not existing yet when you compile multi threaded
2025-11-28 09:00:07 +01:00
Daniel Markstedt f26fd6567a Override Eject function for Streamer device (#1538)
In order for the Eject command to properly release the image and reset the status,
we need to override the Eject function with the appropriate logic

The other removable disk drive devices inherit the Disk class,
and hence do not need this
2025-11-23 09:05:18 +01:00
Chris Hooper 25718e0887 Add support for drives larger than 2 TB (Closes: #1551)
Mode Sense (6) supports a 32-bit number for the maximum block count, where Mode Sense (10) supports a 64-bit number for the count. The Seagate SCSI Commands Reference Manual from 2016, has this to say about a "Short LBA mode parameter block descriptor" as returned by Mode Sense (6):

>  On a MODE SENSE command, if the number of logical blocks on the
>  medium exceeds the maximum value that is able to be specified in
>  the NUMBER OF LOGICAL BLOCKS field, the device server shall return
>  a value of FFFFFFFh.

Similarly, the Read Capacity (10) command should return FFFFFFFFh if the capacity of the drive exceeds 2^32 sectors, and that a driver should then know to use Read Capacity (16) if it supports that command.

There may be an unexpected side-effect if presenting a drive of more than 2^32 sectors to a legacy host that does not support devices that large. The Read Capacity commands specify the value returned as the last addressable sector on the device. This means that typically, an application which uses the value returned by that command is going to add 1 to it to get the actual number of blocks on a given device. If the program is not aware of Read Capacity (16), and is not using greater than 32-bit math, then it might report to the user that the total number of sectors on the drive as 0. I don't view this as a huge problem, however. In that case, the legacy driver wouldn't correctly support the capacity of the drive anyway, so providing that driver with a device that is 2 ^ 32 sectors or larger wouldn't make sense from the user perspective.
2025-11-18 21:03:26 +01:00
Daniel Markstedt c642592551 Use generic SCSI TAPE product name and add more SCTP profiles 2025-11-10 19:51:57 +01:00
Daniel Markstedt 567dca9cc3 Add device type shorthand 't' for Tape, and change printer to 'p'
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
2025-11-10 19:51:57 +01:00
Daniel Markstedt 7f57c9e28d Introduce option to set the minimum execution time of SCSI commands (#741)
For the Status, DataIn, and DataOut phases, piscsi has a 50 microsecond
sleep implemented, which has proven a stabilizing factor for the bus
on most SCSI initiators

However, Akai S1100 and other samplers of a similar vintage need a longer
sleep time for reliable operation, so a -s option for piscsi has been
introduced to set the value to an artbitrary number at runtime
2025-11-09 09:37:33 +01:00
Daniel Markstedt b7e7c4e529 Remove bitrotted X68000 host bridge device
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
2025-11-09 08:45:56 +01:00
BogDan Vatra 18bb9548a7 Use same notation as scsi2pi 2025-11-07 18:20:31 +01:00
BogDan Vatra a985fc83e4 Say hello to Streamer (tape) device support
Implements the mandatory and a few optional commands for tandberd see
https://bitsavers.org/pdf/tandbergData/TDC4100/6047-1_TDC-4100_SCSI-2_Interface_Functional_Specification_Aug1991.pdf
for more info.

Fixed #480
2025-11-07 07:43:21 +01:00
Daniel Markstedt 847c46e3c7 Update copyright year to 2025 in piscsi_util.cpp 2025-11-06 21:28:04 +01:00
Rick Altherr b95c52dc85 Fix VCD timestamps (#1469)
* Fix VCD timestamps.

VCD simulation timestamps are integers.
eb71c31cf1 changed them to doubles which
causes the files to be unreadable.

* Fix VCD byte values

no spaces allowed between b and the bits.  Value will be left-extended
with zeros.
2024-06-20 19:27:06 -05:00
Daniel Markstedt adfe0e4823 Update version for development 2024-05-01 16:10:39 +09:00
Daniel Markstedt e540da06c4 Update version number for release 2024-04-29 18:32:28 +09:00
Daniel Markstedt 1919eb34bb Bump software copyright year to 2024 2024-04-23 08:00:58 +09:00
Daniel Markstedt a6a8cadf21 Revert fixes for DEC vendor specific pages and CD-ROM block size changing (#1451)
* 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.
2024-04-13 03:40:53 -07:00
Klaus Kämpf dd9a3296d4 Don't ResizeCache on sector change if no filename is defined (#1438)
* 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>
2024-02-27 11:20:22 +09:00
Uwe Seimet 24372ba939 Fix wrong warning about CD-ROM image file size 2024-02-27 11:18:01 +09:00
Uwe Seimet 4ae03e2ec7 Properly close file to be printed (#1428) 2024-02-03 07:51:44 +09:00
Daniel Markstedt 274b93fe27 Update unit tests 2024-01-27 07:22:19 +09:00
Daniel Markstedt 12d43f370d Update unit tests 2024-01-27 07:22:19 +09:00
Daniel Markstedt 040e5532a8 Recognize .cdr and .toast as CD-ROM image file endings 2024-01-27 07:22:19 +09:00