Added USB port specific option 'size' for VVFAT disks (range 128M ... 128G).
If the size is not specified or invalid, it defaults to 504M.
This commit is contained in:
parent
d012670927
commit
c1e54bcfbf
@ -1027,13 +1027,6 @@ speaker: enabled=1, mode=sound
|
||||
# to the hub (currently supported: 'mouse', 'tablet', 'keypad', 'disk', 'cdrom'
|
||||
# 'hub' and 'printer').
|
||||
#
|
||||
# The optionsX parameter can be used to assign specific options to the device
|
||||
# connected to the corresponding USB port. Currently this feature is used to
|
||||
# set the speed reported by device ('low', 'full', 'high' or 'super'). The
|
||||
# availabe speed choices depend on both HC and device. For the USB 'disk' device
|
||||
# the optionsX parameter can be used to specify an alternative redolog file
|
||||
# (journal) of some image modes.
|
||||
#
|
||||
# If you connect the mouse or tablet to one of the ports, Bochs forwards the
|
||||
# mouse movement data to the USB device instead of the selected mouse type.
|
||||
# When connecting the keypad to one of the ports, Bochs forwards the input of
|
||||
@ -1056,6 +1049,15 @@ speaker: enabled=1, mode=sound
|
||||
# sent to a file specified in bochsrc.txt. The current code appends the PCL
|
||||
# code to the file if the file already existed. It would probably be nice to
|
||||
# overwrite the file instead, asking user first.
|
||||
#
|
||||
# The optionsX parameter can be used to assign specific options to the device
|
||||
# connected to the corresponding USB port. Currently this feature is used to
|
||||
# set the speed reported by device ('low', 'full', 'high' or 'super'). The
|
||||
# availabe speed choices depend on both HC and device. For the USB 'disk' device
|
||||
# the optionsX parameter can be used to specify an alternative redolog file
|
||||
# (journal) of some image modes. For 'vvfat' mode USB disks the optionsX
|
||||
# parameter can be used to specify the disk size (range 128M ... 128G). If the
|
||||
# size is not specified, it defaults to 504M.
|
||||
#=======================================================================
|
||||
#usb_uhci: enabled=1
|
||||
#usb_uhci: enabled=1, port1=mouse, port2=disk:usbstick.img
|
||||
|
@ -4678,14 +4678,6 @@ to the hub (currently supported: 'mouse', 'tablet', 'keypad', 'disk', 'cdrom',
|
||||
'hub' and 'printer').
|
||||
</para>
|
||||
<para>
|
||||
The options<replaceable>X</replaceable> parameter can be used to assign specific
|
||||
options to the device connected to the corresponding USB port. Currently this
|
||||
feature is used to set the speed reported by device ('low', 'full', 'high' or
|
||||
'super'). The availabe speed choices depend on both HC and device. For the USB
|
||||
'disk' device the optionsX parameter can be used to specify an alternative
|
||||
redolog file (journal) of some image modes.
|
||||
</para>
|
||||
<para>
|
||||
If you connect the mouse or tablet to one of the ports, Bochs forwards the
|
||||
mouse movement data to the USB device instead of the selected mouse type.
|
||||
When connecting the keypad to one of the ports, Bochs forwards the input of
|
||||
@ -4713,6 +4705,16 @@ sent to a file specified in bochsrc.txt. The current code appends the PCL
|
||||
code to the file if the file already existed. It would probably be nice to
|
||||
overwrite the file instead, asking user first.
|
||||
</para>
|
||||
<para>
|
||||
The options<replaceable>X</replaceable> parameter can be used to assign specific
|
||||
options to the device connected to the corresponding USB port. Currently this
|
||||
feature is used to set the speed reported by device ('low', 'full', 'high' or
|
||||
'super'). The availabe speed choices depend on both HC and device. For the USB
|
||||
'disk' device the optionsX parameter can be used to specify an alternative
|
||||
redolog file (journal) of some image modes. For 'vvfat' mode USB disks the optionsX
|
||||
parameter can be used to specify the disk size (range 128M ... 128G). If the
|
||||
size is not specified, it defaults to 504M.
|
||||
</para>
|
||||
<note><para>
|
||||
PCI support must be enabled to use USB UHCI.
|
||||
</para></note>
|
||||
|
@ -1,5 +1,5 @@
|
||||
.\"Document Author: Timothy R. Butler - tbutler@uninetsolutions.com"
|
||||
.TH bochsrc 5 "28 Sep 2014" "bochsrc" "The Bochs Project"
|
||||
.TH bochsrc 5 "29 Sep 2014" "bochsrc" "The Bochs Project"
|
||||
.\"SKIP_SECTION"
|
||||
.SH NAME
|
||||
bochsrc \- Configuration file for Bochs.
|
||||
@ -1146,13 +1146,6 @@ of the i440FX PCI chipset. With the portX option you can connect devices
|
||||
to the hub (currently supported: 'mouse', 'tablet', 'keypad', 'disk', 'cdrom',
|
||||
'hub' and 'printer').
|
||||
|
||||
The optionsX parameter can be used to assign specific options to the device
|
||||
connected to the corresponding USB port. Currently this feature is used to
|
||||
set the speed reported by device ('low', 'full', 'high' or 'super'). The
|
||||
availabe speed choices depend on both HC and device. For the USB 'disk' device
|
||||
the optionsX parameter can be used to specify an alternative redolog file
|
||||
(journal) of some image modes.
|
||||
|
||||
If you connect the mouse or tablet to one of the ports, Bochs forwards the
|
||||
mouse movement data to the USB device instead of the selected mouse type.
|
||||
When connecting the keypad to one of the ports, Bochs forwards the input of
|
||||
@ -1171,6 +1164,15 @@ sent to a file specified in bochsrc.txt. The current code appends the PCL
|
||||
code to the file if the file already existed. It would probably be nice to
|
||||
overwrite the file instead, asking user first.
|
||||
|
||||
The optionsX parameter can be used to assign specific options to the device
|
||||
connected to the corresponding USB port. Currently this feature is used to
|
||||
set the speed reported by device ('low', 'full', 'high' or 'super'). The
|
||||
availabe speed choices depend on both HC and device. For the USB 'disk' device
|
||||
the optionsX parameter can be used to specify an alternative redolog file
|
||||
(journal) of some image modes. For 'vvfat' mode USB disks the optionsX
|
||||
parameter can be used to specify the disk size (range 128M ... 128G). If the
|
||||
size is not specified, it defaults to 504M.
|
||||
|
||||
Example:
|
||||
usb_uhci: enabled=1, port1=mouse, port2=disk:usbstick.img
|
||||
usb_uhci: enabled=1, port1=hub:7, port2=disk:growing:usbdisk.img
|
||||
|
@ -266,6 +266,7 @@ usb_msd_device_c::usb_msd_device_c(usbdev_type type, const char *filename)
|
||||
s.fname = filename+strlen(ptr1)+1;
|
||||
}
|
||||
s.journal[0] = 0;
|
||||
s.size = 0;
|
||||
} else if (d.type == USB_DEV_TYPE_CDROM) {
|
||||
strcpy(d.devname, "BOCHS USB CDROM");
|
||||
s.fname = filename;
|
||||
@ -316,9 +317,34 @@ usb_msd_device_c::~usb_msd_device_c(void)
|
||||
|
||||
bx_bool usb_msd_device_c::set_option(const char *option)
|
||||
{
|
||||
char *suffix;
|
||||
|
||||
if (!strncmp(option, "journal:", 8)) {
|
||||
if (d.type == USB_DEV_TYPE_DISK) {
|
||||
strcpy(s.journal, option+8);
|
||||
return 1;
|
||||
} else {
|
||||
BX_ERROR(("Option 'journal' is only valid for USB disks"));
|
||||
}
|
||||
} else if (!strncmp(option, "size:", 5)) {
|
||||
if ((d.type == USB_DEV_TYPE_DISK) && (s.image_mode == BX_HDIMAGE_MODE_VVFAT)) {
|
||||
s.size = (int)strtol(option+5, &suffix, 10);
|
||||
if (!strcmp(suffix, "G")) {
|
||||
s.size <<= 10;
|
||||
} else if (strcmp(suffix, "M")) {
|
||||
BX_ERROR(("Unknown VVFAT disk size suffix '%s' - using default", suffix));
|
||||
s.size = 0;
|
||||
return 0;
|
||||
}
|
||||
if ((s.size < 128) || (s.size >= 131072)) {
|
||||
BX_ERROR(("Invalid VVFAT disk size value - using default"));
|
||||
s.size = 0;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
} else {
|
||||
BX_ERROR(("Option 'size' is only valid for USB VVFAT disks"));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -327,7 +353,12 @@ bx_bool usb_msd_device_c::init()
|
||||
{
|
||||
if (d.type == USB_DEV_TYPE_DISK) {
|
||||
s.hdimage = DEV_hdimage_init_image(s.image_mode, 0, s.journal);
|
||||
s.hdimage->cylinders = 0;
|
||||
if (s.image_mode == BX_HDIMAGE_MODE_VVFAT) {
|
||||
Bit64u hdsize = ((Bit64u)s.size) << 20;
|
||||
s.hdimage->cylinders = (Bit64u)(hdsize/16.0/63.0/512.0);
|
||||
s.hdimage->heads = 16;
|
||||
s.hdimage->spt = 63;
|
||||
}
|
||||
if (s.hdimage->open(s.fname) < 0) {
|
||||
BX_ERROR(("could not open hard drive image file '%s'", s.fname));
|
||||
return 0;
|
||||
|
@ -73,7 +73,8 @@ private:
|
||||
const char *fname;
|
||||
bx_list_c *config;
|
||||
char info_txt[BX_PATHNAME_LEN];
|
||||
char journal[BX_PATHNAME_LEN];
|
||||
char journal[BX_PATHNAME_LEN]; // undoable / volatile disk only
|
||||
int size; // VVFAT disk only
|
||||
} s;
|
||||
|
||||
static const char *cd_param_string_handler(bx_param_string_c *param, int set,
|
||||
|
Loading…
Reference in New Issue
Block a user