[hatari-devel] Fix for NF SCSI Driver

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hello,

The attached patch fixes a SCSI Driver issue with recent Linux SG driver
implementations. The SG driver's error handling has changed, and it is
required to (also) check the sense data when ioctl reports no issue.
I stumbled upon this when I noticed that for my USB floppy the SCSI Driver
did not report errors anymore.

@Thomas Can you please also add this small change to Aranym? Thank you!

Best regards

Uwe
diff --git a/src/nf_scsidrv.c b/src/nf_scsidrv.c
index 110264a7..f4be29bf 100644
--- a/src/nf_scsidrv.c
+++ b/src/nf_scsidrv.c
@@ -407,6 +407,10 @@ static int scsidrv_inout(uint32_t stack)
 
 		status = ioctl(handle_meta_data[handle].fd,
 		               SG_IO, &io_hdr) < 0 ? -1 : io_hdr.status;
+		if (!status && sense_buffer && sense_buffer[2] & 0x0f)
+		{
+			status = sense_buffer[2] & 0x0f;
+		}
 	}
 
 	if (status > 0 && sense_buffer)


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/