Added common USB device option "debug" to turn on BX_DEBUG reporting at

connection time.
Fixed USB floppy capacity entries for 1.44 MB (last LBA, not LBA count).
This commit is contained in:
Volker Ruppert 2015-07-31 19:01:09 +00:00
parent 46d2c0adad
commit 8a1e31ef08
3 changed files with 12 additions and 9 deletions

View File

@ -177,11 +177,11 @@ static const Bit8u bx_cbi_dev_frmt_capacity[] = {
0x00, 0x00, 0x00, // reserved
32, // remaining list in bytes
// current: 1.44meg
0x00, 0x00, 0x0B, 0x40, // lba's
0x00, 0x00, 0x0B, 0x3f, // lba's
0x02, // descriptor code
0x00, 0x02, 0x00, // 512-byte sectors
// allowed #1: 1.44meg
0x00, 0x00, 0x0B, 0x40, // lba's
0x00, 0x00, 0x0B, 0x3f, // lba's
0x00, // descriptor code
0x00, 0x02, 0x00, // 512-byte sectors
// allowed #2: 1.25meg
@ -195,7 +195,7 @@ static const Bit8u bx_cbi_dev_frmt_capacity[] = {
};
static const Bit8u bx_cbi_dev_capacity[] = {
0x00, 0x00, 0x0B, 0x40, // lba's
0x00, 0x00, 0x0B, 0x3f, // lba's
0x00, 0x00, 0x02, 0x00 // 512-byte sectors
};
@ -337,12 +337,6 @@ bx_bool usb_cbi_device_c::set_option(const char *option)
bx_bool usb_cbi_device_c::init()
{
/* If you wish to set DEBUG=report in the code, instead of
* in the configuration, simply uncomment this line. I use
* it when I am working on this emulation.
*/
//LOG_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
if (d.type == USB_DEV_TYPE_FLOPPY) {
s.hdimage = DEV_hdimage_init_image(s.image_mode, 1474560, "");
if ((s.hdimage->open(s.fname)) < 0) {

View File

@ -206,6 +206,8 @@ void bx_usb_devctl_c::parse_port_options(usb_device_c *device, bx_list_c *portco
} else {
BX_ERROR(("unsupported USB device speed: '%s'", opts[i]+6));
}
} else if (!strcmp(opts[i], "debug")) {
device->set_debug_mode();
} else if (!device->set_option(opts[i])) {
BX_ERROR(("unknown USB device option: '%s'", opts[i]));
}
@ -432,4 +434,10 @@ void usb_device_c::usb_send_msg(int msg)
handle_packet(&p);
}
// Turn on BX_DEBUG messages at connection time
void usb_device_c::set_debug_mode()
{
setonoff(LOGLEV_DEBUG, ACT_REPORT);
}
#endif // BX_SUPPORT_PCI && BX_SUPPORT_PCIUSB

View File

@ -175,6 +175,7 @@ public:
int get_speed() {return d.speed;}
void set_speed(int speed) {d.speed = speed;}
Bit8u get_address() {return d.addr;}
void set_debug_mode();
void usb_send_msg(int msg);