summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-05-07 20:50:22 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-05-07 20:50:22 +0000
commit4a81137ad27c37637f77d45b52cd3c35f5f0c923 (patch)
tree26928e4d53e27262b12eeda016742c808a64b276
parent4b74374c0971a8f5cb038ae41d414350feb887e8 (diff)
If a device says a MODE SENSE command worked fine, do *not* try a MODE
SENSE BIG command even if no page data was returned. Just accept the fact that the device does not have any such page data. This is more in line with the spec, and unbreaks devices (like the Neodio 8-in-1 USB Card Reader donated by Manuel Pata) which freak out when getting a MODE SENSE BIG. Should not break any 'working' device. ok pedro@ dlg@ marco@ 'Looks correct.' miod@
-rw-r--r--sys/scsi/scsi_base.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 7719deef1b1..3f1399320f0 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.100 2006/05/07 00:20:05 krw Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.101 2006/05/07 20:50:21 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -516,8 +516,18 @@ scsi_do_mode_sense(sc_link, page, buf, page_data, density, block_count,
*/
error = scsi_mode_sense(sc_link, 0, page, &buf->hdr,
sizeof(*buf), flags, 20000);
- if (error == 0 && buf->hdr.data_length > 2) {
+ if (error == 0) {
*page_data = scsi_mode_sense_page(&buf->hdr, page_len);
+ if (*page_data == NULL)
+ /*
+ * XXX
+ * Page data may be invalid (e.g. all zeros)
+ * but we accept the device's word that this is
+ * the best it can do. Some devices will freak
+ * out if their word is not accepted and
+ * MODE_SENSE_BIG is attempted.
+ */
+ return (0);
offset = sizeof(struct scsi_mode_header);
blk_desc_len = buf->hdr.blk_desc_len;
goto blk_desc;