vt: Expose system-wide UTF-8 default setting via sysfs
PATCH 1/1 vt: Expose system-wide UTF-8 default setting via sysfs
Create a variable, default_utf8, that defines the system-wide default UTF-8 setting. This variable can be altered via sysfs. If the variable is properly set, this should mimimize breakage of UTF-8 encoded consoles when doing a reset or echo -e '\033c' and of newly opened/allocated consoles.
This is based from patches by Jan Engelhardt and Paul LeoNerd Evans.
---
Quoted 4 lines
I think you're missing the whole point of console reset. Its purpose is to force the console into a known-good state. The fewer pieces of state it leaves unset, the better. To some degree it's less important what that state actually is.
Okay, you convinced me. Hopefully this is acceptable to all parties.
Andrew,
If everybody agrees, can you drop the previous patch I sent to you, and use this instead?
Tony
drivers/char/vt.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/char/vt.c +3 -1
@@ -157,6 +157,8 @@ static void blank_screen_t(unsigned longstatic void set_palette (struct vc_data *vc);static int printable;/* Is console ready for printing? */ +static int default_utf8; +module_param (default_utf8, int,S_IRUGO |S_IWUSR );/* * ignore_poke: don't unblank the screen when things are typed. This is
@@ -1497,7 +1499,7 @@ static void reset_terminal(struct vc_dat vc->vc_charset =0 ; vc->vc_need_wrap =0 ; vc->vc_report_mouse =0 ; - vc->vc_utf =0 ; + vc->vc_utf = default_utf8; vc->vc_utf_count =0 ; vc->vc_disp_ctrl =0 ;
Quoted 19 lines · Antonino A. Daplas
Create a variable,
default_utf8, that defines the system-wide default UTF-8 setting. This variable can be altered via sysfs. If the variable is properly set, this should mimimize breakage of UTF-8 encoded consoles when doing a reset or echo -e '\033c' and of newly opened/allocated consoles.This is based from patches by Jan Engelhardt and Paul LeoNerd Evans.
Signed-off-by Antonino Daplas <[email protected]>---
Quoted 1 line
I think you're missing the whole point of console reset. Its purpose is to force the console into a known-good state. The fewer pieces of state it leaves unset, the better. To some degree it's less important what that state actually is.
Okay, you convinced me. Hopefully this is acceptable to all parties.
Andrew,
If everybody agrees, can you drop the previous patch I sent to you, and use this instead?
Tony
drivers/char/vt.c static void blank_screen_t(unsigned long · line 161
Quoted 2 lines
drivers/char/vt.c +2
-0+static int default_utf8; +module_param (default_utf8, int,S_IRUGO |S_IWUSR );
Module parameter without description and documentation? Yes, I understand that it is impossible to make vt a module. How about adding a line to Documentation/kernel-parameters.txt?
Other than that, the patch looks like a useful change.
Signature · 1 line
Alexander E. Patrakov
Quoted 22 lines · Alexander E. Patrakov
Quoted 21 lines · Antonino A. Daplas
Create a variable,
default_utf8, that defines the system-wide default UTF-8 setting. This variable can be altered via sysfs. If the variable is properly set, this should mimimize breakage of UTF-8 encoded consoles when doing a reset or echo -e '\033c' and of newly opened/allocated consoles.This is based from patches by Jan Engelhardt and Paul LeoNerd Evans.
Signed-off-by Antonino Daplas <[email protected]>---
Quoted 4 lines
I think you're missing the whole point of console reset. Its purpose is to force the console into a known-good state. The fewer pieces of state it leaves unset, the better. To some degree it's less important what that state actually is.
Okay, you convinced me. Hopefully this is acceptable to all parties.
Andrew,
If everybody agrees, can you drop the previous patch I sent to you, and use this instead?
Quoted 7 lines
drivers/char/vt.c static void blank_screen_t(unsigned long · line 161
Quoted 3 lines
Tony
drivers/char/vt.c +2
-0+static int default_utf8; +module_param (default_utf8, int,S_IRUGO |S_IWUSR );Module parameter without description and documentation? Yes, I understand that it is impossible to make vt a module. How about adding a line to
Documentation/kernel-parameters.txt?
I'll do that (and I'll also include Jan's palette patch) once I'm sure there's no violent objection against the change.
Tony
Hi!
Quoted 4 lines
Create a variable,
default_utf8, that defines the system-wide default UTF-8 setting. This variable can be altered via sysfs. If the variable is properly set, this should mimimize breakage of UTF-8 encoded consoles when doing a reset or echo -e '\033c' and of newly opened/allocated consoles.
HPA is right... this should be fixed in userland. Reset should reset a console, and if you want utf-8, do \ec\ewhatever to get it.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 2 lines · Pavel Machek
HPA is right... this should be fixed in userland. Reset should reset a console, and if you want utf-8, do \ec\ewhatever to get it.
As I've already said elsewhere, does anything say that "reset" means that UTF-8 is turned off, or merely reset back to some known state? I personally would consider that UTF-8 being on is the default, and if something wants it off it should ask specifically..
Consider any other terminal emulator, such as those running on X11; when they're reset, they know to keep UTF-8 mode turned on, because it said so in their config, or in the locale. Kernel doesn't really have nice access to the LANG environment variable, but we can give it something similar; namely, via a module parameter.
Signature · 5 lines
Paul "LeoNerd" Evans [email protected] ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/
Quoted 9 lines · Paul LeoNerd Evans
Quoted 2 lines · Pavel Machek
HPA is right... this should be fixed in userland. Reset should reset a console, and if you want utf-8, do \ec\ewhatever to get it.
As I've already said elsewhere, does anything say that "reset" means that UTF-8 is turned off, or merely reset back to some known state? I personally would consider that UTF-8 being on is the default, and if something wants it off it should ask specifically..
Quoted 5 lines
Consider any other terminal emulator, such as those running on X11; when they're reset, they know to keep UTF-8 mode turned on, because it said so in their config, or in the locale. Kernel doesn't really have nice access to the LANG environment variable, but we can give it something similar; namely, via a module parameter.
I agree with Paul. Reset or RIS is (R)eset to (I)nitial (S)tate, represented as ESC 06/03. "Initial state" is defined in ECMA-48 as the state of the device after it was made operational. It doesn't necessarily mean that the "initial state" is the safest configuration. So, if this "initial state" includes enabling UTF-8, then the device has to go into UTF-8 upon invoking RIS.
Tony
Hi!
Quoted 14 lines
Quoted 8 lines
Quoted 2 lines
HPA is right... this should be fixed in userland. Reset should reset a console, and if you want utf-8, do \ec\ewhatever to get it.
As I've already said elsewhere, does anything say that "reset" means that UTF-8 is turned off, or merely reset back to some known state? I personally would consider that UTF-8 being on is the default, and if something wants it off it should ask specifically..
Quoted 5 lines
Consider any other terminal emulator, such as those running on X11; when they're reset, they know to keep UTF-8 mode turned on, because it said so in their config, or in the locale. Kernel doesn't really have nice access to the LANG environment variable, but we can give it something similar; namely, via a module parameter.
Quoted 6 lines
I agree with Paul. Reset or RIS is (R)eset to (I)nitial (S)tate, represented as ESC 06/03. "Initial state" is defined in ECMA-48 as the state of the device after it was made operational. It doesn't necessarily mean that the "initial state" is the safest configuration. So, if this "initial state" includes enabling UTF-8, then the device has to go into UTF-8 upon invoking RIS.
You could do that... during development series. But this is userspace-visible API change, and those are not allowed during stable.
...and having /sysctl configuring inital state for reset is just plain ugly.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 5 lines · Pavel Machek
You could do that... during development series. But this is userspace-visible API change, and those are not allowed during stable.
...and having /sysctl configuring inital state for reset is just plain ugly.
Well, how else would you suggest to do it? Bearing in mind all other terminal emulators (xterm, gnome-terminal, konsole, and so on) all have other out-of-band ways to determine this - config files, menu options, locale variables,... None of those are particularlly viable for the kernel. I vote this is the closest thing we've got.
Signature · 5 lines
Paul "LeoNerd" Evans [email protected] ICQ# 4135350 | Registered Linux# 179460 http://www.leonerd.org.uk/
Quoted 4 lines · Pavel Machek
You could do that... during development series. But this is userspace-visible API change, and those are not allowed during stable.
Only if you change the default setting.
-hpa