allow disabling of serial or parallel devices (Stefan Weil)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2141 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2006-09-03 14:10:53 +00:00
parent 6192bc374f
commit c03b0f0fd8
2 changed files with 16 additions and 8 deletions

View File

@ -506,12 +506,16 @@ Redirect the virtual serial port to host character device
This option can be used several times to simulate up to 4 serials This option can be used several times to simulate up to 4 serials
ports. ports.
Use @code{-serial none} to disable all serial ports.
Available character devices are: Available character devices are:
@table @code @table @code
@item vc @item vc
Virtual console Virtual console
@item pty @item pty
[Linux only] Pseudo TTY (a new PTY is automatically allocated) [Linux only] Pseudo TTY (a new PTY is automatically allocated)
@item none
No device is allocated.
@item null @item null
void device void device
@item /dev/XXX @item /dev/XXX
@ -593,6 +597,8 @@ parallel port.
This option can be used several times to simulate up to 3 parallel This option can be used several times to simulate up to 3 parallel
ports. ports.
Use @code{-parallel none} to disable all parallel ports.
@item -monitor dev @item -monitor dev
Redirect the monitor to host device @var{dev} (same devices as the Redirect the monitor to host device @var{dev} (same devices as the
serial port). serial port).

18
vl.c
View File

@ -6850,27 +6850,29 @@ int main(int argc, char **argv)
monitor_init(monitor_hd, !nographic); monitor_init(monitor_hd, !nographic);
for(i = 0; i < MAX_SERIAL_PORTS; i++) { for(i = 0; i < MAX_SERIAL_PORTS; i++) {
if (serial_devices[i][0] != '\0') { const char *devname = serial_devices[i];
serial_hds[i] = qemu_chr_open(serial_devices[i]); if (devname[0] != '\0' && strcmp(devname, "none")) {
serial_hds[i] = qemu_chr_open(devname);
if (!serial_hds[i]) { if (!serial_hds[i]) {
fprintf(stderr, "qemu: could not open serial device '%s'\n", fprintf(stderr, "qemu: could not open serial device '%s'\n",
serial_devices[i]); devname);
exit(1); exit(1);
} }
if (!strcmp(serial_devices[i], "vc")) if (!strcmp(devname, "vc"))
qemu_chr_printf(serial_hds[i], "serial%d console\r\n", i); qemu_chr_printf(serial_hds[i], "serial%d console\r\n", i);
} }
} }
for(i = 0; i < MAX_PARALLEL_PORTS; i++) { for(i = 0; i < MAX_PARALLEL_PORTS; i++) {
if (parallel_devices[i][0] != '\0') { const char *devname = parallel_devices[i];
parallel_hds[i] = qemu_chr_open(parallel_devices[i]); if (devname[0] != '\0' && strcmp(devname, "none")) {
parallel_hds[i] = qemu_chr_open(devname);
if (!parallel_hds[i]) { if (!parallel_hds[i]) {
fprintf(stderr, "qemu: could not open parallel device '%s'\n", fprintf(stderr, "qemu: could not open parallel device '%s'\n",
parallel_devices[i]); devname);
exit(1); exit(1);
} }
if (!strcmp(parallel_devices[i], "vc")) if (!strcmp(devname, "vc"))
qemu_chr_printf(parallel_hds[i], "parallel%d console\r\n", i); qemu_chr_printf(parallel_hds[i], "parallel%d console\r\n", i);
} }
} }