From 368c83127ebbb88aad7330149daf5ab2cbd0123d Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Mon, 15 Feb 2021 19:55:53 +0000 Subject: [PATCH] Some small changes in the USB devices configuration. - Fixed USB devices list by adding a terminating NULL entry. - Disable USB device options parameter if device is set to "none". - Related documentation updates. --- bochs/CHANGES | 6 ++++ bochs/config.cc | 8 +++-- bochs/doc/docbook/user/user.dbk | 61 ++++++++++++++++++--------------- bochs/doc/man/bochsrc.5 | 51 ++++++++++++++------------- bochs/iodev/usb/usb_common.cc | 3 +- 5 files changed, 76 insertions(+), 53 deletions(-) diff --git a/bochs/CHANGES b/bochs/CHANGES index f1babf91a..bf6836518 100644 --- a/bochs/CHANGES +++ b/bochs/CHANGES @@ -2,6 +2,10 @@ Changes after 2.6.11: - General + - Improved plugins handling: all available plugins in path are detected at + startup (including externally developed ones). These types are supported in + Bochs configuration: display libraries, VGA compatile adapters, optional + PCI/ISA devices, disk image, networking and sound driver modules. - Save/Restore bugfixes - Removed legacy "load32bitOShack" feature. - Removed "svga" display library designed for the obsolete Linux SVGALib. @@ -42,6 +46,8 @@ Changes after 2.6.11: to disable ACPI or HPET in case the i440FX chipset is selected. - USB - Added keyboard emulation with most of the keys supported. + - Changed handling of device options in the USB port configuration + (see bochsrc sample). - Sound - Added PC speaker volume control for the lowlevel sound support. diff --git a/bochs/config.cc b/bochs/config.cc index bc34b7690..f35ae9f23 100644 --- a/bochs/config.cc +++ b/bochs/config.cc @@ -198,6 +198,7 @@ void bx_init_std_nic_options(const char *name, bx_list_c *menu) void bx_init_usb_options(const char *usb_name, const char *pname, int maxports) { char group[16], name[8], descr[512], label[512]; + bx_list_c *deplist, *deplist2; bx_param_c *usb = SIM->get_param("ports.usb"); sprintf(group, "USB %s", usb_name); @@ -207,7 +208,7 @@ void bx_init_usb_options(const char *usb_name, const char *pname, int maxports) sprintf(label, "Enable %s emulation", usb_name); sprintf(descr, "Enables the %s emulation", usb_name); bx_param_bool_c *enabled = new bx_param_bool_c(menu, "enabled", label, descr, 1); - bx_list_c *deplist = new bx_list_c(NULL); + deplist = new bx_list_c(NULL); for (Bit8u i = 0; i < maxports; i++) { sprintf(name, "port%u", i+1); sprintf(label, "Port #%u Configuration", i+1); @@ -230,7 +231,10 @@ void bx_init_usb_options(const char *usb_name, const char *pname, int maxports) port->set_group(group); deplist->add(port); deplist->add(device); - deplist->add(options); + deplist2 = new bx_list_c(NULL); + deplist2->add(options); + device->set_dependent_list(deplist2, 1); + device->set_dependent_bitmap(0, 0); } enabled->set_dependent_list(deplist); } diff --git a/bochs/doc/docbook/user/user.dbk b/bochs/doc/docbook/user/user.dbk index 937365d08..c19137ef0 100644 --- a/bochs/doc/docbook/user/user.dbk +++ b/bochs/doc/docbook/user/user.dbk @@ -4913,13 +4913,14 @@ as the NE2000 adapter. Examples: - usb_uhci: enabled=1, port1=mouse, port2=disk:usbstick.img - usb_uhci: enabled=1, port1=hub:7, port2=disk:growing:usbdisk.img - usb_uhci: enabled=1, port2=disk:undoable:usbdisk.img, options2=journal:redo.log - usb_uhci: enabled=1, port2=disk:usbdisk2.img, options2=sect_size:1024 - usb_uhci: enabled=1, port2=disk:vvfat:vvfat, options2="debug,speed:full" - usb_uhci: enabled=1, port1=printer:printdata.bin, port2=cdrom:image.iso - usb_uhci: enabled=1, port2=floppy:vvfat:diskette, options2="model:teac" + usb_uhci: port1=mouse, port2=disk, options2="path:usbstick.img" + usb_uhci: port1=hub, options1="ports:6" + usb_uhci: port2=disk, options2="path:undoable:usbdisk.img, journal:u.redolog" + usb_uhci: port2=disk, options2=""path:usbdisk2.img, sect_size:1024" + usb_uhci: port2=disk, options2="path:vvfat:vvfat, debug, speed:full" + usb_uhci: port2=cdrom, options2="path:image.iso" + usb_uhci: port1=printer, options1="file:printdata.bin" + usb_uhci: port2=floppy, options2="path:vvfat:diskette, model:teac" This option controls the presence of the USB root hub which is a part of the i440FX PCI chipset. @@ -4937,41 +4938,47 @@ the numeric keypad to the USB device instead of the PS/2 keyboard. If the keyboard is selected, all key events are sent to the USB device. -To connect a 'flat' mode image as a USB hardisk you can use the 'disk' device -with the path to the image separated with a colon. To use other disk image modes -similar to ATA disks the syntax 'disk:mode:filename' must be used (see above). +To connect a disk image as a USB hardisk you can use the 'disk' device. Use +the 'path' option in the optionsX parameter to +specify the path to the image separated with a colon. To use other disk image +modes similar to ATA disks the syntax 'path:mode:filename' must be used (see +below). -To emulate a USB cdrom you can use the 'cdrom' device name and the path to -an ISO image or raw device name also separated with a colon. An option to -insert/eject media is available in the runtime configuration. +To emulate a USB cdrom you can use the 'cdrom' device and the path to an +ISO image or raw device name can be set with the 'path' option in the +optionsX parameter also separated with a colon. An +option to insert/eject media is available in the runtime configuration. -To emulate a USB floppy you can use the 'floppy' device with the path to the -image separated with a colon. To use the VVFAT image mode similar to the -legacy floppy the syntax 'floppy:vvfat:directory' must be used (see above). +To emulate a USB floppy you can use the 'floppy' device and the path to a +floppy image can be set with the 'path' option in the optionsX +parameter separated with a colon. To use the VVFAT image mode similar to the +legacy floppy the syntax 'path:vvfat:directory' must be used (see below). An option to insert/eject media is available in the runtime configuration. The device name 'hub' connects an external hub with max. 8 ports (default: 4) -to the root hub. To specify the number of ports you have to add the value +to the root hub. To specify the number of ports you have to use the 'ports' +option in the optionsX parameter with the value separated with a colon. Connecting devices to the external hub ports is only available in the runtime configuration. The device 'printer' emulates the HP Deskjet 920C printer. The PCL data is -sent to a file specified in bochsrc.txt. The current code appends the PCL -code to the file if the file already existed. The output file can be changed -at runtime. +sent to a file specified in the 'file' option with the optionsX +parameter. The current code appends the PCL code to the file if the file already +existed. The output file can be changed at runtime. -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 available speed choices depend on both HC and device. The option -'debug' turns on debug output for the device at connection time. 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 +The optionsX parameter can also 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 available speed choices depend on both HC and +device. The option 'debug' turns on debug output for the device at connection +time. 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. For the USB 'floppy' device the optionsX parameter can be used to specify an diff --git a/bochs/doc/man/bochsrc.5 b/bochs/doc/man/bochsrc.5 index 714749029..b26139021 100644 --- a/bochs/doc/man/bochsrc.5 +++ b/bochs/doc/man/bochsrc.5 @@ -1,5 +1,5 @@ .\"Document Author: Timothy R. Butler - tbutler@uninetsolutions.com" -.TH bochsrc 5 "24 Jan 2021" "bochsrc" "The Bochs Project" +.TH bochsrc 5 "15 Feb 2021" "bochsrc" "The Bochs Project" .\"SKIP_SECTION" .SH NAME bochsrc \- Configuration file for Bochs. @@ -1249,28 +1249,32 @@ When connecting the keypad to one of the ports, Bochs forwards the input of the numeric keypad to the USB device instead of the PS/2 keyboard. If the keyboard is selected, all key events are sent to the USB device. -To connect a 'flat' mode image as a USB hardisk you can use the 'disk' device -with the path to the image separated with a colon. To use other disk image modes -similar to ATA disks the syntax 'disk:mode:filename' must be used (see below). +To connect a disk image as a USB hardisk you can use the 'disk' device. Use +the 'path' option in the optionsX parameter to specify the path to the image +separated with a colon. To use other disk image modes similar to ATA disks +the syntax 'path:mode:filename' must be used (see below). -To emulate a USB cdrom you can use the 'cdrom' device name and the path to -an ISO image or raw device name also separated with a colon. An option to -insert/eject media is available in the runtime configuration. +To emulate a USB cdrom you can use the 'cdrom' device and the path to an +ISO image or raw device name can be set with the 'path' option in the +optionsX parameter also separated with a colon. An option to insert/eject +media is available in the runtime configuration. -To emulate a USB floppy you can use the 'floppy' device with the path to the -image separated with a colon. To use the VVFAT image mode similar to the -legacy floppy the syntax 'floppy:vvfat:directory' must be used (see below). +To emulate a USB floppy you can use the 'floppy' device and the path to a +floppy image can be set with the 'path' option in the optionsX parameter +separated with a colon. To use the VVFAT image mode similar to the legacy +floppy the syntax 'path:vvfat:directory' must be used (see below). An option to insert/eject media is available in the runtime configuration. The device name 'hub' connects an external hub with max. 8 ports (default: 4) -to the root hub. To specify the number of ports you have to add the value -separated with a colon. Connecting devices to the external hub ports is only -available in the runtime configuration. +to the root hub. To specify the number of ports you have to use the 'ports' +option in the optionsX parameter with the value separated with a colon. +Connecting devices to the external hub ports is only available in the runtime +configuration. The device 'printer' emulates the HP Deskjet 920C printer. The PCL data is -sent to a file specified in bochsrc.txt. The current code appends the PCL -code to the file if the file already existed. The output file can be -changed at runtime. +sent to a file specified in the 'file' option with the optionsX parameter. +The current code appends the PCL code to the file if the file already existed. +The output file can be changed at runtime. 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 @@ -1288,13 +1292,14 @@ accepts the parameter "write_protected" with valid values 0 and 1 to select the access mode (default is 0). Examples: - usb_uhci: enabled=1, port1=mouse, port2=disk:usbstick.img - usb_uhci: enabled=1, port1=hub:7, port2=disk:growing:usbdisk.img - usb_uhci: enabled=1, port2=disk:undoable:usbdisk.img, options2=journal:redo.log - usb_uhci: enabled=1, port2=disk:usbdisk2.img, options2=sect_size:1024 - usb_uhci: enabled=1, port2=disk:vvfat:vvfat, options2="debug,speed:full" - usb_uhci: enabled=1, port1=printer:printdata.bin, port2=cdrom:image.iso - usb_uhci: enabled=1, port2=floppy:vvfat:diskette, options2="model:teac" + usb_uhci: port1=mouse, port2=disk, options2="path:usbstick.img" + usb_uhci: port1=hub, options1="ports:6" + usb_uhci: port2=disk, options2="path:undoable:usbdisk.img, journal:u.redolog" + usb_uhci: port2=disk, options2=""path:usbdisk2.img, sect_size:1024" + usb_uhci: port2=disk, options2="path:vvfat:vvfat, debug, speed:full" + usb_uhci: port2=cdrom, options2="path:image.iso" + usb_uhci: port1=printer, options1="file:printdata.bin" + usb_uhci: port2=floppy, options2="path:vvfat:diskette, model:teac" .TP .I "usb_ohci:" diff --git a/bochs/iodev/usb/usb_common.cc b/bochs/iodev/usb/usb_common.cc index ef6aec97d..d498c5be4 100644 --- a/bochs/iodev/usb/usb_common.cc +++ b/bochs/iodev/usb/usb_common.cc @@ -74,7 +74,8 @@ const char *usb_device_names[] = "cdrom", "hub", "printer", - "floppy" + "floppy", + NULL }; const char **bx_usbdev_ctl_c::get_device_names(void)