Bug 263099 - vidcontrol(1) -p and -P does not work
Summary: vidcontrol(1) -p and -P does not work
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.1-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-06 18:12 UTC by Slawomir Wojciech Wojtczak
Modified: 2022-04-20 03:31 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Slawomir Wojciech Wojtczak 2022-04-06 18:12:27 UTC
I suspect its the same on 13.0 but I am using 13.0-RC1 currently.

The vidcontrol(1) man page states the following:

| The following command will capture the contents of the first
| virtual terminal video buffer, and redirect the output to
| the shot.scr file:
| 
|   vidcontrol -p < /dev/ttyv0 > shot.scr
| 
| 
| The following command will dump contents of the fourth
| virtual terminal video buffer to the standard output in the
| human readable format:
| 
|   vidcontrol -P < /dev/ttyv3

But it does not work:

# vidcontrol -p < /dev/ttyv0                                                                                                                                          
vidcontrol: dumping screen: Inappropriate ioctl for device                                                                                                                                                                                                                                                                      

# vidcontrol -P < /dev/ttyv0                                                                                                                                                                                                                                                                                                 
vidcontrol: dumping screen: Inappropriate ioctl for device                                                                                                                                                                                                                                                                      

I have i915kms.ko loaded from the drm-kmod package.

Regards.
Comment 1 Marek Zarychta 2022-04-06 18:27:23 UTC
This might need sc(4) to work.
Comment 2 Slawomir Wojciech Wojtczak 2022-04-06 18:29:34 UTC
(In reply to Marek Zarychta from comment #1)

Maybe. The man page does not state that.

| DESCRIPTION
|   The vidcontrol utility is used to set various
|   options for the syscons(4) or vt(4) console driver

Also description for -p and -P option does not state that sc(4) instead of vt(4) is needed.
Comment 3 Marek Zarychta 2022-04-06 18:35:00 UTC
Yes, with sc(4) it still works on 13.1-STABLE #5 stable/13-n250020-5f3d952f6e6: Tue Mar 15 18:51:46 CET 2022
Unfortunately, sc(4) can be only enabled when you are not booting with EFI.

>Maybe. The man page does not state that.
Yep. Recently I see a lot of commits "Fix a typo in...", but probably no one is willing to look deeper and document incompatibilities of vt(4).
Comment 4 Slawomir Wojciech Wojtczak 2022-04-06 19:04:15 UTC
Isn't the vt(4) 'the future' for terminal on FreeBSD?

Maybe vidcontrol(1) should just be fixed to work on vt(4)?
Comment 5 Chris Hutchinson 2022-04-06 21:03:57 UTC
(In reply to Marek Zarychta from comment #3)
> Unfortunately, sc(4) can be only enabled when you are not booting with EFI.
Well. That may be true on your hardware. But all our servers, and all
my personal hardware has the following in loader.conf(5)

kern.vty=sc

All of them boot via UEFI and all of them use the kpi/drmn graphics
modules. So just for the record; sc(syscons) does not prevent you
from booting through UEFI. :-)

HTH

l8r,
Chris
Comment 6 Tomoaki AOKI 2022-04-06 21:33:05 UTC
(In reply to Chris Hutchinson from comment #5)

Are you 100% sure all your hardwares are legacy (non-UEFI) booted?
On UEFI, efifb (only usable via vt) is forced and sc is not emulated (by firmware) at all.
So nothing can detect legacy (character based) frame buffer on UEFI-booted environment. (For UEFI-capable hardwares with legacy boot ennbled, CSM of UEFI firmware would take care of it, just stop hiding physical text frame buffer or emulate actually-nonexistent hardware, which would be dependent on hardware).

It's a limitation of UEFI, not of FreeBSD. So kern.vty=sc on UEFI-booted environment would be ignored and forced vt.

On vidcontrol side, discussions would be needed which to capture, graphical frame buffer or vt-internal text buffer.
Someone would want images displayed to be captured, that means, texts are also captured as image, not as characters.

But OTOH, others would want only texts to be captured as characters.
This is like the behaviour with mice driven by moused.
Comment 7 Ed Maste freebsd_committer freebsd_triage 2022-04-06 23:35:33 UTC
-p / -P uses the CONS_SCRSHOT ioctl, which is not currently supported by vt
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-04-06 23:44:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1f4442f71fa33a8ef6d3da808e32872fb23a5700

commit 1f4442f71fa33a8ef6d3da808e32872fb23a5700
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-04-06 23:39:19 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-04-06 23:39:19 +0000

    vidcontrol: be explicit that -p and -P are sc(4) only

    PR:             263099
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation

 usr.sbin/vidcontrol/vidcontrol.1 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Comment 9 Ed Maste freebsd_committer freebsd_triage 2022-04-06 23:45:58 UTC
(In reply to Slawomir Wojciech Wojtczak from comment #2)
| DESCRIPTION
|   The vidcontrol utility is used to set various
|   options for the syscons(4) or vt(4) console driver

immediately after that:

Only a small subset of
options is supported by vt(4).  Unsupported options lead to error
messages, typically including the text "Inappropriate ioctl for device".
Comment 10 commit-hook freebsd_committer freebsd_triage 2022-04-07 00:27:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=c71ae91f1976746b380a8aada8676d7ae084fdc5

commit c71ae91f1976746b380a8aada8676d7ae084fdc5
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-04-07 00:19:54 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-04-07 00:26:43 +0000

    vidcontrol: disable p, P, and H when vt(4) is in use

    These options use the CONS_SCRSHOT ioctl to capture the contents of the
    current console, which is not yet supported by vt(4).  Disable the
    options when vt(4) is in use rather than emitting a possibly confusing
    error message.

    This change should be reverted if CONS_SCRSHOT is implemented for vt(4).

    PR:             263099
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation

 usr.sbin/vidcontrol/vidcontrol.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Comment 11 Slawomir Wojciech Wojtczak 2022-04-07 07:45:15 UTC
I was about to suggest exactly that - just add info in the man page that -p and -P options work for syscons(4) only.

Closing as it will be added to the man page.

Thank You and have a great day.

Regards.
Comment 12 commit-hook freebsd_committer freebsd_triage 2022-04-11 12:16:08 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ef024be3755c6e09e0caf5f1df989e9a09f54063

commit ef024be3755c6e09e0caf5f1df989e9a09f54063
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-04-06 23:39:19 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-04-11 12:15:22 +0000

    vidcontrol: disable p, P, and H when vt(4) is in use

    These options use the CONS_SCRSHOT ioctl to capture the contents of the
    current console, which is not yet supported by vt(4).  Disable the
    options when vt(4) is in use rather than emitting a possibly confusing
    error message.

    This change should be reverted if CONS_SCRSHOT is implemented for vt(4).

    PR:             263099
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit c71ae91f1976746b380a8aada8676d7ae084fdc5)
    (cherry picked from commit 1f4442f71fa33a8ef6d3da808e32872fb23a5700)

 usr.sbin/vidcontrol/vidcontrol.1 | 6 +++++-
 usr.sbin/vidcontrol/vidcontrol.c | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)
Comment 13 commit-hook freebsd_committer freebsd_triage 2022-04-20 03:31:05 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1bb77846adee4a44c38a7b5777749357b1b9ff20

commit 1bb77846adee4a44c38a7b5777749357b1b9ff20
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-04-06 23:39:19 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-04-20 00:31:29 +0000

    vidcontrol: disable p, P, and H when vt(4) is in use

    These options use the CONS_SCRSHOT ioctl to capture the contents of the
    current console, which is not yet supported by vt(4).  Disable the
    options when vt(4) is in use rather than emitting a possibly confusing
    error message.

    This change should be reverted if CONS_SCRSHOT is implemented for vt(4).

    PR:             263099
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation

    (cherry picked from commit c71ae91f1976746b380a8aada8676d7ae084fdc5)
    (cherry picked from commit 1f4442f71fa33a8ef6d3da808e32872fb23a5700)
    (cherry picked from commit 4aa249b5f367c3fe0aec287bbf156131ec75ebd3)

 usr.sbin/vidcontrol/vidcontrol.1 | 6 +++++-
 usr.sbin/vidcontrol/vidcontrol.c | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)