[PATCH] Log SCSI Driver errors reported by the Linux SG driver

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


---
 src/nf_scsidrv.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/nf_scsidrv.c b/src/nf_scsidrv.c
index f4be29bf..ff3a0512 100644
--- a/src/nf_scsidrv.c
+++ b/src/nf_scsidrv.c
@@ -405,8 +405,13 @@ static int scsidrv_inout(uint32_t stack)
 
 		io_hdr.timeout = timeout;
 
-		status = ioctl(handle_meta_data[handle].fd,
-		               SG_IO, &io_hdr) < 0 ? -1 : io_hdr.status;
+		status = 0;
+		if (ioctl(handle_meta_data[handle].fd, SG_IO, &io_hdr) == -1)
+		{
+			Log_Printf(LOG_ERROR, "\nCan't transfer %d byte(s)\n", transfer_len);
+			status = io_hdr.status;
+		}
+
 		if (!status && sense_buffer && sense_buffer[2] & 0x0f)
 		{
 			status = sense_buffer[2] & 0x0f;
-- 
2.45.2


--LYrXwgdI3KED1uTq--



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