Commit Graph

521 Commits

Author SHA1 Message Date
Tony Kuker b5ddb88e6a Update revision number for release 22.08.01 2022-08-28 22:19:06 +01:00
Uwe Seimet 7fc84c4217
Initial unit tests based on GoogleTest and GoogleMock (#802)
* Initial dummy test

* Makefile update

* Make protected method visible

* Test update

* Test update

* Updated mode page device

* Only build tests with explicit test target

* make test builds and executes tests

* Replaced constant

* Added TODO

* Merged develop

* Added unit test

* Comment update

* Unit test update

* Added tests

* Added tests

* Test cleanup

* Updated error handling

* Reverted MODE SENSE change

* Reverted last change

* Use GoogleMock

* Comment update

* Signature update

* Cleanup

* Cleanup

* Further cleanup

* Removed obsolete comment

* Updated error handling

* Cleanup

* Added TODO

* Added test

* Added test

* Renaming

* Added test

* Cleanup

* Header update

* Added two tests

* Renaming

* Fixed test argument order

* Namespaces are needed in order to avoid name clashes

* Added test

* Added tests

* Added tests

* Added tests

* Added tests

* Updated host services test

* Merge with develop

* Moved code

* Renaming

* Added tests

* Added tests

* Initial device tests

* Test cleanup

* Added test

* Removed cast

* RASCSI_TEST target has to depend on SRC_PROTOBUF
2022-08-28 12:25:08 -05:00
Uwe Seimet eeae12ac4d
Host services do not support an image file (#812) 2022-08-26 09:50:18 -05:00
akuker c6da145f0f
handle the return value of write() (#810)
Co-authored-by: Tony Kuker <akuker@gmail.com>
2022-08-26 10:19:42 +02:00
Daniel Markstedt 15c14e0404
Rebrand to RaSCSI Reloaded in C++ codebase (#805) 2022-08-25 20:01:39 -05:00
Uwe Seimet 440fa65009
Return partial mode page data depending on allocation length (#793) 2022-08-19 19:34:31 -05:00
akuker b902ae6ff9
#782 compiler interprets 08 as octal, which is invalid (#784)
Co-authored-by: Tony Kuker <akuker@gmail.com>
2022-08-02 16:31:15 +02:00
Tony Kuker 136e915f0c Update version for next development version 2022-08-01 01:43:29 +01:00
Tony Kuker ca3ded37f2 Update revision number for release 2022-08-01 01:41:10 +01:00
Daniel Markstedt e51517ca60
Rebrand to RaSCSI Reloaded in key places in the code (#772)
* Add Reloaded to readme

* Add Reloaded to prominent places in the web app

* Add Reloaded to the rascsi startup message
2022-07-26 10:20:50 -05:00
Tony Kuker a5d397b3fc Update version for next development ersion 2022-05-08 20:24:34 +01:00
Tony Kuker 4cb2b64a23 Updated version for 22.5.02 release 2022-05-08 20:19:30 +01:00
Uwe Seimet a3a53354cc
Fix issue 750 (Daynaport problems in develop branch) (#754)
INQUIRY for the Daynaport can return up to 37 bytes. The additional length field for the Daynaport is now 0x20 instead of 0x1b.
2022-04-26 22:08:28 +02:00
Uwe Seimet cb3011de99
Mode page value improvements (#734)
* Updated mode page values

* Page size update

* Caching parameters are not changeable
2022-03-13 19:47:54 -05:00
Uwe Seimet 32fb022a41
Updated MODE SENSE error handling in case of an overflow (#732)
* Updated MODE SENSE error handling

* Updated range check
2022-03-13 19:46:43 -05:00
Uwe Seimet 08156f763f
Only return RTC page if not changeable pages are requested (#731) 2022-03-13 19:45:52 -05:00
Uwe Seimet f32c20883e
Ignore unknown parameters and log a warning (#730)
* Ignore unknown parameters and log a warning

* Added comment

* Updated logging
2022-03-13 19:44:16 -05:00
Uwe Seimet 9099d7249c
SASI FORMAT opcode fix, SASI segfault fix, added SASI INQUIRY/READ CAPACITY, 512 bytes per sector SASI drives (#724)
* Fixed opcode

* Fixed segfault

* Re-added 0x06 as additional SASI FORMAT opcode

* Added support of SASI drives with 512 bytes

* SASI LUN must always be taken from CDB and must be 0 or 1

* Fixed typo

* Fixed one more SASI segfault

* Removed duplicate code

* Updated error handling

* Updated error handling

* Logging update

* Added enum value for SPC-6

* Comment update

* Added support for SASI Inquiry

* Updated SASI LUN check

* Updated SASI LUN handling

* Comment update

* Revert "Comment update"

This reverts commit c6adbde25c.

* Updated logging

* Implemented SASI READ CAPACITY

* Validate SASI block count

* Do not support ICD semantics for SASI drives

* SASI READ CAPACITY is a group 1 command with 10 bytes

* Comment update
2022-03-06 09:17:23 -06:00
Uwe Seimet af9638ce48
Validate SEEK block address (#719)
* Validate SEEK block address

* Ignore block count for SEEK

* Updated REPORT LUNS
2022-03-03 12:53:11 -06:00
Uwe Seimet 305a7fb99d
Use enums for device type and scsi level (#718)
* Use enums for device type and scsi level

* Renaming

* Use new enum instead of magic values

* Comment update

* Fixed REQUEST SENSE regression
2022-03-02 11:31:42 -06:00
Uwe Seimet 1df7cdb1f3
Use vector for INQUIRY data, LUN list can have gaps, made methods const (#713)
* Use vector for INQUIRY data, Inquiry() is const, moved EVPD check

* Moved code

* Fixed warning

* Updated memcpy

* Set length

* Limit result vector size

* Limit result buffer size

* Inquiry() result buffer handling update

* Logging update

* Inquiry cleanup

* NEC drive can also use PrimaryDevice::Inquiry()

* NEC drive is never removable

* Comment update

* Bridge can also use PrimaryDevice::Inquiry()

* Removed unused method argument

* Comment update

* Updated comment

* Updated REQUEST SENSE buffer handling

* Fixed typo

* Fixed typo

* Re-added comment

* Updated additional length handling

* Check for INQUIRY command support first

* Added assertion

* Size handling update

* Renaming

* Renaming

* Removed obsolete casts

* Cleanup

* Moved error codes to scsi_defs namespace

* Fixed ReadDefectData10

* Comment update

* Updated buffer handling

* Data type update

* SendDiagnostic is now const

* Removed obsolete forward declaration

* removed unused enum

* Reduced method visibility

* Renaming

* GetSendDelay() can be const

* Made method const

* Made method const

* Added TODO

* Use iterator

* Made method const

* Revert "Made method const"

This reverts commit 38412b8ddd.

* No need to sort all set/maps

* Do not sort all sets

* Removed more unnecessary sorting

* Cleaned up includes

* More include cleanups

* Updated REPORT LUNS

* LUNs must not be consecutive anymore

* Updated detaching of LUN

* Improvements for devices without LUN 0

* Assume LUN 0 is always present

* Enforce presence of LUN 0

* Updated error handling
2022-03-01 20:25:22 -06:00
Uwe Seimet 0e8d89e827
Code cleanup, in particular related to MODE SENSE (#699)
* Replace member functions

* Fixed TODO

* Added TODOs

* Added TODOs

* Removed duplicate code

* Fixed return value

* CD-ROM mode pages are provided by the CD-ROM implementation

* MO mode pages are provided by the MO implementation

* Comment update

* Removed duplicate code

* Removed more duplicate code

* Optimization

* Updated mode page size handling

* Addec TODO

* Started more flexible mode page handling

* Map mode pages

* Page 0 must be last

* Error handling update

* Updated size handling

* Updated map handling

* Use map references

* Move superclass call

* Added comment

* Host services also support mode page 0x3f (all pages)

* Updated handling of page 0

* Removed duplicate code

* Updated buffer size handling

* Code cleanup

* Removed duplicate code

* Use calloc()

* Removed duplicate code

* Comment update

* Fixed buffer offset

* Fixed TODO

* Added buffer size check

* Comment udpate

* Logging update

* Updated logging

* Avoid potential memory leak

* Updated handling of page 0

* Added TODO

* Comment update

* Fixed error message

* Use vector instead of byte array

* Optimization

* More optimizations

* Removed duplicate code

* Do not try to add more pages when buffer is full

* Updated error message

* Comment update, fixed host services message length handling

* Code cleanup, optimizations

* Updated payload handling for page 0

* Fixed TODO

* Updated handling of PS field

* Fixed offsets

* Updated handling for page 0

* Code cleanup

* More cleanup

* Updated block descriptor handling

* Result of REPORT LUNS must not depend on whether a device is ready or not

* Printer uses a dynamically allocated buffer

* Use realloc

* Updated memory handling

* Added assertion

* Comment update

* Fixed initialization

* Reset byte transfer flag

* Updated usage of realloc

* Reverted some changes

* Re-added buffer size check

* Renaming

* Inquiry for hard disk must also work when drive is not ready

* Primary device checks EVPD

* Added page code check to Inquiry

* Explicitly set response level format

* Added comment

* Removed useless cast

* Fixed inconsistencies in setting the additional length

* Logging uodate

* Updated logging

* Made methods const

* Moved code

* Added TODO

* Added vendor page

* Reduced visibility

* Code cleanup

* Mark override

* Removed duplicate cast

* Synchronized host services mode page handling with other code

* Added TODO

* Signature update

* Moved code

* Removed duplicate code

* Fixed TODO

* Removed duplicate code

* Added buffer size check

* Improved buffer size check

* Code cleanup

* Removed useless assertions

* Cleanup

* Renaming

* Added overrides

* Removed unnecessary casts

* Cleanup

* Added TODO

* Removed obsolete memset

* Removed duplicate code

* Logging update

* Logging update

* Assertion update

* Removed useless comments

* Code cleanup

* Removed obsolete casts

* User super typedef

* Updated log messages

* Fixed #712

* Updated error handling

* Removed useless assertions

* Reduced casts to Disk*

* Updated sector size list argument

* Removed obsolete casts

* Removed comment
2022-02-27 15:58:01 -06:00
Uwe Seimet 33bfe42017
Replaced zlib by internal crc32() method (#698) 2022-02-27 15:24:50 -06:00
Uwe Seimet f5f5c002aa
Added reboot support (#696) 2022-02-22 19:08:22 -08:00
Uwe Seimet 7290803ace
Removed untested/unsupported NetBSD-related code (#694) 2022-02-22 19:07:06 -08:00
Uwe Seimet ba8ad2e7f5
Fixed missing media change handling (#690)
* Remember media change

* Added comment

* Added TODO

* Updated SCSI level for host services to SPC-5

* Manpage update
2022-02-21 21:01:17 +01:00
Uwe Seimet 2beb78727f
Added support for new interfaces syntax (#684)
* Added support for new interfaces syntax

* rasctl output update

* Added operation parameters

* Fixed typo

* Manpage update

* Added deprecation warning

* Moved parser

* Updated parser

* Updated parameter override

* Removed debug code

* Made netmask handling more flexible

* Updated logging

* Logging update

* Logging update

* Comment update

* Removed unused field

* Replaced BOOL by bool

* Moved code

* Logging update

* Removed useless comments

* Added TODZ

* Logging update

* Logging update

* Logging update

* No need to report that an error is an error twice

* Removed duplicate logging

* Updated error handling

* Updated error handling

* Fixed typo

* Removed magic constant

* Fixed 32 bit platform issue

* Signature update

* Fixed message string

* Comment update

* Fixed SCSI command opcode

* Updated StopPrint

* Logging update

* Removed obsolete casts

* Renaming

* Removed duplicate logging

* Updated flushing caches

* Added FlushCache() method

* Reduced visibility

* Reduced visibility

* Reduced visibility

* Code cleanup, removed useless comments

* Removed useless comments

* Updated error handling

* Removed duplicate code

* Manpage update
2022-02-20 18:40:30 +01:00
Uwe Seimet 81ca3c0ce8
Added filename placeholder, execute print command as lp, fixed memory leaks (#677)
* Added filename placeholder

* Comment update

* Execute print command as lp user

* Comment update

* Comment update

* Added operaton parameters

* Sort parameter output by name

* Removed assertion

* Revert "Removed assertion"

This reverts commit f9ab582ddc.

* Include cleanup

* Code cleanup

* Updated SCSI reset

* Fixed memory leak

* Revert "Fixed memory leak"

This reverts commit 2dbbdcd192.

* Fixed memory leak

* Fixed memory leak

* Updated operation count check

* Fixed memory leaks

* Delete temporary PbOperationInfo
2022-02-18 12:06:33 -08:00
Uwe Seimet e13cf1ebb4
Resolved TODO, rascsi guarantees that LUN 0 is always present (#681) 2022-02-18 12:04:07 -08:00
Uwe Seimet 2281a7e53b
Bridge is not yet ready to not subclass Disk (#679) 2022-02-18 12:03:22 -08:00
Uwe Seimet 419dca3c4c
Added support for SCSI printer device (SCLP) (#670)
* Fixed buster compile-time issue

* Host services inherit from ModePageDevice

* Call base class

* Visibility update

* Updated includes

* Updated dispatcher

* Added TODOs

* Logging update

* Code cleanup

* Use namespace instead of class for ScsiDefs

* Renaming

* Cleanup

* Use dispatcher template in order to remove duplicate code

* Updated all dispatchers

* Clean up commands

* Removed duplicate code

* Removed duplicate code

* Updated template definition

* Fixed typo

* Fixed warning

* Code cleanup

* Device list must be static

* Cleanup

* Logging update

* Added comments

* Cleanup

* Base class update

* SCSIBR is not a subclass of Disk anymore, but of PrimaryDevice

* Updated includes

* Fixed compile-time issue on the Pi

* Header file cleanup

* Interface cleanup

* Removed wrong override

* include file cleanup

* Removed obsolete usage of streams

* Removed more stream usages

* Stream usage cleanup

* Include cleanup

* Renaming

* Include cleanup

* Interface update

* SCLP device skeleton

* Initial RELEASE/RESERVE UNIT

* Added full set of commands

* Extracted command phase code

* Stripped SCSI controller code

* Removed unused code

* Commented out code

* Initial naive implementation

* Added debug output

* Disable printing for now

* Updated file handling

* Updated DataOut()

* Added comment

* Updated assertion

* Comment update

* Updated assertion

* Code cleanup

* Reset bytes to transfer

* Reverted change

* Refactoring

* Moved assertion

* Updated ReceiveBytes()

* Removed override

* Added interface

* Code cleanup

* Updated TEST UNIT READY

* Added flag for byte-oriented transfer

* Updated TEST UNIT READY

* Length handling update

* Updated bytecount handling

* Fixed warning

* Added TODO

* Updated assertion

* Enabled priting

* Updated error handling

* Code cleanup

* Logging update

* First working version

* Use temporary file

* Logging update

* Handle parameters

* Updated format string

* Updated logging

* File handling update

* Code cleanup

* Fixed buffer size

* Updated file handling

* Manpage update

* Initial reservation handling

* Updated reservation handling

* Initial reservation testing

* Remember initiator ID

* Extract initiator ID

* Updated SCSI initiator ID handling

* Logging update

* Added reservation timeout

* Updated timeout handling

* Code cleanup

* Only pass initiator ID to *SCSI* controller

* Added comments

* Added comment

* Implemented STOP PRINT

* Comment update

* Comment update

* Comment update

* Added comment

* Comment update

* Removed useless comments

* Updated printer parameter handling

* Updated parameter handling

* Manpage update

* Manpage update

* Comment update

* Default printer product name update

* Renaming

* Updated logging

* Logging update

* Logging update

* Comment update

* Code cleanup

* Added printer shortcut

* Comment update

* Comment update

* Output formatting update

* Updated error handling

* Code cleanup

* More cleanup

* Revert "More cleanup"

This reverts commit 05708986ee.

* Output formatting update

* Output format update

* Sort parameters

* Comment update

* Improved parsing of parameters

* Manpage update

* Updated SCSI level

* Removed magic constants

* Removed magic constant

* Template update

* Template usage update

* Get rid of SASIDEV for printer

* Get rid of SASIDEV for host services

* Moved initiator_id field

* Moved field

* Moved field

* Added comment

* Error handling must use effective LUN

* Removed obsolete casts

* Removed unused method declarations

* Comment update

* Code cleanup

* More code cleanup

* Optimization

* Removed duplicate code

* Logging update

* Fixed warning

* Code cleanup

* Added TODOs

* TODO update

* Backwards compatibility update

* Comment update
2022-02-16 20:04:42 -06:00
Uwe Seimet 511c55a720
Added work-around for the Atari Daynaport driver (#665) 2022-02-15 18:13:22 -08:00
Uwe Seimet 45cd5e58d1
Inheritance hierarchy improvements, reduced dependencies to Disk class (#662)
* Fixed buster compile-time issue

* Host services inherit from ModePageDevice

* Call base class

* Visibility update

* Updated includes

* Updated dispatcher

* Added TODOs

* Logging update

* Code cleanup

* Use namespace instead of class for ScsiDefs

* Renaming

* Cleanup

* Use dispatcher template in order to remove duplicate code

* Updated all dispatchers

* Clean up commands

* Removed duplicate code

* Removed duplicate code

* Updated template definition

* Fixed typo

* Fixed warning

* Code cleanup

* Device list must be static

* Cleanup

* Logging update

* Added comments

* Cleanup

* Base class update

* SCSIBR is not a subclass of Disk anymore, but of PrimaryDevice

* Updated includes

* Fixed compile-time issue on the Pi

* Header file cleanup

* Interface cleanup

* Removed wrong override

* include file cleanup

* Removed obsolete usage of streams

* Removed more stream usages

* Stream usage cleanup

* Include cleanup

* Renaming

* Include cleanup

* Interface update
2022-02-13 13:30:02 -06:00
Uwe Seimet 5622694701
Host services (SCHS) with realtime clock and shutdown, improved device inheritance (#647)
* Initial RTC skeleton

* Added device info

* Added TEST UNIT READY

* Fixed command dispatcher

* First untested naive implementation

* Comment update

* Code cleanup

* More code cleanup

* Updated date/time encoding

* Updated versioning

* Use standard RaSCSI INQUIRY version for SCRT device

* Manpage update

* Added shortcut for SCRT type

* Added support for rtc "filename"

* RTC supports LUNs > 0

* Fixed LUN count

* Renaming

* Renaming

* Manpage update

* Initial naive implementation

* SCRA is removable

* Updated command list

* Added controller field

* Shut down works, bus free phase is not yet entered

* Clear caches on shutdown

* Expose BusFree()

* Moved code

* Logging update

* Moved code

* Moved code

* Added comment

* Logging update

* Code cleanup

* Service device is not removable anymore (was only needed for testing)

* Manpage update

* Added comment

* Comment update

* Version update

* Renaming

* Comment update

* Comment update

* Renaming

* Fixed typo

* Added convenience method

* Property handling optimization

* Code cleanup

* Code cleanup

* Code cleanup, introduced base class

* Added TODO

* More code cleanup

* Removed unnecessary assignments

* Moved code

* Removed forward declaration

* Added base class

* INclude cleanup

* Moved scsi_command enum

* Fixed warnings

* Addressing circular dependencies

* Removed duplicate enum

* include file cleanup

* Include cleanup

* Reduced dependencies to Disk class (replaced by Device), fixed TODO

* Include cleanup

* PrimaryDevice implements ReportLuns

* Inheritance update

* Removed duplicate code

* Moved code to base class

* Cleanup

* Removed duplicate field

* Updated command dispatchign

* Comment update

* Moved code

* Updated method visibilities

* Moved MODE SENSE/MODE SELECT base code
2022-02-10 12:54:48 -06:00
Uwe Seimet 0a55680a50
Fixed segfault (#654) 2022-02-07 16:11:44 -08:00
Tony Kuker c80e010196 Update version for next development version 2022-02-06 20:00:48 +00:00
Tony Kuker 87865d2f38 Update revision number for release 2022-02-06 19:57:43 +00:00
Uwe Seimet 9d0d78a643
Flush the cache on STOP UNIT (#644) 2022-02-06 13:44:28 -06:00
Uwe Seimet 36cadd78fc
Flush the RaSCSI write cache on SYNCHRONIZE CACHE (#645) 2022-02-06 13:43:50 -06:00
Uwe Seimet d9b4e1fc1f
Support ICD (Atari ACSI) command semantics (#640)
* Initial ICD support

* Comment update

* Comment update

* Comment update

* Update README.md
2022-02-04 19:45:10 -06:00
Uwe Seimet cb2553a9eb
Permit LUNs > 0 for SCDP and SCBR (#641) 2022-02-03 19:37:31 -06:00
Uwe Seimet ed46262cca
Added configurable network interface name support to rascsi (#635)
* Added support for explicit network interface name to rascsi

* Fixed patch_version for development build
2022-02-01 20:52:49 -08:00
Benjamin Zeiss ffb0aa61b4
fix for #621. (#624) 2022-01-29 11:06:10 -08:00
Uwe Seimet 7f362c9308
MODE SENSE: Fixed wrong ALLOCATION LENGTH handling (#617)
* Log PCF

* Code cleanup

* Logging update

* Updated error handling

* Updated setting of MODE SENSE return data size

* Added comments

* Removed useless assertions

* Updated logging

* Comment update

* Updated logging

* Formatting update

* Comment update
2022-01-20 09:04:59 -06:00
Benjamin Zeiss 17497cf1fe clean squashed restructuring branch. #455 2022-01-09 20:22:19 +01:00
akuker b52abbfdc7
Output higher-level report from scsimon (#596)
* Output JSON file for post-processing

* Debug utility for parsing the SCSI data

* Prototype app for parsing scsi captures

* correct arg parsing

* output html

* Cleanupt html output

* Add missing include

* Allow compilation on non-Linux platforms

* Refactored scsimon to be in multiple files

* Refactored away

* Restructured scsimon into smaller pieces

* Added ability to read in pre-generated .json file and re-parse it

* Delete scsiparse.cpp

* Fix argument parsing and code cleanup

* Ran vscode c++ formatting utility

* Restore the -Wno-psabi flag for Linux only

* Address compiler warnings

* Updated to use C++ style ostreams

* Cleanup conversion to c++ style ostreams

* Updated to use ofstream instead of fprintf

* Delete src/raspberrypi/scsimon directory

Co-authored-by: akuker <akuker@gmail.com>
2022-01-07 12:17:44 -06:00
Daniel Markstedt 1c84bb34f9
Shorten file names when downloading to AFP (#592) 2022-01-04 21:08:28 -06:00
n4al a240198123
N4al/spanish localisation (#594)
* Adding Spanish localisation to localizer.cpp

* Addind Spanish localisation for the Web Interface
2022-01-04 16:04:54 +01:00
RaSCSI User 7e1ca6a7c9 Update version for next development version 2022-01-01 20:49:50 +00:00
RaSCSI User 3cc04a8dcf Update revision for release 2022-01-01 20:48:30 +00:00