Skip to content

Commit

Permalink
Merge git://git.infradead.org/embedded-2.6
Browse files Browse the repository at this point in the history
* git://git.infradead.org/embedded-2.6:
  Make console charset translation optional
  • Loading branch information
Linus Torvalds committed Jul 25, 2008
2 parents 762b829 + a29ccf6 commit ff5d48a
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 3 deletions.
8 changes: 8 additions & 0 deletions drivers/char/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ config VT
If unsure, say Y, or else you won't be able to do much with your new
shiny Linux system :-)

config CONSOLE_TRANSLATIONS
depends on VT
default y
bool "Enable character translations in console" if EMBEDDED
---help---
This enables support for font mapping and Unicode translation
on virtual consoles.

config VT_CONSOLE
bool "Support for console on virtual terminal" if EMBEDDED
depends on VT
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ obj-y += mem.o random.o tty_io.o n_tty.o tty_ioctl.o tty_ldisc.o
obj-$(CONFIG_LEGACY_PTYS) += pty.o
obj-$(CONFIG_UNIX98_PTYS) += pty.o
obj-y += misc.o
obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o consolemap.o \
consolemap_deftbl.o selection.o keyboard.o
obj-$(CONFIG_VT) += vt_ioctl.o vc_screen.o selection.o keyboard.o
obj-$(CONFIG_CONSOLE_TRANSLATIONS) += consolemap.o consolemap_deftbl.o
obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o
obj-$(CONFIG_AUDIT) += tty_audit.o
obj-$(CONFIG_MAGIC_SYSRQ) += sysrq.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/vt.c
Original file line number Diff line number Diff line change
Expand Up @@ -2211,7 +2211,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
c = 0xfffd;
tc = c;
} else { /* no utf or alternate charset mode */
tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c];
tc = vc_translate(vc, c);
}

param.c = tc;
Expand Down
14 changes: 14 additions & 0 deletions include/linux/consolemap.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
*
* Interface between console.c, selection.c and consolemap.c
*/
#ifndef __LINUX_CONSOLEMAP_H__
#define __LINUX_CONSOLEMAP_H__

#define LAT1_MAP 0
#define GRAF_MAP 1
#define IBMPC_MAP 2
#define USER_MAP 3

#include <linux/types.h>

#ifdef CONFIG_CONSOLE_TRANSLATIONS
struct vc_data;

extern u16 inverse_translate(struct vc_data *conp, int glyph, int use_unicode);
Expand All @@ -18,3 +22,13 @@ extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
extern u32 conv_8bit_to_uni(unsigned char c);
extern int conv_uni_to_8bit(u32 uni);
void console_map_init(void);
#else
#define inverse_translate(conp, glyph, uni) ((uint16_t)glyph)
#define set_translate(m, vc) ((unsigned short *)NULL)
#define conv_uni_to_pc(conp, ucs) ((int) (ucs > 0xff ? -1: ucs))
#define conv_8bit_to_uni(c) ((uint32_t)(c))
#define conv_uni_to_8bit(c) ((int) ((c) & 0xff))
#define console_map_init(c) do { ; } while (0)
#endif /* CONFIG_CONSOLE_TRANSLATIONS */

#endif /* __LINUX_CONSOLEMAP_H__ */
19 changes: 19 additions & 0 deletions include/linux/vt_kern.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/mutex.h>
#include <linux/console_struct.h>
#include <linux/mm.h>
#include <linux/consolemap.h>

/*
* Presently, a lot of graphics programs do not restore the contents of
Expand Down Expand Up @@ -54,6 +55,7 @@ void redraw_screen(struct vc_data *vc, int is_switch);
struct tty_struct;
int tioclinux(struct tty_struct *tty, unsigned long arg);

#ifdef CONFIG_CONSOLE_TRANSLATIONS
/* consolemap.c */

struct unimapinit;
Expand All @@ -71,6 +73,23 @@ void con_free_unimap(struct vc_data *vc);
void con_protect_unimap(struct vc_data *vc, int rdonly);
int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);

#define vc_translate(vc, c) ((vc)->vc_translate[(c) | \
(vc)->vc_toggle_meta ? 0x80 : 0])
#else
#define con_set_trans_old(arg) (0)
#define con_get_trans_old(arg) (-EINVAL)
#define con_set_trans_new(arg) (0)
#define con_get_trans_new(arg) (-EINVAL)
#define con_clear_unimap(vc, ui) (0)
#define con_set_unimap(vc, ct, list) (0)
#define con_set_default_unimap(vc) (0)
#define con_copy_unimap(d, s) (0)
#define con_get_unimap(vc, ct, uct, list) (-EINVAL)
#define con_free_unimap(vc) do { ; } while (0)

#define vc_translate(vc, c) (c)
#endif

/* vt.c */
int vt_waitactive(int vt);
void change_console(struct vc_data *new_vc);
Expand Down

0 comments on commit ff5d48a

Please sign in to comment.