| @@ -1,18 +1,18 @@ | | | @@ -1,18 +1,18 @@ |
1 | $NetBSD: patch-scsi_netbsd.c,v 1.2 2015/07/10 13:33:41 bouyer Exp $ | | 1 | $NetBSD: patch-scsi_netbsd.c,v 1.3 2015/07/14 12:25:36 bouyer Exp $ |
2 | | | 2 | |
3 | --- /dev/null 2015-07-08 16:44:57.000000000 +0200 | | 3 | --- scsi_netbsd.c.orig 2015-07-14 13:48:44.000000000 +0200 |
4 | +++ scsi_netbsd.c 2015-07-08 16:58:09.000000000 +0200 | | 4 | +++ scsi_netbsd.c 2015-07-14 13:58:53.000000000 +0200 |
5 | @@ -0,0 +1,156 @@ | | 5 | @@ -0,0 +1,157 @@ |
6 | +/* Changes 2003 Steve Heck <steve.heck@am.sony.com> | | 6 | +/* Changes 2003 Steve Heck <steve.heck@am.sony.com> |
7 | + Copyright 2007-2008 by Robert Nelson <robertn@the-nelsons.org> | | 7 | + Copyright 2007-2008 by Robert Nelson <robertn@the-nelsons.org> |
8 | + | | 8 | + |
9 | + This program is free software; you may redistribute and/or modify it under | | 9 | + This program is free software; you may redistribute and/or modify it under |
10 | + the terms of the GNU General Public License Version 2 as published by the | | 10 | + the terms of the GNU General Public License Version 2 as published by the |
11 | + Free Software Foundation. | | 11 | + Free Software Foundation. |
12 | + | | 12 | + |
13 | + This program is distributed in the hope that it will be useful, but | | 13 | + This program is distributed in the hope that it will be useful, but |
14 | + WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY | | 14 | + WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY |
15 | + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | | 15 | + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
16 | + for complete details. | | 16 | + for complete details. |
17 | + | | 17 | + |
18 | +*/ | | 18 | +*/ |
| @@ -125,26 +125,27 @@ $NetBSD: patch-scsi_netbsd.c,v 1.2 2015/ | | | @@ -125,26 +125,27 @@ $NetBSD: patch-scsi_netbsd.c,v 1.2 2015/ |
125 | + | | 125 | + |
126 | + req.timeout = timeout * 1000; | | 126 | + req.timeout = timeout * 1000; |
127 | + | | 127 | + |
128 | + memset(&req.cmd[0], 0, sizeof(req.cmd)); | | 128 | + memset(&req.cmd[0], 0, sizeof(req.cmd)); |
129 | + memcpy(&req.cmd[0], CDB, CDB_Length); | | 129 | + memcpy(&req.cmd[0], CDB, CDB_Length); |
130 | + req.cmdlen = CDB_Length; | | 130 | + req.cmdlen = CDB_Length; |
131 | + | | 131 | + |
132 | + req.databuf = DataBuffer; | | 132 | + req.databuf = DataBuffer; |
133 | + req.datalen = DataBufferLength; | | 133 | + req.datalen = DataBufferLength; |
134 | + | | 134 | + |
135 | + req.senselen = SENSEBUFLEN; | | 135 | + req.senselen = SENSEBUFLEN; |
136 | + req.senselen_used = 0; | | 136 | + req.senselen_used = 0; |
137 | + ioctl_result = ioctl(DeviceFD, SCIOCCOMMAND, &req); | | 137 | + ioctl_result = ioctl(DeviceFD, SCIOCCOMMAND, &req); |
| | | 138 | + SCSI_Default_Timeout(); /* set it back to default, sigh. */ |
138 | + | | 139 | + |
139 | + if (ioctl_result < 0) | | 140 | + if (ioctl_result < 0) |
140 | + { | | 141 | + { |
141 | + perror("mtx: SCIOCCOMMAND"); | | 142 | + perror("mtx: SCIOCCOMMAND"); |
142 | + return ioctl_result; | | 143 | + return ioctl_result; |
143 | + } | | 144 | + } |
144 | + if (req.senselen_used > 0) { | | 145 | + if (req.senselen_used > 0) { |
145 | + memcpy(RequestSense, &req.sense[0], | | 146 | + memcpy(RequestSense, &req.sense[0], |
146 | + min(req.senselen_used, sizeof(RequestSense_T))); | | 147 | + min(req.senselen_used, sizeof(RequestSense_T))); |
147 | + } | | 148 | + } |
148 | + | | 149 | + |
149 | + if (req.retsts != SCCMD_OK) | | 150 | + if (req.retsts != SCCMD_OK) |
150 | + { | | 151 | + { |