@@ -77,6 +77,11 @@ int32_t usb_msc_disk_eject(uint8_t lun) {
77
77
if (lun > 1 ) {
78
78
return ERR_NOT_FOUND ;
79
79
}
80
+ fs_user_mount_t * current_mount = get_vfs (lun );
81
+ // Return ERR_NOT_READY if not ready, otherwise ERR_NONE.
82
+ if (current_mount == NULL ) {
83
+ return ERR_ABORTED ;
84
+ }
80
85
// TODO(tannewt): Should we flush here?
81
86
return ERR_NONE ;
82
87
}
@@ -92,11 +97,10 @@ int32_t usb_msc_disk_is_ready(uint8_t lun) {
92
97
}
93
98
94
99
fs_user_mount_t * current_mount = get_vfs (lun );
95
- // Return ERR_NOT_READY if not ready, otherwise ERR_NONE.
96
- if (current_mount != NULL ) {
97
- return ERR_NONE ;
100
+ if (current_mount == NULL ) {
101
+ return ERR_ABORTED ;
98
102
}
99
- return ERR_NOT_READY ;
103
+ return ERR_NONE ;
100
104
}
101
105
102
106
/**
@@ -111,9 +115,12 @@ uint8_t *usb_msc_inquiry_info(uint8_t lun) {
111
115
for (uint8_t i = 0 ; i < 36 ; i ++ ) {
112
116
inquiry_info [lun ][i ] = 0 ;
113
117
}
114
- inquiry_info [lun ][1 ] = (0x1 << 7 );
115
- inquiry_info [lun ][3 ] = 0x01 ;
116
- inquiry_info [lun ][4 ] = 31 ;
118
+ inquiry_info [lun ][0 ] = SCSI_INQ_PQ_CONNECTED | SCSI_INQ_DT_DIR_ACCESS ;
119
+ // connected, direct access
120
+ inquiry_info [lun ][1 ] = SCSI_INQ_RMB ; // removable medium
121
+ inquiry_info [lun ][2 ] = SCSI_INQ_VER_SPC ; // SBC version of SCSI primary commands
122
+ inquiry_info [lun ][3 ] = SCSI_INQ_RSP_SPC2 ;// SPC-2 response format
123
+ inquiry_info [lun ][4 ] = 31 ; // 31 bytes following
117
124
return & inquiry_info [lun ][0 ];
118
125
}
119
126
}
0 commit comments