Solved ABNT2 Keymap.

rigoletto@

Developer
I just installed FreeBSD 10.3 but I cannot find a way to have my keyboard with Brazilian ABNT2 layout working properly, indeed three keyboards.

I tried the three options available on bsdconfig/bsdinstall and none of them works. For instance, the del/delete buttom print " ~ ", not say when just print codes (something like 203/304) when typing " ç ".

Are there another place to look for?

Thanks!
 
  • Thanks
Reactions: 0mp
Please, run the following command:

setxkbmap -model abnt2 -layout br -variant abnt2
 
Hi cpm,

Code:
setxkbmap -model abnt2 -layout br
returns
Code:
setxkbmap: Command not found.
I do not have Xorg here, the problem is really on console.

Thanks!
 
I managed to get " ç " working temporally, until logout at least, but not del, pgup, pgdn etc.

Anyway, I am experiencing this behavior:

If I do setenv LC_ALL pt_BR.UTF8 (or pt_BR.ISO8859-1) I get " ç " (and others accets) working but just until logout and only by setting it on LC_ALL by setenv. When I login again it defaults to:

Code:
LANG=en_US.utf8
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

I tried to set lc_all=pt_BR.UTF8 and charset=br275.cp850 (but also others) on /etc/login.conf but won't work either, still defaults as above.

On /etc/rc.conf were keymap="br275.cp850", what seems to be the correct one for ABNT2 keyboards, but also the another two options available had be tried too.

Just to point out I really use LANG=en_US.utf8 and it is as-is on /etc/login.conf. I think there is no problems with LANG.

NOTE: this is a fresh FreeBSD installation. I did buildworld/buildkernel yesterday with some changes but this issue already existed before that.
 
Add these lines in your $HOME/.cshrc to permanently change it.
Code:
setenv LANG pt_BR.UTF-8
setenv LC_ALL pt_BR.UTF-8
Remember that you can get the .cshrc reread by typing source .cshrc
 
Add these lines in your $HOME/.cshrc

Code:
setenv LANG pt_BR.UTF-8
setenv LC_ALL pt_BR.UTF-8

You shouldn't need to set LC_ALL. Just use LANG for normal purposes (which effectively sets LC_* unless one of them is already set). LANG is the only one which should be set for a standard setup, LC_* are to override things as and when necessary. Also, ~/.cshrc isn't really the best place for it these days. Add the following to ~/.login_conf for the standard more generic personal setup (or similar in /etc/login.conf).
Code:
me:\
    :charset=UTF-8:\
    :lang=pt_BR.UTF-8:
See environ(7), locale(1), setlocale(3), login.conf(5). Remember to cap_mkdb(1).
 
I agree with Murph

Change or modify the following files:

/etc/login.conf
Code:
brazil | Brazilian Users Accounts:\
         :charset=UTF-8:\
         :lang=pt_BR.UTF-8:\
         :tc=default:

/etc/profile
Code:
LANG=pt_BR.UTF-8; export LANG
CHARSET=UTF-8; export CHARSET

$HOME/.login_conf
Code:
me:\
        :charset=UTF-8:\
        :lang=pt_BR.UTF-8:

Run cap_mkdb /etc/login.conf to rebuild the login class capabilities database.

Finally, verify that the new settings took effect by running locale(1).
 
When I run cap_mkdb /etc/login.conf returned: cap_mkdb: potential reference loop detected
I revert everything and tried cap_mkdb /etc/login.conf again, with the same error.

Now I can't login using ssh. It ask for the user password instead the rsa one, and fail with Permission denied (publickey,keyboard-interactive).

I will attach the monitor to try to login as root.
 
  • Thanks
Reactions: 0mp
Reboot on single-user, it works but if I try to grab root or user:

Code:
login_getclass: unknown class 'default'
pam_acct_mgmt: error in service module

I feel anything goes bad on passwd. It is a new installation, I will reinstall.

EDIT: Funny fact, del work on single-user mode.
 
When I run cap_mkdb /etc/login.conf returned: cap_mkdb: potential reference loop detected
I revert everything and tried cap_mkdb /etc/login.conf again, with the same error.

Now I can't login using ssh. It ask for the user password instead the rsa one, and fail with Permission denied (publickey,keyboard-interactive).

I will attach the monitor to try to login as root.

Check that you have commented the previous block:
Code:
#russian|Russian Users Accounts:\
#       :charset=KOI8-R:\
#       :lang=ru_RU.KOI8-R:\
#       :tc=default:
Then run again cap_mkdb /etc/login.conf
 
New installation, first login, changes on #8 made, and working but " del " on root (csh). Anyway, I do not know if it is supposed to work on csh, I never used it before.

cpm@ I had indeed replaced it with the brazil (#8) one. ;)

I am reorganizing things due to reinstall. I will make some test later and post here again.

Thanks!
 
hum... does not fixed yet. Everything made as pointed on #8, reboot and return:

root (csh):

Code:
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

user (sh):

Code:
LANG=pt_BR.UTF-8
LC_CTYPE="pt_BR.UTF-8"
LC_COLLATE="pt_BR.UTF-8"
LC_TIME="pt_BR.UTF-8"
LC_NUMERIC="pt_BR.UTF-8"
LC_MONETARY="pt_BR.UTF-8"
LC_MESSAGES="pt_BR.UTF-8"
LC_ALL=

Result:

root: del, accents, and " ç " not working.
user: del working but not " ç " and accents.

Just to point out, the keyboards are:

Microsoft Wired 200 (attached)
Microsoft Wired 600 (SSH)
Buil in on HP Laptop (SSH)


Thanks!

EDIT: on root if setenv LANG pt_BR-UTF-8

Code:
LANG=pt_BR-UTF-8
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=

Sometimes " ç " and accents works, but most times not - even setting LC_ALL. :mad:

EDIT2: I had to install the system again... due to HDD failure. :confused:
 
I don't know if it is a involuntary typo, but it is pt_BR.UTF-8

You can also add these lines in /etc/csh.login
Code:
setenv LANG pt_BR.UTF-8
setenv MM_CHARSET UTF-8
So if you want to know the available support for locales and how are they written correctly. Run locale -a | grep -i utf

Also it is recommended that LC_COLLATE be set to C because some programs still require ASCII ordering in order to function correctly.

Change in /etc/login.conf:
Code:
-     :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\
+     :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,LC_COLLATE=C:\
 
cpm@

Yes, that was a typo. Setting it on /etc/csh.login totally worked. :cool:
Indeed I also prefer LC_COLLATE=C, I like the organization more.

I still do not have " del " working on csh but I will look on it later.

Many thanks!
 
I'm using twm (nobody uses it, but me) and there are two kind of terminal: uxterm and xterm.
Probably the former was compiled and configured to works with wide chars, but both are work well with accented letters.

After read this thread I could configure both my keyboard and screen fonts.
But some gotchas persist:
- when I type accented letters in console, using sh, it log me out, but "del" key works
- doing same typing, using csh, it works, but "del", don't
My .profile

Code:
LANG="pt_BR.UTF-8"; export LANG
LC_CTYPE="pt_BR.UTF-8"; export LC_CTYPE
#LC_CTYPE=C; export LC_CTYPE
XTERM_LOCALE=pt_BR.UTF-8; export XTERM_LOCALE
 
You will be surprised about how many folks do use x11-wm/twm in here.

(t)csh does no behavior in the same way of sh/bash, but you can set some stuff in .(t)cshrc to make it very close:

Code:
if ( $?tcsh ) then
        bindkey "^[Od"        backward-word        # urxvt
        bindkey "^[Oc"        forward-word        # urxvt
        bindkey    "\e[2~"        overwrite-mode
        bindkey    "\e[3~"        delete-char
        bindkey    "\e[1;5C"    forward-word
        bindkey    "\e[1;5D"    backward-word
        bindkey    "\e[5~"        history-search-backward
        bindkey    "\e[6~"        history-search-forward
        bindkey    "^W"        backward-delete-word
endif
 
I fail to see why should one touch /etc/login.conf for the aforementioned issues whereas ~/.login_conf sounds way better an option to handle it, at least to me.

lebarondemerde My ~/.login_conf:
Code:
me:\
        :charset=UTF-8:\
        :lang=en_US.UTF-8:
And have no issues displaying accents or 'ç'. It'll work as long as UTF-8 is being applied within environment, regardless of LANG remaining en_US.UTF-8. Also, I wonder LC_COLLATE would still require being changed if using en_US.UTF-8 as noted, but cpm@ (or anyone well-acquainted with said detailing as well) should provide an actual answer to this matter. I shall add to everything I've pointed so far that doing so works fine and all the same on either Bourne shell (sh), (t)csh, and even bash once installed.

As a reminder: for the procedure just described, don't forget to run # cap_mkdb .login_conf in your user's home dir then reboot so to get the desired results.

A keymap="br" line in /etc/rc.conf is all I need for my ABNT2 keyboard to work. Make sure to use vt(4) instead of sc(4) though.

I'm using twm (nobody uses it, but me) and there are two kind of terminal: uxterm and xterm.

Probably the former was compiled and configured to works with wide chars, but both are work well with accented letters.


After read this thread I could configure both my keyboard and screen fonts.

But some gotchas persist:

- when I type accented letters in console, using sh, it log me out, but "del" key works

- doing same typing, using csh, it works, but "del", don't

Please confirm deletion through both backspace and del works fine with (u)xterm along with accents as noted in my first highlight. As for the other one, I'll read it as in "system console", and with that I mean basically no X nor anything alike, just plain old vt(4) in a ttyv.

Should both be confirmed, twm would be unrelated to the problem at hand. As for what is related, not only "sh" and "(t)csh" differ as noted (by lebarondemerde), they also would require their own fix in their own ways for each issue presented. For example, proceeding as told by could put (t)csh to work, but won't prevent your Bourne shell ("sh") to log you out or whatever it does wrong if trying to enter accented letters. For that to be fixed as well, a second procedure somewhat resembling the one described for ~/.(t)cshrc would normally be required.

Noted the bold part in the end? Accented letters are not the same as deleting forward/backwards or using any other macro of sorts, which would then require an ~/.inputrc file, or changes in, say, .shrc, in order to workaround. Rather, this problem with accented letters can be solved through adequate setting. You'll need your keyboard properly set so keycodes are sent as meant to instead of re-binding garbage as done in the former approach related to macros and used to fix deletion in (t)csh. You'll also make sure to use UTF-8 through the proceedings I first described regarding ~/.login_conf then # cap_mkdb and so on.
 
I fail to see why should one touch /etc/login.conf for the aforementioned issues whereas ~/.login_conf sounds way better an option to handle it, at least to me.

To create user classes:

Code:
custom|Custom Users Accounts:\
    :charset=UTF-8:\
    :lang=en_US.UTF-8:\
    :lc_collate=C:\
    :lc_monetary=pt_BR.UTF-8:\
    :tc=default:

then change the user class, using chsh(1) for instance.
 
Please confirm deletion through both backspace and del works fine with (u)xterm

Yep. It's working in both (u)xterm. Beside all accented letters!

The issue with "logout" of "system console" persists. But my workaround is switch to csh when I need operate in system console+with accent letters - which is not often used - and... There is another chance: using wildcarts (;-)

BTW... I'm happy with my settings. I can read and write using accents and browse alien systems to maintenance purposes withou much trouble.

Another issue is with Alt (Meta) in emacs: some things seems intencionally difficult but it's because of legacy bad habits from doses and lin*xes... It's a matter of fact relearn use ESC despite Alt or Ctrl-... to get better experiences. Does pay to become acquainted with those things.
 
Worth to mention this link - xkeyboard-config. It's important to name correctly keyboard variants.

Just in case:
To get my pc105 working for pt_BR language

Desktop - abnt2 keyboard layout

in my .xinitrc

setxkbmap -layout br

Code:
marez@pitaya$ setxkbmap -query
rules:      base
model:      pc105
layout:     br

Netbook - us accented (a.k.a us international in alien field)

in my .xinitrc

setxkbmap -layout us -variant alt-intl

Code:
marez@bluenote$ setxkbmap -query
rules:      base
model:      pc105
layout:     us
variant:    alt-intl

Note: this us accented didn't was correctly configured during installation. I must have to tweak it to work.
 
This is what I use and work perfectly for me ( expcept by PR 218660, but that is another story ):

Code:
rules:      base
model:      abnt2
layout:     br
variant:    abnt2

The issue with pc105 is ABNT2 keyboard actually have 107 keys ( or more, I don't remember now ) and not 105 ( like the Portuguese one )[1].

[1] IDK why we need to have an incompatible keyboard instead of using the same layout of Portugal, which is almost the same ( I've used Portuguese keyboard for years ).
 
I never realized that !!! (<8^S)
The issue with pc105 is ABNT2 keyboard actually have 107 keys ( or more, I don't remember now ) and not 105 ( like the Portuguese one )[1].
[1] IDK why we need to have an incompatible keyboard instead of using the same layout of Portugal, which is almost the same ( I've used Portuguese keyboard for years ).
Now... I'm trying the same. Grateful!
Code:
marez@pitaya$ setxkbmap -query
rules:      base
model:      abnt2
layout:     br
variant:    abnt2
 
I found this:

Physical_keyboard_layouts_comparison_ANSI_ISO_KS_ABNT_JIS.png
 
Back
Top