Commit Graph

712 Commits

Author SHA1 Message Date
Andriy Gapon
b133becced sc_cngrab: switch to console vty when possible
In the future we may want to perform the switch even if the console is
currently in the graphics mode by trying to reset the video adapter first
(e.g. by executing vesa/vga bios post).  That would probably require
some sort of a one-way flag as returning the control of the console back
to the interrupted application most likely would result in a mess.

Reviewed by:	emaste
MFC after:	2 months
2011-12-21 12:21:22 +00:00
Andriy Gapon
8f3ae92165 syscons: provide a first iteration of cngrab/cnungrab implementation
- put underlying keyboard(s) into the polling mode for the whole
  duration of the grab, instead of the previous behavior of going into
  and out of the polling mode around each polling attempt
- ditto for setting K_XLATE mode and enabling a disabled keyboard

Inspired by:	bde
MFC after:	2 months
2011-12-17 15:57:39 +00:00
Andriy Gapon
9976156f12 kern cons: introduce infrastructure for console grabbing by kernel
At the moment grab and ungrab methods of all console drivers are no-ops.

Current intended meaning of the calls is that the kernel takes control of
console input.  In the future the semantics may be extended to mean that
the calling thread takes full ownership of the console (e.g. console
output from other threads could be suspended).

Inspired by:	bde
MFC after:	2 months
2011-12-17 15:08:43 +00:00
Andriy Gapon
8538a18594 syscons: make sc_puts static as it is used only privately
Perhaps sc_puts should also be renamed to scputs to follow the implied
naming conventions in the file...

MFC after:	2 weeks
2011-12-11 21:10:11 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Robert Millan
a2c22d416d Add a few improvements to utf-8 -> cp436 console map
(mostly with Catalan characters in mind, but it probably
benefits other languages).

The new mappings are as follows:

▮ -> █
ÀÈÍÏÓÒÚ -> AEIIOOU
ŀ / Ŀ -> l / L

Reviewed by:	ed
Approved by:	kib (mentor)
2011-10-28 20:00:30 +00:00
Kip Macy
8451d0dd78 In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)
2011-09-16 13:58:51 +00:00
Robert Watson
a608af7817 Add support for alternative break-to-debugger to syscons(4). While most
keyboards allow console break sequences (such as ctrl-alt-esc) to be
entered, alternative break can prove useful under virtualisation and
remote console systems where entering control sequences can be
difficult or unreliable.

MFC after:	3 weeks
Approved by:	re (bz)
2011-08-27 22:10:45 +00:00
Robert Watson
4cf7545589 Attempt to make break-to-debugger and alternative break-to-debugger more
accessible:

(1) Always compile in support for breaking into the debugger if options
    KDB is present in the kernel.

(2) Disable both by default, but allow them to be enabled via tunables
    and sysctls debug.kdb.break_to_debugger and
    debug.kdb.alt_break_to_debugger.

(3) options BREAK_TO_DEBUGGER and options ALT_BREAK_TO_DEBUGGER continue
    to behave as before -- only now instead of compiling in
    break-to-debugger support, they change the default values of the
    above sysctls to enable those features by default.  Current kernel
    configurations should, therefore, continue to behave as expected.

(4) Migrate alternative break-to-debugger state machine logic out of
    individual device drivers into centralised KDB code.  This has a
    number of upsides, but also one downside: it's now tricky to release
    sio spin locks when entering the debugger, so we don't.  However,
    similar logic does not exist in other device drivers, including uart.

(5) dcons requires some special handling; unlike other console types, it
    allows overriding KDB's own debugger selection, so we need a new
    interface to KDB to allow that to work.

GENERIC kernels in -CURRENT will now support break-to-debugger as long as
appropriate boot/run-time options are set, which should improve the
debuggability of BETA kernels significantly.

MFC after:	3 weeks
Reviewed by:	kib, nwhitehorn
Approved by:	re (bz)
2011-08-26 21:46:36 +00:00
Ed Schouten
78d4d8eeb2 Restore binary compatibility for GIO_KEYMAP and PIO_KEYMAP.
Back in 2009 I changed the ABI of the GIO_KEYMAP and PIO_KEYMAP ioctls
to support wide characters. I created a patch to add ABI compatibility
for the old calls, but I didn't get any feedback to that.

It seems now people are upgrading from 8 to 9 they experience this
issue, so add it anyway.
2011-07-17 08:19:19 +00:00
Ed Schouten
7c9669276e Fix whitespace inconsistencies in the TTY layer and its drivers owned by me. 2011-06-26 18:26:20 +00:00
Jung-uk Kim
b10c3d1c15 Move VT switching hack for suspend/resume from bus drivers to syscons.c
using event handlers.  A different version was

Submitted by:	Taku YAMAMOTO (taku at tackymt dot homeip dot net)
2011-05-09 18:46:49 +00:00
Jung-uk Kim
1658038ce7 Rename a variable to match scvidctl.c. 2010-11-30 17:34:15 +00:00
Jung-uk Kim
732e8e1632 Stop hardcoding default font size. 2010-11-30 17:32:28 +00:00
Jung-uk Kim
fd7a9ebcca Clean up code a bit to make it more readable. 2010-11-30 16:46:15 +00:00
Jung-uk Kim
82515b4f1f Clean up code a bit to make it more readable. 2010-11-29 22:20:44 +00:00
Jung-uk Kim
0cb06f72d5 Honor font size for the video mode when default fonts are compiled in kernel
and VESA mode is enabled from loader.
2010-11-29 22:19:19 +00:00
Rebecca Cran
b1ce21c6ef Fix typos.
PR:	bin/148894
Submitted by:	olgeni
2010-11-09 10:59:09 +00:00
Rui Paulo
cd1fa5bd4d Explicitly tell the compiler that we don't care about the return value
of kbdd_ioctl().
2010-10-13 11:37:12 +00:00
Jung-uk Kim
a90b8833d2 Rework r210248. Although it fixed most of problems, it did not fix one
particular edge case where X-axis resolution is not multiple of font width.
Now we just advance enough scan lines, then deduct a partial scan line.
It is more intuitive than the previous code.  Apply the same wisdom to EGA
and VGA planar renderers for consistency.

Reported by:	David DEMELIER (demelier dot david at gmail dot com)
2010-09-17 23:09:31 +00:00
Jung-uk Kim
25a14f561c Improve style slightly. 2010-07-19 20:31:04 +00:00
Jung-uk Kim
490770af47 Fix two long-standing line wrapping bugs in VGA renderer for pixel mode.
Font size may be smaller than 16 and logical scan line may be larger than
the displayed scan line.

MFC after:	3 days
2010-07-19 18:56:18 +00:00
Jung-uk Kim
dd962f5b8a Suspend screen updates when the video controller is powered down. 2010-05-22 07:35:17 +00:00
Jung-uk Kim
3504769505 Correct beastie_saver module name. 2010-04-07 18:42:21 +00:00
Jung-uk Kim
3cab2f6db9 Add the official FreeBSD logo image file for logo_saver. 2010-04-07 17:07:06 +00:00
Jung-uk Kim
f989dcca3e Copy Beastie image file to prepare for an official logo image. 2010-04-07 17:03:05 +00:00
Jung-uk Kim
4cc5f38e97 Refine r204265. We want the standard VGA palette for packed pixel mode. 2010-03-29 22:41:30 +00:00
Jung-uk Kim
c2bce7cc39 Align memory access of 24-bit pixel renderer to word boundary. 2010-03-24 15:40:18 +00:00
Jung-uk Kim
4d52abfb0c Separate 24-bit pixel draw from 32-bit case. Although it is slower, we do
not want to write a useless zero to inaccessible memory region.
2010-03-23 22:16:57 +00:00
Jung-uk Kim
4a9b63a454 Improve VESA mode switching via loader tunable `hint.sc.0.vesa_mode'.
The most notable change is history buffer is fully saved/restored now.
2010-02-24 20:13:34 +00:00
Jung-uk Kim
8d521790d0 Yet another attempt to make palette loading more safer:
- Add a separate palette data for 8-bit DAC mode when SC_PIXEL_MODE is set
and fill it up with default gray-scale palette data for text.  Now we don't
have to set `hint.sc.0.vesa_mode' to get the default palette data.
- Add a new adapter flag, V_ADP_DAC8 to track whether the controller is
using 8-bit palette format and load correct palette when switching modes.
- Set 8-bit DAC mode only for non-VGA compatible graphics mode.
2010-02-23 21:51:14 +00:00
Ivan Voras
b8bba24e06 The New and Improved snake_server - Service Pack 1: now even more
sensitive to load average variations!
2010-02-23 15:27:07 +00:00
Ivan Voras
c0414ca779 Upgrade the "snake" syscons screensaver to the new, multimedia version!
Now, with color! And system load averages!

Amused by it:	gnn
2010-02-23 15:12:41 +00:00
Robert Noland
cfd7bacef2 Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.
This replaces d_mmap() with the d_mmap2() implementation and also
changes the type of offset to vm_ooffset_t.

Purge d_mmap2().

All driver modules will need to be rebuilt since D_VERSION is also
bumped.

Reviewed by:	jhb@
MFC after:	Not in this lifetime...
2009-12-29 21:51:28 +00:00
Ed Schouten
5b19140604 Include <sys/ttydefaults.h>, instead of doing it through <sys/termios.h>.
I want to prevent the header polution of <sys/termios.h> eventually.
2009-11-28 16:25:55 +00:00
Konstantin Belousov
07ff915720 Fix pgsignal() call after signature change in r199355.
Reported and tested by:	bf1783 googlemail com
MFC after:	1 month
2009-11-17 19:24:26 +00:00
Ed Schouten
4b2361f811 Convert syscons on i386 to TERM=xterm.
TEKEN_XTERM is now gone. Because we always use xterm mode now, we only
need a TEKEN_CONS25 switch to go back to cons25.
2009-11-13 11:28:54 +00:00
Ed Schouten
e42fc36867 Switch the default terminal emulation style to xterm for most platforms.
Right now syscons(4) uses a cons25-style terminal emulator. The
disadvantages of that are:

- Little compatibility with embedded devices with serial interfaces.
- Bad bandwidth efficiency, mainly because of the lack of scrolling
  regions.
- A very hard transition path to support for modern character sets like
  UTF-8.

Our terminal emulation library, libteken, has been supporting
xterm-style terminal emulation for months, so flip the switch and make
everyone use an xterm-style console driver.

I still have to enable this on i386. Right now pc98 and i386 share the
same /etc/ttys file. I'm not going to switch pc98, because it uses its
own Kanji-capable cons25 emulator.

IMPORTANT: What to do if things go wrong (i.e. graphical artifacts):

- Run the application inside script(1), try to reduce the problem and
  send me the log file.
- In the mean time, you can run `vidcontrol -T cons25' and `export
  TERM=cons25' so you can run applications the same way you did before.
  You can also build your kernel with `options TEKEN_CONS25' to make all
  virtual terminals use the cons25 emulator by default.

Discussed on:	current@
2009-11-13 05:54:55 +00:00
Ed Schouten
3a8a07eadd Allow Syscons terminal emulators to provide function key strings.
xterm and cons25 have some incompatibilities when it comes to escape
sequences for special keys, such as F1 to F12, home, end, etc. Add a new
te_fkeystr() that can be used to override the strings.

scterm-sck won't do anything with this, but scterm-teken will use
teken_get_sequences() to obtain the proper sequence.
2009-11-11 08:20:19 +00:00
Jung-uk Kim
761eeb5fff Fix VESA color palette corruption:
- VBE 3.0 says palette format resets to 6-bit mode when video mode changes.
We simply set 8-bit mode when we switch modes if the adapter supports it.
- VBE 3.0 also says if the mode is not VGA compatible, we must use VBE
function to save/restore palette.  Otherwise, VGA function may be used.
Thus, reinstate the save/load palette functions only for non-VGA compatible
modes regardless of its palette format.
- Let vesa(4) set VESA modes even if vga(4) claims to support it.
- Reset default palette if VESA pixel mode is set initially.
- Fix more style nits.
2009-11-03 20:22:09 +00:00
Jung-uk Kim
974f3534c0 Search for default 800x600 graphics mode from supported VESA mode list.
Many video controllers do not support 800x600x24 mode any more.
2009-10-23 18:53:21 +00:00
Ed Schouten
53e69c0c2a Add support for VT200-style mouse input.
Right now if applications want to use the mouse on the command line,
they use sysmouse(4) and install a signal handler in the kernel to
deliver signals when mouse events arrive. This conflicts with my plan to
change to TERM=xterm, so implement proper VT200-style mouse input.

Because mouse input is now streamed through the TTY, it means you can
now SSH to another system on the console and use the mouse there as
well. The disadvantage of the VT200 mouse protocol, is that it doesn't
seem to generate events when moving the cursor. Only when pressing and
releasing mouse buttons.

There are different protocols as well, but this one seems to be most
commonly supported.

Reported by:	Paul B. Mahol <onemda gmail com>
Tested with:	vim(1)
2009-09-27 18:19:41 +00:00
Ed Schouten
56a4365bde Add 256 color support.
It is quite inconvenient that if an application for xterm uses 256 color
mode, text suddenly starts to blink (because of ;5; in the middle).
We'd better just implement 256 color mode and add a conversion routine
from 256 to 8 color mode, which doesn't seem to be too bad in practice.

Remapping colors is done quite simple. If one of the channels is most
actively represented, primary colors are used. If two channels are most
actively represented, secondary colors are used. If all three channels
are equal (gray), it picks between black and white.

Reported by:	Paul B. Mahol <onemda gmail com>
2009-09-26 15:26:32 +00:00
Ed Schouten
790dd1b5af Just use ttydisc_rint_simple() instead of doing it ourselves.
This code seems to do exactly the same as ttydisc_rint_simple() does
nowadays. Just remove it.

Obtained from:	//depot/user/ed/newcons/sys/dev/syscons/syscons.c
2009-09-18 15:39:09 +00:00
Ed Schouten
94dc815e34 Make sure we never place the cursor outside the screen.
For some vague reason, it may be possible that scp->cursor_pos exceeds
scp->ysize * scp->xsize. This means that teken_set_cursor() may get
called with an invalid position. Just ignore the old cursor position in
this case.

Reported by:	Paul B. Mahol <onemda gmail com>
MFC after:	1 month
2009-09-13 18:45:59 +00:00
Ed Schouten
87da28e914 Commit a change that I missed in the previous commit.
I ran `svn commit' in sys/teken/, instead of sys/.
2009-09-12 14:46:22 +00:00
Ed Schouten
e06d84fc49 Make 8-bit support run-time configurable.
Now to do the same for xterm support. This means people can eventually
toy around with xterm+UTF-8 without recompiling their kernel.
2009-09-12 10:34:34 +00:00
Xin LI
7ec7f6d5ed Make use of the more flexable device hints by adding a new field,
vesa_mode to specify VESA mode, as suggested by jhb@.
2009-09-12 00:12:47 +00:00
Xin LI
493d6f54bc Extend the usage of sc(4)'s hint variable 'flag'. Bit 0x80 now means
"set vesa mode" and higher 16bits of the flag would be the desired mode.

One can now set, for instance, hint.sc.0.flags=0x01680180, which means
that the system should set VESA mode 0x168 upon boot.

Submitted by:	paradox <ddkprog yahoo com>, swell k at gmail.com with
		some minor changes.
2009-09-11 02:07:24 +00:00
John Baldwin
9425bee7a0 Don't malloc a buffer while holding the prison0 mutex. Instead, use a loop
where we figure out the hostname length under the lock, malloc the buffer
with the lock dropped, then recheck the length under the lock and loop again
if the buffer is now too small.

Tested by:	Norbert Koch  nkoch  demig de
MFC after:	3 days
2009-09-10 12:58:37 +00:00