summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2017-11-06 09:08:54 +0000
committerYASUOKA Masahiko <yasuoka@cvs.openbsd.org>2017-11-06 09:08:54 +0000
commit6d61347064706dc58718e307b3002d08103f312d (patch)
treec16ac87c86602054db279a36f681e5b153ad96aa
parent15f9b0b8ea0f464f8cc19a33182a49b030e355f2 (diff)
Modify "machine video" command not to list mode when chaning video mode.
diff from Klemens Nanni
-rw-r--r--sys/arch/amd64/stand/efiboot/efiboot.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/sys/arch/amd64/stand/efiboot/efiboot.c b/sys/arch/amd64/stand/efiboot/efiboot.c
index 52c16a648a8..90bd85576fd 100644
--- a/sys/arch/amd64/stand/efiboot/efiboot.c
+++ b/sys/arch/amd64/stand/efiboot/efiboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efiboot.c,v 1.26 2017/11/06 08:57:34 yasuoka Exp $ */
+/* $OpenBSD: efiboot.c,v 1.27 2017/11/06 09:08:53 yasuoka Exp $ */
/*
* Copyright (c) 2015 YASUOKA Masahiko <yasuoka@yasuoka.net>
@@ -863,22 +863,25 @@ int
Xvideo_efi(void)
{
int i, mode = -1;
- char *p;
- for (i = 0; i < nitems(efi_video) && i < conout->Mode->MaxMode; i++) {
- if (efi_video[i].cols > 0)
- printf("Mode %d: %d x %d\n", i,
- efi_video[i].cols, efi_video[i].rows);
- }
- if (cmd.argc == 2) {
- p = cmd.argv[1];
- mode = strtol(p, &p, 10);
- }
- printf("\nCurrent Mode = %d\n", conout->Mode->Mode);
- if (0 <= mode && mode < i && efi_video[mode].cols > 0) {
- EFI_CALL(conout->SetMode, conout, mode);
- efi_video_reset();
+ if (cmd.argc >= 2) {
+ mode = strtol(cmd.argv[1], NULL, 10);
+ if (0 <= mode && mode < nitems(efi_video) &&
+ efi_video[mode].cols > 0) {
+ EFI_CALL(conout->SetMode, conout, mode);
+ efi_video_reset();
+ }
+ } else {
+ for (i = 0; i < nitems(efi_video) &&
+ i < conout->Mode->MaxMode; i++) {
+ if (efi_video[i].cols > 0)
+ printf("Mode %d: %d x %d\n", i,
+ efi_video[i].cols,
+ efi_video[i].rows);
+ }
+ printf("\n");
}
+ printf("Current Mode = %d\n", conout->Mode->Mode);
return (0);
}