Commit Graph

65 Commits

Author SHA1 Message Date
Warner Losh
73701bbe9d kbdcontrol -h prints two error messages.
We loop through getopt(3) twice. Once for -P args and once for the
rest. Catch '?' and print usage when that happens.
2019-06-24 21:05:14 +00:00
Stefan Eßer
96329ce7e2 Silence Clang Scan warning about use of unitialized variable.
While the warning is a false positive, it is possible to clarify the code by
always initializing the variable. This does also allow to make the sending
of the "beep" control sequence depend on the validity of its parameters.

I have left the redundant assignment of 0 to the now initialized variables
in place since this makes the code simpler to understand and does not add
any run-time overhead (the compiler completely removes the "else if" test
and the assignments).

There was an embedded literal escape character in a string, which messes up
diplaying the source code on a terminal that interprets ANSI sequences. The
literal escape has been replaced by \e (non-standard, but supported by all
relevant compilers, and already used in other source files in base).

MFC after:	2 weeks
2019-01-23 10:05:27 +00:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Ed Maste
8c0d1b4798 kbdcontrol: add -P path option to add keymap search paths
PR:		193865
Reviewed by:	cem
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5645
2016-03-16 04:05:02 +00:00
Stefan Eßer
0ae9426c10 Remove band.aid that made kbdcontrol lookup keymap files in the syscons
path even under vt, which is no longer useful, since the syscons keymap
files have been converted and committed for use by vt.
2014-08-26 09:37:43 +00:00
Stefan Eßer
895a99ef10 The previous commit (r269119) introduced a regression: It removed the
ability to specify the the full path name of the keymap file.

Instead leave the original search order intact, but insert the path for
newcons-specific fonts (if run on a system using newcons):

	- KEYMAP_PATH in environment
	- full path name
	- /usr/share/vt/keymaps		(only if newcons is in use!)
	- /usr/share/syscons/keymaps	(also as fall-back for newcons)

MFC after:	1 week
2014-07-26 13:14:28 +00:00
Stefan Eßer
e34c3e1817 Fix obvious off by one error: prefix[1] should be set to the path of the
newcons specific keymap files, not prefix[2]. The result of this bug was
that kbdcontrol ignored the files in the syscons keymap directory, which
apparently still work under newcons, for most locales.

MFC after:	1 week
2014-07-26 12:17:26 +00:00
Ed Maste
6c79f78813 Fix vt(4) detection in kbdcontrol and vidcontrol
As sc(4) and vt(4) coexist and are both enabled in GENERIC, the existence
of a vt(4) sysctl is not sufficient to determine that vt(4) is in use.

Reported by:	Trond Endrestøl
2014-07-02 20:40:59 +00:00
Aleksandr Rybalko
2f11ee6205 Enable kbdcontrol(1) to use maps from vt(4) keymaps dir /usr/share/vt/keymaps
if vt(4) is present.

MFC after:	7 days
Sponsored by:	The FreeBSD Foundation
2014-05-29 14:39:25 +00:00
Ulrich Spörlein
f76b319989 Reencode files to UTF-8. Drop CP1252 em-dash. 2011-12-30 00:59:08 +00:00
Ed Schouten
4d9a3537ff Add missing static and const keywords to kbdcontrol.
None of the symbols provided by kbdcontrol.c are used by other source
files of this binary. Slightly reduce the binary size and make much more
symbols read-only by adding proper static and const keywords.
2011-12-12 12:33:38 +00:00
Ed Schouten
9a958de54c ANSIfy some more tools in usr.sbin/.
Most of these tools build with WARNS=6, except for their use of K&R
function declarations.
2010-01-02 11:05:34 +00:00
Ed Schouten
b05f9c86d1 Make the keyboard layer Unicode aware.
Just take keyent_t to use an u_int to store the Unicode codepoints.
Unfortunately the keymap is now too big to be loaded using an ioctl
argument, so change the ioctl to pick a pointer.

This change breaks kbdcontrol ABI. It doesn't break X11, because X11
doesn't do anything with syscons keymaps. It just switches the device
out of K_XLATE.

Obtained from:	//depot/user/ed/newcons/...
2009-09-19 17:56:26 +00:00
Ed Schouten
daf4075a30 Unhardcode 0x100 inside kbdcontrol.
In preparation for Unicode support for the keyboard layer, we'd better
get rid of all the hardcoded 0x100/0xff constants in kbdcontrol.
Instead, add a flag called SPECIAL stored in the top bit of the integer.

Adding Unicode support is very simple now; just change u_char map[] to
u_int map[] in keyent_t, change the bounds checking in kbdcontrol to
0x1FFFFF and modify the ioctls to allow loading these new keymaps.
2009-08-24 09:17:01 +00:00
Ruslan Ermilov
5a66b66324 Replace magic numbers for console bell types with defines. 2006-11-16 12:27:51 +00:00
Maksim Yevmenkin
eb65c05e44 Make op parameter to mux_keyboard() u_int instead of int.
This should fix sparc64 messages like

Sep 15 11:17:39 peahi kernel: WARNING pid 5477 (kbdcontrol): ioctl sign-extension ioctl ffffffff80244b45

PR:		sparc64/96798
MFC after:	1 week
2006-09-15 18:41:12 +00:00
Maksim Yevmenkin
4673ea01e3 kbdmux(4) keyboard multiplexer integration
o Slightly change KBADDKBD and KBRELKBD ioctl() interface. Instead of passing
  keyboard index pass keyboard_info_t structure with populated 'kb_unit' and
  'kb_name' fields. Keyboard index is not very user-friendly and is not very
  easy to obtain. Keyboard driver name and unit, on the other hand, is much
  more user friendly and known almost all the time;

o Move definition of keyboard_info_t structure up;

o Teach kbdcontrol(1) how to attach/detach keyboards to/from the keyboard
  multiplexor;

o Update kbdcontrol(1) man page and document new functionality.

To attach/detach keyboard to/from keyboard multiplexor one needs to use
keyboard device name (i.e. ukbd0).

MFC after:	1 week
2005-07-14 22:43:20 +00:00
John-Mark Gurney
37a0f3914b fix bug which prevented programming function keys that were exactly 16
characters long..  strcpy was coping over the length...

PR:		52960
Submitted by:	Dmitry Sivachenko
MFC after:	1 week
2004-08-09 04:27:58 +00:00
David E. O'Brien
b728350ee6 Use __FBSDID over rcsid[]. Protect copyright[] where needed. 2003-05-03 21:06:42 +00:00
Alfred Perlstein
4f5d913371 WARNS?=4 cleanup. 2002-07-11 21:12:18 +00:00
Alfred Perlstein
b6528e647b de-__P() 2002-07-11 20:53:56 +00:00
Jens Schweikhardt
21dc7d4f57 Fix typo in the BSD copyright: s/withough/without/
Spotted and suggested by:	des
MFC after:	3 weeks
2002-06-02 20:05:59 +00:00
Ruslan Ermilov
2619d7c271 FreeBSD 4.1 bootstrapping aid (HALT and PDWN are not defined there). 2002-02-08 09:37:12 +00:00
David E. O'Brien
bdcfaae4cc Repeat after me: "when reporting `file not found', perform a little bit of
useful HCI consideration and tell which file was being looked for".
2001-07-13 16:30:11 +00:00
Maxim Sobolev
13edc2540c - Syncronizes command line syntax warnings with manpage (bin/27010);
- silence gcc(1) warnings (sobomax).

PR:		27010
Submitted by:	Alex Kapranoff <alex@kapran.bitmcnit.bryansk.su>, sobomax
MFC after:	10 days
2001-05-29 13:59:02 +00:00
Dag-Erling Smørgrav
031c57af94 Move the scrollback controls from kbdcontrol to vidcontrol.
Also fix some style bugs in the code and poor language in the man pages.

Reviewed by:	sobomax
2001-05-28 11:05:28 +00:00
Dima Dorfman
50eb7c28e9 Instead of defining CONS_CLRHIST if it isn't defined, simply disable
the -c option [when CONS_CLRHIST isn't defined].  This is okay since
the only time CONS_CLRHIST wouldn't be defined is when kbdcontrol is
being built in bootstrap-tools, and -c isn't needed then.

Submitted by:	imp
2001-05-27 06:28:08 +00:00
Dima Dorfman
68c805eb99 A la rev. 1.36, define CONS_CLRHIST here if it isn't already since
this is a build tool, so it has to build on 4.x with the old headers.
2001-05-27 04:03:52 +00:00
Dima Dorfman
84d337151e Add a -c option which clears the history buffer using the new
CONS_CLRHIST ioctl.

PR:		27616
Reviewed by:	ru
2001-05-27 00:47:38 +00:00
Warner Losh
f83a28e05b If PASTE isn't defined, define it as a transitional measure. This
allows me to complete make buildworld on my stable machine.

Also change termination case to be clearer what is going on while
searching for map files.
2001-05-15 22:53:05 +00:00
Maxim Sobolev
8e21e585dc Fix a possible segfault introduced in my previous commit. 2001-05-14 06:15:07 +00:00
Maxim Sobolev
b010fac286 Allow path where keyboard maps are looked for to be altered using environment
variable.
2001-05-12 09:16:09 +00:00
Andrey A. Chernov
4629b5e0fb Implement keyboard paste
PR:		25499
Submitted by:	Gaspar Chilingarov <nm@web.am>
2001-03-11 22:51:05 +00:00
Poul-Henning Kamp
00d25f512c Initiate deorbit burn sequence for <machine/console.h>.
Replace all in-tree uses with necessary subset of <sys/{fb,kb,cons}io.h>.
This is also the appropriate fix for exo-tree sources.

Put warnings in <machine/console.h> to discourage use.
November 15th 2000 the warnings will be converted to errors.
January 15th 2001 the <machine/console.h> files will be removed.
2000-10-08 21:34:00 +00:00
David Malone
1c06ce6197 Add the ability to define a "shutdown" and "shutdown and poweroff" key
to syscons. I have a man page to follow describing the format of the
kbdmap file.

PR:		19273
Reviewed by:	sheldonh
2000-09-11 20:37:42 +00:00
Kazutaka YOKOTA
52990a39d0 Define some more function keys in the keymap: panic, lshifta, rshifta, etc. 1999-12-10 04:24:27 +00:00
Peter Wemm
e46b89dc93 Fix warning: return type of main' is not int' 1999-09-15 01:58:44 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Kazutaka YOKOTA
39c33d76ab - Add new argument off' to the -b' option. This will turn off
the bell.
- Document it in the man page.
- Fix a couple of typo in the man page.

Submitted by: cpiazza
1999-07-22 14:19:14 +00:00
Kazutaka YOKOTA
ac80d4b498 Reflect recent changes in syscons. 1999-06-22 14:15:46 +00:00
Kazutaka YOKOTA
f64191e962 Added backward compatibility to set key repeat rate.
Requested by: bde
1999-05-09 04:57:51 +00:00
Gary Palmer
27e62f6737 Fix builds for the AXP
Submitted by:	Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
1999-03-17 11:42:18 +00:00
Kazutaka YOKOTA
e9deda23ae Keyboard driver update in preparation for the USB keyboard driver.
- Refined internal interface in keyboard drivers so that:
  1. the side effect of device probe is kept minimal,
  2. polling mode function is added,
  3. and new ioctl and configuration options are added (see below).

- Added new ioctl: KDSETREPEAT
  Set keyboard typematic rate.  There has existed an ioctl command,
  KDSETRAD, for the same purpose.  However, KDSETRAD is dependent on
  the AT keyboard.  KDSETREPEAT provides more generic interface.
  KDSETRAD will still be supported in the atkbd driver.

- Added new configuration options:
  ATKBD_DFLT_KEYMAP
  Specify a keymap to be used as the default, built-in keymap.
  (There has been undocumented options, DKKEYMAP, UKKEYMAP, GRKEYMAP,
  SWKEYMAP, RUKEYMAP, ESKEYMAP, and ISKEYMAP to set the default keymap.
  These options are now gone for good.  The new option is more general.)

  KBD_DISABLE_KEYMAP_LOADING
  Don't allow the user to change the keymap.
1999-03-10 10:36:53 +00:00
Doug Rabson
f01de75c0f Remove a workaround for the alpha port using an outdated version of syscons. 1999-01-23 17:04:13 +00:00
Matt Jacob
45d1a2e005 Fix for compiling on alpha.
Obtained from:yokota@zodiac.mech.utsunomiya-u.ac.jp
1999-01-12 23:06:29 +00:00
Kazutaka YOKOTA
c67e8bd332 The first stage of console driver reorganization: activate new
keyboard and video card drivers.
1999-01-11 03:20:32 +00:00
Kazutaka YOKOTA
d30ada6d4b The fix in the previous commit was not sufficient; the upper 24 bits
of an int argument still contained garbage.
Pointed out by: bde
PR: bin/7799
1998-09-10 12:20:09 +00:00
Kazutaka YOKOTA
afab29051f Fix uninitialized variable.
PR: bin/7799
Submitted by: Sheldon Hearn (axl@iafrica.com)
1998-09-04 10:15:48 +00:00
Kazutaka YOKOTA
b897510f7a The control code ^_ (0x1f) should really be called "us" rather than "ns".
In the mean time, accept both "us" and "ns" in the keymap file as ^_
for the compatibility with the existing keymap files.
1998-08-06 09:44:23 +00:00
Kazutaka YOKOTA
28d2c691c0 Added the `saver' key definition. The saver key will activate the screen
saver if one is loaded.
1998-08-03 11:33:22 +00:00