|
@@ -1132,6 +1132,8 @@ static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh)
|
|
|
|
|
|
memset(buf, 0, 8);
|
|
|
buf[0] = TYPE_DISK;
|
|
|
+ if (curlun->removable)
|
|
|
+ buf[1] = 0x80;
|
|
|
buf[2] = 2; /* ANSI SCSI level 2 */
|
|
|
buf[3] = 2; /* SCSI-2 INQUIRY data format */
|
|
|
buf[4] = 31; /* Additional length */
|
|
@@ -1186,8 +1188,10 @@ static int do_request_sense(struct fsg_common *common, struct fsg_buffhd *bh)
|
|
|
valid = 0;
|
|
|
} else {
|
|
|
sd = curlun->sense_data;
|
|
|
+ sdinfo = curlun->sense_data_info;
|
|
|
valid = curlun->info_valid << 7;
|
|
|
curlun->sense_data = SS_NO_SENSE;
|
|
|
+ curlun->sense_data_info = 0;
|
|
|
curlun->info_valid = 0;
|
|
|
}
|
|
|
|
|
@@ -1812,6 +1816,13 @@ static int check_command(struct fsg_common *common, int cmnd_size,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /* If the medium isn't mounted and the command needs to access
|
|
|
+ * it, return an error. */
|
|
|
+ if (curlun && !curlun->lun_open && needs_medium) {
|
|
|
+ curlun->sense_data = SS_MEDIUM_NOT_PRESENT;
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -2532,11 +2543,11 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
|
|
|
|
|
|
for (i = 0; i < nluns; i++) {
|
|
|
common->luns[i].removable = 1;
|
|
|
-//#ifndef CONFIG_FSL_UTP
|
|
|
+#ifndef CONFIG_FSL_UTP
|
|
|
rc = fsg_lun_open(&common->luns[i], "");
|
|
|
if (rc)
|
|
|
goto error_luns;
|
|
|
-//#endif
|
|
|
+#endif
|
|
|
}
|
|
|
common->lun = 0;
|
|
|
|