If the debug mode is enabled for usb_msd, turn it on for the SCSI device, too,

Don't try to insert cdrom media if device/image path is empty.
This commit is contained in:
Volker Ruppert 2015-09-03 18:54:51 +00:00
parent f76b972fed
commit 4b83f9e899
3 changed files with 19 additions and 2 deletions

View File

@ -1000,6 +1000,12 @@ void scsi_device_t::seek_timer_handler(void *this_ptr)
class_ptr->seek_timer();
}
// Turn on BX_DEBUG messages at connection time
void scsi_device_t::set_debug_mode()
{
setonoff(LOGLEV_DEBUG, ACT_REPORT);
}
void scsi_device_t::seek_timer()
{
// TODO

View File

@ -90,6 +90,7 @@ public:
void seek_timer(void);
bx_bool save_requests(const char *path);
void restore_requests(const char *path);
void set_debug_mode();
protected:
SCSIRequest* scsi_new_request(Bit32u tag);

View File

@ -383,6 +383,9 @@ bx_bool usb_msd_device_c::init()
}
}
s.scsi_dev->register_state(s.sr_list, "scsidev");
if (getonoff(LOGLEV_DEBUG) == ACT_REPORT) {
s.scsi_dev->set_debug_mode();
}
s.mode = USB_MSDM_CBW;
d.connected = 1;
s.status_changed = 0;
@ -867,9 +870,16 @@ bx_bool usb_msd_device_c::set_inserted(bx_bool value)
if (value) {
path = SIM->get_param_string("path", s.config)->getptr();
if (!s.cdrom->insert_cdrom(path)) {
if ((strlen(path) > 0) && (strcmp(path, "none"))) {
if (!s.cdrom->insert_cdrom(path)) {
value = 0;
}
} else {
value = 0;
}
if (!value) {
SIM->get_param_enum("status", s.config)->set(BX_EJECTED);
return 0;
s.status_changed = 0;
}
} else {
s.cdrom->eject_cdrom();