Closed LIV2 closed 6 months ago
Looks good (I don't think ATAPI CD support was not used for anything else than basic CD filesystem reads) but scsi_emulate_analyze change is outside of switch block?
Not sure about -1, it is was written long time ago..
Oops right you are, not sure how that slipped in sorry.
Have fixed that now
I noticed that setting the volume via mode select on ATAPI devices was not working and tracked it down to this.
Before
scsi_emulate_cmd()
is called for commands writing to the device the memcpy was usingide->data_size
. Thenide->data_size
is copied toscsi->data_len
.The problem here is that by the time we get here,
ide->data_size
is 0 because it is decremented on every data write before the packet is processed here: https://github.com/tonioni/WinUAE/blob/b2877eeb48e2a922f2a9ca50481e7d3ca16d0f5c/ide.cpp#L1365-L1373ide->data_offset
is zeroed byatapi_set_size()
well before the call toscsi_emulate_cmd()
https://github.com/tonioni/WinUAE/blob/b2877eeb48e2a922f2a9ca50481e7d3ca16d0f5c/ide.cpp#L857-L861So I thought
ide->packet_data_size
might be the only valid option here.I then needed to add
MODE SELECT
intoscsi_emulate_analyze()
to set the correct data_len before this would work.I noticed that near the bottom of this function, the data_len will be set from the usual location in the CDB but only if data_len was already -1. I wonder if it might make sense to set
scsi->data_len
to -1 before the call toscsi_emualate_analyze()
but wasn't sure.