Link to home
Start Free TrialLog in
Avatar of ISC-IT-Admin
ISC-IT-AdminFlag for United Arab Emirates

asked on

How to Disable F4 Key Function in Debian Linux under usr/share/X11/xkb/symbols "US" Layout???

Dear Sir,

I have HP Thin Clients Thin Pro based on Linux Debian Kernel.
I want to disable F4 key in my keyboard.

I know that I can find under that path:

Launch an Xterm, go to /usr/share/X11/xkb/symbols

It’s more easy to use “mousepad”. “vi” is faster but more difficult to use.
I’m using the default keyboard “Generic104-Key PC” - Layout: US English (US) - Variant: Windows-Compatible - Model: evdev - Layout: US

I think that “PC” is for the standard keyboard function or "US"

Mousepad PC or US

What shall I do next to disable F4 function key from my keyboard ???

Please I need help.

Thank You!

Avatar of expert_tanmay
expert_tanmay
Flag of Singapore image

Disable fn in the BIOS
To disable, or enable, the function key (fn) in the BIOS, do the following steps.

   1.      Press the power button to turn on the computer.
   2.      Press the f10 key to open the BIOS setup window.
   3.      Use the right-arrow or left-arrow keys to navigate to the System Configuration option.

Use the up-arrow or down-arrow keys to navigate to the Action Keys Mode option, and then press the enter key to display the Enable / Disable menu.

Select the desired mode:

    *      Disabled : Requires pressing fn key + f1 through f12 to use the action as indicated on the action key. For example, to Disabled f4, press fn + f4 and select disabled
   
   Press f10 key to save the selection and restart the computer.

This should disable your f4 key

regards
Avatar of ISC-IT-Admin

ASKER

Thank You Tanmay for the reply.

In fact, I'm not able to press F10 and enter the bios.
I have HP Thin Client (Thin PRO) based on Linux Debian not a normal PC.
http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareIndex.jsp?lang=en&cc=us&prodNameId=4063704&prodTypeId=12454&prodSeriesId=4063703&swLang=13&taskId=135&swEnvOID=4030

Do you have any idea how to disable it under that path: usr/share/X11/xkb/symbols

Please I need help.

Thank You!
You can use the following command to remap or disable any key of your keyboard:

xmodmap -e 'keycode <value>=<action>'

so to disable f4 key use the command
xmodmap -e 'keycode 70='

you can get keycode that corresponds to certain keyboard button by using simple command xev

regards
Thank you Tanmay for your reply...

Could you please try to explain to me the above more in details.
I'm new to Linux :)

How can I get keycode that corresponds to certain keyboard button by using simple command xev ???

So I need to run only the following command under Xterminal??:  xmodmap -e 'keycode 70='

Thank you for your help,

Regards.
And If I want to enable again F4, what shall I do?

Thanks,
Hello Tanmay,

I would like to let you know.
That I have run the following command in root terminal: Xmodmap -e 'keycode 70='
Nothing happened... Still the F4 is enable... Really Strange... :(

Any help please...

Thank You!
Hi
Please read the article http://www.ehow.com/how_2180748_command-linux-swap-keyboard-keys.html

I think keycode 70 might not be for f4 on your machine...Type this command: xmodmap -pk. This will allow you to view the list and will normally list the keycode on the left with the key it represents in parentheses. Check the correct key code for f4 and then use the xmodmap -e command. To get back the f4 key you have to again use the same command xmodmap -e 'keycode <code>=F4' (here code will be based on your keyboard found using the xmodmap -pk command)..

regards


Thank you Tanmay for the reply.

I will try Xmodmap -pk on my Thin Client and let you know the result.
Do I need to run Xmodmap -e 'keycode ???=' on the terminal itself, or I need to edit ".bashrc" file???

Regards,
you have to run xmodmap on the terminal itself...the command is xmodmap not Xmodmap (x is not capital)


regards
Hello Tanmay,

Thank you for the reply.

In fact, strange:
I typed xmodmap -pk in my terminal, I got all the keyboard keycodes, F4 is 70 as well in my keyboard.
I run Xmodmap -e 'keycode 70=', then I run xmodmap -pk, I saw the keycode belong to 70 empty now not mapped to any key.
I exit the terminal, I went to control panel, keyboard layout, then I pressed F4, I saw on the screen that the F4 key is blinking, it means still enbale.
I went back to the terminal to check, run again xmodmap -pk, I got all the list, but now the keycode 70 came back mapped to F4 automatically.
HOW COME??????

It looks there is another file to be adjusted.

Please any help???

Thank You!!!
Yes sure I run xmodmap without "X" capital...

????
Are you working on a GUI terminal? b'cause this mapping is only for GUI

in your home directory create a file as .Xmodmap and write the following line in that file

keycode 70 =

this file is supposed to get executed every time you start a X session. you can also execute it as follows
xmodmap .Xmodmap

The effect is not global it is only for that X session

regards
Hi Tanmay,

Ah I see, I need the effect to be global not for that terminal Session.
The Thin Client boots, then it connect to Windows...
Bcz I'm using Linux Debian installed on HP Thin Client to connect through RDP to Windows Terminal Services.
I need to disable completely the F4 key...

Any help on how to disable the F4 key global...

Thanks,
What can we found under the following path?

usr/share/X11/xkb/symbols...
Xorg has an xinit script at /etc/X11/xinit/xinitrc that loads a global Xmodmap file for all users. The default location is /etc/X11/Xmodmap.
But if you are using KDE, it doesn't automatically do this, you should add it: Open the Xsession file ($KDEDIR/share/config/kdm/Xsession) and add the following line:

[ -f /etc/X11/Xmodmap ] && xmodmap /etc/X11/Xmodmap

then in /etc/X11/Xmodmap append the following

keycode 70 =

In your case X will always have to start. If you want the effect with gdm also

create a file rc.keyboard: call it from rc.local

loadkeys=/usr/bin/loadkeys
pckeymap=/root/keyboard/pckeymap_swap.map

if [ -x $loadkeys ]
then
if [ -f $pckeymap ]
then
echo -n "Swapping Control & Caps_Lock keys - " 
$loadkeys $pckeymap
else
echo "Can't find $pckeymap!"
fi
else
echo "Can't find $loadkeys!"
fi

then edit pckeymap_swap.map

rgds
Hello Tanmay,

Thank you for the reply.
Could you please try to re-phrase the above details.
I'm new to Linux, I didn't understand well the above procedure.

Please try to download the HP Thin Pro Linux Debian and you can open it with Vmware Player for evaluation.

http://h20000.www2.hp.com/bizsupport/TechSupport/SoftwareDescription.jsp?lang=en&cc=us&prodTypeId=12454&prodSeriesId=4063703&prodNameId=4063704&swEnvOID=4030&swLang=13&mode=2&taskId=135&swItem=vc-86128-1

You can find Xterminal under Control Panel, Advanced.

Any chance please to explain to me more in details the above.

Thank you for your help!

Regards,
Not a problem can you find this file  /etc/X11/Xmodmap
append the following to this file
keycode 70 =

Now restart your terminal and check


cheers
Hi Tanmay,

In fact, I don't have xmodmap file under /etc/X11

Please find attached screen shot for more information:

Any help please.

Thank You!


IMG-0694.JPG
Hi ISC,
I found the following document on googleing
http://h10032.www1.hp.com/ctg/Manual/c02558244.pdf
read about keyboard layout and preferences on page 36.

Double-click Keyboard Preferences.
2. Set your preferences on the three tabs:
¿ Settings: set typing and cursor speeds
¿ Shortcuts: add or remove keyboard shortcuts
¿ Accessibility: enable and set parameters for sticky keys, slow keys, and bounce keys

The important part is the shortcut and Accessibility section. Check f4 might have been assigned as some shortcut.

cheers
Hello Tanmay,

In fact, I have already this document.
There is nothing related on how to disable F4.
Under Shortctus, there is some Keyboard shortcuts to log in as Administrator Mode on the Thin Client.
If you set it as NONE no shortcuts, you cannot login to the Thin Client as administrator anymore.
I have already play with this.

However, I contacted HP and they told me it's a Linux Debian kernel, you can disable F4 under the following path, and you need to have a good knowledge in linux : /usr/share/X11/xkb/symbols
I tried but without success...

I'm using it as Kioske mode, when the Thin Client boots, I configure it to connect automatically using RDP protocol to Windows Terminal Services. Our appliaction is installed on TS windows.
But when the Student Press Alt+F4, the session is closed to Windows then It open again, because I configured the Thin Client to Auto reconnect. That's why I want to disable F4.
I don't want the student to press Alt+F4...

Any help Tanmay.

Thank You.
Hi
Can you find the line
Option "XkbLayout"
in the file /etc/X11/XF86Config (sometimes /etc/X11/XF86Config-4 )
what is the asigned value for this option

ASKER CERTIFIED SOLUTION
Avatar of expert_tanmay
expert_tanmay
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Pls post the output of the following command
grep -C 3 -i xkb /etc/default/keyboard

Also give the following in /etc/X11/xorg.conf.
XKBMODEL=??
XKBLAYOUT="??
XKBVARIANT=??
XKBOPTIONS=??

You can also get the details above using yhe command
/sbin/udevadm info --export-db | grep -i XKB

To switch to another layout, we can add some overriding rules in /etc/X11/xorg.conf.

To see a full list of keyboard models, layouts, variants and options, open:
/usr/share/X11/xkb/rules/xorg.lst

To set the keymap for the current Xorg session:(suppose dvorak is avaialable in /usr/share/X11/xkb/rules/xorg.lst)
setxkbmap dvorak

Viewing Keyboard Settings
setxkbmap -print -verbose 10

To permanently change your keyboard layout, add the following to xorg.conf: :(suppose dvorak is avaialable in /usr/share/X11/xkb/rules/xorg.lst)

Section "InputClass"
    Identifier             "Keyboard Defaults"
    MatchIsKeyboard         "yes"
    Option                 "XkbLayout" "dvorak"
EndSection
Thank You Tanmay for the reply.
I will get the outpout as soon as possible and post it here.
Please stay tuned.

Thanks,