- removed USB port option parameter and store device and option in one single

string. This is better for devices that need to know all it's options when
  connecting to the port. Device name and option should be separated with a
  colon. The USB device 'disk' now uses this format ('disk:usbdisk.img).
- the pciusb plugin must be linked with cdrom.o
This commit is contained in:
Volker Ruppert 2007-03-18 17:52:15 +00:00
parent 58d12d7136
commit 7956e47de8
8 changed files with 30 additions and 76 deletions

View File

@ -693,14 +693,14 @@ i440fxsupport: enabled=1
# USB1:
# This option controls the presence of the USB root hub which is a part
# of the i440FX PCI chipset. With the portX option you can connect devices
# to the hub (currently supported: 'mouse' and 'keypad'). If you connect
# the mouse to one of the ports and use the mouse option 'type=usb' you'll
# have a 3-button USB mouse.
#
# Example:
# usb1: enabled=1, port1=mouse, port2=keypad
# to the hub (currently supported: 'mouse', 'keypad' and 'disk'). If you
# connect the mouse to one of the ports and use the mouse option 'type=usb'
# you'll have a 3-button USB mouse. To connect a flat image as an USB hardisk
# you can use the 'disk' device with the path to the image separated with a
# colon (see below).
#=======================================================================
#usb1: enabled=1
#usb1: enabled=1, port1=mouse, port2=disk:usbdisk.img
#=======================================================================
# CMOSIMAGE:

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: config.cc,v 1.114 2006-12-31 11:56:13 vruppert Exp $
// $Id: config.cc,v 1.115 2007-03-18 17:52:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1288,7 +1288,7 @@ void bx_init_options()
enabled->set_dependent_list(deplist);
}
bx_param_string_c *port, *option;
bx_param_string_c *port;
// usb hubs
bx_list_c *usb = new bx_list_c(ports, "usb", "USB Hub Options");
@ -1309,24 +1309,12 @@ void bx_init_options()
"Device connected to USB port #1",
"", BX_PATHNAME_LEN);
port->set_group(group);
option = new bx_param_string_c(menu,
"option1",
"Port #1 device options",
"Options for device on USB port #1",
"", BX_PATHNAME_LEN);
option->set_group(group);
port = new bx_param_string_c(menu,
"port2",
"Port #2 device",
"Device connected to USB port #2",
"", BX_PATHNAME_LEN);
port->set_group(group);
option = new bx_param_string_c(menu,
"option2",
"Port #2 device options",
"Options for device on USB port #2",
"", BX_PATHNAME_LEN);
option->set_group(group);
enabled->set_dependent_list(menu->clone());
}
@ -1606,9 +1594,7 @@ void bx_init_options()
SIM->get_param_num(BXPN_SB16_DMATIMER),
SIM->get_param_num(BXPN_SB16_LOGLEVEL),
SIM->get_param_string(BXPN_USB1_PORT1),
SIM->get_param_string(BXPN_USB1_OPTION1),
SIM->get_param_string(BXPN_USB1_PORT2),
SIM->get_param_string(BXPN_USB1_OPTION2),
NULL
};
menu = new bx_list_c(special_menus, "runtime", "Misc runtime options", runtime_init_list);
@ -2698,11 +2684,11 @@ static Bit32s parse_line_formatted(const char *context, int num_params, char *pa
} else if (!strncmp(params[i], "port1=", 6)) {
SIM->get_param_string("port1", base)->set(&params[i][6]);
} else if (!strncmp(params[i], "option1=", 8)) {
SIM->get_param_string("option1", base)->set(&params[i][8]);
PARSE_WARN(("%s: usb port1 option is now deprecated", context));
} else if (!strncmp(params[i], "port2=", 6)) {
SIM->get_param_string("port2", base)->set(&params[i][6]);
} else if (!strncmp(params[i], "option2=", 8)) {
SIM->get_param_string("option2", base)->set(&params[i][8]);
PARSE_WARN(("%s: usb port2 option is now deprecated", context));
} else if (!strncmp(params[i], "ioaddr=", 7)) {
PARSE_WARN(("%s: usb ioaddr is now DEPRECATED (assigned by BIOS).", context));
} else if (!strncmp(params[i], "irq=", 4)) {
@ -3159,10 +3145,8 @@ int bx_write_usb_options(FILE *fp, bx_list_c *base, int n)
{
fprintf(fp, "usb%d: enabled=%d", n, SIM->get_param_bool("enabled", base)->get());
if (SIM->get_param_bool("enabled", base)->get()) {
fprintf(fp, ", port1=%s, option1=%s", SIM->get_param_string("port1", base)->getptr(),
SIM->get_param_string("option1", base)->getptr());
fprintf(fp, ", port2=%s, option2=%s", SIM->get_param_string("port2", base)->getptr(),
SIM->get_param_string("option2", base)->getptr());
fprintf(fp, ", port1=%s", SIM->get_param_string("port1", base)->getptr());
fprintf(fp, ", port2=%s", SIM->get_param_string("port2", base)->getptr());
}
fprintf(fp, "\n");
return 0;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.206 2006-12-31 11:56:14 vruppert Exp $
// $Id: siminterface.h,v 1.207 2007-03-18 17:52:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Intro to siminterface by Bryce Denney:
@ -208,9 +208,7 @@ typedef enum {
#define BXPN_ATA3_SLAVE "ata.3.slave"
#define BXPN_USB1_ENABLED "ports.usb.1.enabled"
#define BXPN_USB1_PORT1 "ports.usb.1.port1"
#define BXPN_USB1_OPTION1 "ports.usb.1.option1"
#define BXPN_USB1_PORT2 "ports.usb.1.port2"
#define BXPN_USB1_OPTION2 "ports.usb.1.option2"
#define BXPN_NE2K "network.ne2k"
#define BXPN_NE2K_ENABLED "network.ne2k.enabled"
#define BXPN_PNIC "network.pnic"

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32dialog.cc,v 1.55 2007-01-05 16:53:45 vruppert Exp $
// $Id: win32dialog.cc,v 1.56 2007-03-18 17:52:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
#include "config.h"
@ -553,18 +553,12 @@ static BOOL CALLBACK RTUSBdevDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
case WM_INITDIALOG:
if (SIM->get_param_string(BXPN_USB1_PORT1)->get_enabled()) {
SetDlgItemText(hDlg, IDUSBDEV1, SIM->get_param_string(BXPN_USB1_PORT1)->getptr());
SetDlgItemText(hDlg, IDUSBOPT1, SIM->get_param_string(BXPN_USB1_OPTION1)->getptr());
SetDlgItemText(hDlg, IDUSBDEV2, SIM->get_param_string(BXPN_USB1_PORT2)->getptr());
SetDlgItemText(hDlg, IDUSBOPT2, SIM->get_param_string(BXPN_USB1_OPTION2)->getptr());
} else {
EnableWindow(GetDlgItem(hDlg, IDUSBLBL1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBLBL2), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBLBL3), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBLBL4), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBDEV1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBOPT1), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBDEV2), FALSE);
EnableWindow(GetDlgItem(hDlg, IDUSBOPT2), FALSE);
}
changed = FALSE;
return TRUE;
@ -575,12 +569,8 @@ static BOOL CALLBACK RTUSBdevDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
if ((psn->lParam == FALSE) && changed) { // Apply pressed & change in this dialog
GetDlgItemText(hDlg, IDUSBDEV1, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_USB1_PORT1)->set(buffer);
GetDlgItemText(hDlg, IDUSBOPT1, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_USB1_OPTION1)->set(buffer);
GetDlgItemText(hDlg, IDUSBDEV2, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_USB1_PORT2)->set(buffer);
GetDlgItemText(hDlg, IDUSBOPT2, buffer, sizeof(buffer));
SIM->get_param_string(BXPN_USB1_OPTION2)->set(buffer);
}
return PSNRET_NOERROR;
case PSN_QUERYCANCEL:
@ -594,9 +584,7 @@ static BOOL CALLBACK RTUSBdevDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
case EN_CHANGE:
switch (LOWORD(wParam)) {
case IDUSBDEV1:
case IDUSBOPT1:
case IDUSBDEV2:
case IDUSBOPT2:
changed = TRUE;
SendMessage(GetParent(hDlg), PSM_CHANGED, (WPARAM)hDlg, 0);
break;

View File

@ -69,13 +69,9 @@
#define RT_USBDEV_DLG 2700
#define IDUSBLBL1 2711
#define IDUSBLBL2 2712
#define IDUSBLBL3 2713
#define IDUSBLBL4 2714
#define IDUSBWARN 2715
#define IDUSBDEV1 2620
#define IDUSBOPT1 2630
#define IDUSBDEV2 2640
#define IDUSBOPT2 2650
#define DEBUGGER_DLG 3000
#define DEBUG_MSG 3010
#define DEBUG_CMD 3020

View File

@ -162,8 +162,8 @@ libbx_serial.la: serial.lo serial_raw.lo
libbx_vga.la: vga.lo svga_cirrus.lo
$(LIBTOOL) --mode=link $(CXX) -module vga.lo svga_cirrus.lo -o libbx_vga.la -rpath $(PLUGIN_PATH)
libbx_pciusb.la: pciusb.lo usb_msd.lo scsi_device.lo hdimage.lo
$(LIBTOOL) --mode=link $(CXX) -module pciusb.lo usb_msd.lo scsi_device.lo hdimage.lo -o libbx_pciusb.la -rpath $(PLUGIN_PATH)
libbx_pciusb.la: pciusb.lo usb_msd.lo scsi_device.lo hdimage.lo cdrom.lo
$(LIBTOOL) --mode=link $(CXX) -module pciusb.lo usb_msd.lo scsi_device.lo hdimage.lo cdrom.lo -o libbx_pciusb.la -rpath $(PLUGIN_PATH)
#### building DLLs for win32 (tested on cygwin only)
bx_%.dll: %.o
@ -197,8 +197,8 @@ bx_serial.dll: serial.o serial_raw.o
bx_vga.dll: vga.o svga_cirrus.o
$(CXX) $(CXXFLAGS) -shared -o bx_vga.dll vga.o svga_cirrus.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_pciusb.dll: pciusb.o usb_msd.o scsi_device.o hdimage.o
$(CXX) $(CXXFLAGS) -shared -o bx_pciusb.dll pciusb.o usb_msd.o scsi_device.o hdimage.o $(WIN32_DLL_IMPORT_LIBRARY)
bx_pciusb.dll: pciusb.o usb_msd.o scsi_device.o hdimage.o cdrom.o
$(CXX) $(CXXFLAGS) -shared -o bx_pciusb.dll pciusb.o usb_msd.o scsi_device.o hdimage.o cdrom.o $(WIN32_DLL_IMPORT_LIBRARY)
##### end DLL section

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: pciusb.cc,v 1.50 2007-03-18 11:17:28 vruppert Exp $
// $Id: pciusb.cc,v 1.51 2007-03-18 17:52:15 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2004 MandrakeSoft S.A.
@ -141,9 +141,7 @@ bx_pciusb_c::~bx_pciusb_c()
}
SIM->get_param_string(BXPN_USB1_PORT1)->set_handler(NULL);
SIM->get_param_string(BXPN_USB1_OPTION1)->set_handler(NULL);
SIM->get_param_string(BXPN_USB1_PORT2)->set_handler(NULL);
SIM->get_param_string(BXPN_USB1_OPTION2)->set_handler(NULL);
BX_DEBUG(("Exit"));
}
@ -178,12 +176,8 @@ void bx_pciusb_c::init(void)
SIM->get_param_string(BXPN_USB1_PORT1)->set_handler(usb_param_handler);
SIM->get_param_string(BXPN_USB1_PORT1)->set_runtime_param(1);
SIM->get_param_string(BXPN_USB1_OPTION1)->set_handler(usb_param_handler);
SIM->get_param_string(BXPN_USB1_OPTION1)->set_runtime_param(1);
SIM->get_param_string(BXPN_USB1_PORT2)->set_handler(usb_param_handler);
SIM->get_param_string(BXPN_USB1_PORT2)->set_runtime_param(1);
SIM->get_param_string(BXPN_USB1_OPTION2)->set_handler(usb_param_handler);
SIM->get_param_string(BXPN_USB1_OPTION2)->set_runtime_param(1);
//HACK: Turn on debug messages from the start
//BX_USB_THIS setonoff(LOGLEV_DEBUG, ACT_REPORT);
@ -404,7 +398,7 @@ void bx_pciusb_c::init_device(Bit8u port, const char *devname)
type = USB_DEV_TYPE_KEYPAD;
connected = 1;
BX_USB_THIS keyboard_connected = 1;
} else if (!strcmp(devname, "disk")) {
} else if (!strncmp(devname, "disk:", 5)) {
type = USB_DEV_TYPE_DISK;
connected = 1;
BX_USB_THIS hub[0].usb_port[port].device = new usb_msd_device_t();
@ -1738,6 +1732,7 @@ void bx_pciusb_c::usb_mouse_enabled_changed(bx_bool enable)
void bx_pciusb_c::usb_set_connect_status(Bit8u port, int type, bx_bool connected)
{
char pname[BX_PATHNAME_LEN];
char fname[BX_PATHNAME_LEN];
if (BX_USB_THIS hub[0].usb_port[port].device != NULL) {
if (BX_USB_THIS hub[0].usb_port[port].device->get_type() == type) {
@ -1770,14 +1765,15 @@ void bx_pciusb_c::usb_set_connect_status(Bit8u port, int type, bx_bool connected
if ((type == USB_DEV_TYPE_DISK) &&
(!BX_USB_THIS hub[0].usb_port[port].device->get_connected())) {
if (port == 0) {
strcpy(pname, BXPN_USB1_OPTION1);
strcpy(pname, BXPN_USB1_PORT1);
} else {
strcpy(pname, BXPN_USB1_OPTION2);
strcpy(pname, BXPN_USB1_PORT2);
}
if (!((usb_msd_device_t*)BX_USB_THIS hub[0].usb_port[port].device)->init(SIM->get_param_string(pname)->getptr())) {
strcpy(fname, SIM->get_param_string(pname)->getptr() + 5);
if (!((usb_msd_device_t*)BX_USB_THIS hub[0].usb_port[port].device)->init(fname)) {
usb_set_connect_status(port, USB_DEV_TYPE_DISK, 0);
} else {
BX_INFO(("HD on USB port #%d: '%s'", port+1, SIM->get_param_string(pname)->getptr()));
BX_INFO(("HD on USB port #%d: '%s'", port+1, fname));
}
}
} else {
@ -2158,8 +2154,6 @@ const char *bx_pciusb_c::usb_param_handler(bx_param_string_c *param, int set, co
} else if (strcmp(val, "none") && !BX_USB_THIS hub[0].usb_port[0].status) {
init_device(0, val);
}
} else if (!strcmp(pname, BXPN_USB1_OPTION1)) {
BX_ERROR(("USB port #1 option change not implemented yet"));
} else if (!strcmp(pname, BXPN_USB1_PORT2)) {
BX_INFO(("USB port #2 experimental device change"));
if (!strcmp(val, "none") && BX_USB_THIS hub[0].usb_port[1].status) {
@ -2172,8 +2166,6 @@ const char *bx_pciusb_c::usb_param_handler(bx_param_string_c *param, int set, co
} else if (strcmp(val, "none") && !BX_USB_THIS hub[0].usb_port[1].status) {
init_device(1, val);
}
} else if (!strcmp(pname, BXPN_USB1_OPTION2)) {
BX_ERROR(("USB port #2 option change not implemented yet"));
} else {
BX_PANIC(("usb_param_handler called with unexpected parameter '%s'", pname));
}

View File

@ -93,14 +93,10 @@ CAPTION "USB Options"
FONT 8, "Helv"
BEGIN
LTEXT "USB port #1 device", IDUSBLBL1, 10, 27, 70, 14
EDITTEXT IDUSBDEV1, 85, 25, 70, 14
LTEXT "USB port #1 option", IDUSBLBL2, 10, 47, 70, 14
EDITTEXT IDUSBOPT1, 85, 45, 70, 14
LTEXT "USB port #2 device", IDUSBLBL3, 10, 67, 70, 14
EDITTEXT IDUSBDEV2, 85, 65, 70, 14
LTEXT "USB port #2 option", IDUSBLBL4, 10, 87, 70, 14
EDITTEXT IDUSBOPT2, 85, 85, 70, 14
LTEXT "Under contruction - don't use these options yet !", IDUSBWARN, 10, 120, 155, 14
EDITTEXT IDUSBDEV1, 85, 25, 100, 14, ES_AUTOHSCROLL
LTEXT "USB port #2 device", IDUSBLBL2, 10, 47, 70, 14
EDITTEXT IDUSBDEV2, 85, 45, 100, 14, ES_AUTOHSCROLL
LTEXT "USB device change support is still experimental !", IDUSBWARN, 10, 120, 155, 14
END
RT_LOGOPT_DLG DIALOG 30, 30, 240, 180