Jump to content
Flirc Forums

How to setup from a french keyboard


Tetsuo

Recommended Posts

Hi,

 

it'll be a great help if someone post this kind of howto.

 

It's a pain to try to find keys between the GUI keyboard and a foreign one (like AZERTY french for me).

I've try many things like:

 

1 - a simple equivalence mapping, it's working for "simple" ones like Q for A but not for more complex ones like /*+ ...

2 - config my locale on us keyboard (I'm on GNU/Linux), the map respond good but bad when you come back to your original local keyboard.

3 - have fun to map every GUI keys on with my remote controller and test it in an editor to find mapping. But ... now I lost my precious file ^^.

 

It's a pain for me to make the third option again, so I decide to write you, maybe someone hear me and have made a similar work and be kind to post is howto ^^

 

Otherwise I love Flirc, it's a fantastic and precious tool, thank you very much.

 

 

Link to comment
Share on other sites

This solution is incorrect. Please look at my next post for a proper one.

 

You can use flirc_util command line utility. It has a record_api command which allows you to assign a remote buttons to any arbitrary key and modifiers.

 

From the help in the utility itself (version 1.2.6) the usage is as follows:

 

flirc_util record_api 136 4

 

where 136 is the combined value for modifier keys, and 4 is the key code on the keyboard (all values are decimal).

 

The modifier value is composed of following values:

LEFT  CONTROL          1
LEFT  SHIFT            2
LEFT  ALT              4
LEFT  CMD|WIN          8
RIGHT CONTROL          16
RIGHT SHIFT            32
RIGHT ALT              64
RIGHT CMD|WIN          128

So if you want to use for example left control + left shift then the modifier value for the command will be 3 (logical OR, but you can just use sum of both values).

 

The key codes are a little different for each keyboard layout. That's why you have problems mapping the buttons using GUI as it is based on US layout key codes. You need to find a list of key codes for French layout or you could use some application that shows you the key code when the key is pressed. BTW the key codes are assigned to a physical key, not to a letter or symbol. So for US keyboard layout = and + have the same key code but they differ in modifier keys used (in case of + sign you need to add shift modifier key).

Edited by yawor
Incorrect solution. Please look at my next post for a proper one..
Link to comment
Share on other sites

yawor,

thanks for your precious help.

It's more easy for me to use the cli now.

 

I follow your advice but I didn't find the right keycode.

 

First find the list with all my key codes (i'm in the french layout):

showkey --scancodes

I find a common QWERTY / AZERTY keycode for example the 'r':

 

keycode  27 = r R r R paragraph registered paragraph

Now I use the cli:

./flirc_util record_api 0 27

finally if I check Flirc keys, the record is 'x'

./flirc_util keys
13  BF292985    x

I make the same operation whith my keyboard in a AZERTY / US mode, no chance :(

 

Can you plesase post me your keycodes ? Maybe it'll serve me as reference ?

Link to comment
Share on other sites

I'm sorry, I've might have been too quick to respond with the solution. You actually need an USB HID code of the key. I've done some research and it looks like the HID codes don't change between keyboard layouts but they are not assigned to a symbols on the key but to a physical key location on the keyboard. And also sorry for not noticing you are using Linux. I wouldn't propose a Windows app :).

 

I don't know the French layout so I'll use image below as a base.

 

kfrench.gif

I've also found a nice page which lists all HID keys: http://hp.vector.co.jp/authors/VA003720/lpproj/others/kbdjpn.htm

 

The numbers on the keyboard representations are not HID codes but the indexes in the tables below where you can find HID table/page and code (ID) in USB HID Usage column. You only need the ID value. You can only use codes from HID page 7 for the standard keyboard keys. The codes there are hexadecimal so you need to convert them to decimal for use with flirc_util.

 

You also should be able to use GUI, but don't look at the characters or symbols on the displayed keyboard but the key location itself. For example if you want to assign a # sign to the remote button which is on 4th key in the first row you need to record a key for Right Alt + 3 in the GUI or use:

flirc_util record_api 64 32

I see that for numbers you actually need to add shift to record them.

 

I hope that this will work properly now. I can't test this fully as I'm not experiencing such problems myself as in Poland most (if not all) people use Polish Programmer keyboard layout variant which is almost 100% compatible with US layout (polish characters are achieved using Alt-Gr - right alt key).

Link to comment
Share on other sites

This is great yawor !

I can exactly do what I want thank you again for all details, explanation and research ;)

 

I was very far from find that way of USB HID !

Now, I check the HID of the key convert it and record it.

 

For example if I want LEFT WIN + LEFT CTRL + r:

 

 MODIFIER_VALUE = LEFT WIN + LEFT CTRL is 8 + 1 = 9

HID_KEY = I check USB HID for 'r' is 15

KEYCODE = convert the hexa in decimal give me 21 (http://www.binaryhexconverter.com/hex-to-decimal-converter)

Record my key:

./flirc_util record_api 9 21

For GNU/Linux users you can directly search HID and use:

./flirc_util record_api 9 $(echo "ibase=16; 15" | bc)
./flirc_util record_api MODIFIER_VALUE $(echo "ibase=16; HID_KEY" | bc)

It's work like a charm on GNU Linux of course ^^

Edited by Tetsuo
  • Like 1
Link to comment
Share on other sites

This is a bash script to convert the keys:

#!/bin/bash

# USAGE
# flirc_key converter           
# flirc_key converter keys      


FLIRC_UTIL_FILE="$HOME/.flirc/flirc_util"            # modify this path to the 'flirc_util' utility

usage()
{
    echo " usage:  `basename $0` <OPTIONAL ARGUMENT>"
    echo
    echo "   -h,--help                              Display help information"
    echo "   -k,--keys                              Print and convert the keys stored in flirc"
    echo ""
    echo " (if no argument is passed to the script, it'll ask you what char(s) you want to convert)"

    exit 1
    
}

if [ -z "$1" ]; then                                  # no argument passed to the script
    echo -ne "String to convert: "; read STRING
    STRING_LENGTH=${#STRING}

    for (( i=0; i<=$((STRING_LENGTH-1)); i++ ))
    do
        echo "'${STRING:$i:1}' becomes '$(echo "${STRING:$i:1}" | sed 'y/aAqQwWzZ,?;.:mM/qQaAzZwWmM,<.;:/' | sed "y/ù'/'4/" | sed 'y/!\//\/>/' | sed 'y/&é"(-è_çà)°1234567890^¨$£\*µ%§/123567890-_!@#$%^&*()[{]}\\|"?/')' on flirc's US virtual keyboard"         # escaping '\' to '\\' is necessary so '\*' becomes '\\'
        
    done
    
elif [ "$1" == "-k" ] || [ "$1" == "--keys" ]; then                            # argument passed to the script is 'keys'
    $FLIRC_UTIL_FILE keys | grep -v '\-\-\-' | grep -v "key" | awk '{print $3}' | sed '/^[[:space:]]*$/d' | while read line
    do
        size=${#line}
        [[ $size -gt 1 ]] && continue
        LINE="$(echo "$line" | sed 'y/aAqQwWzZ,?;.:mM/qQaAzZwWmM,<.;:/' | sed "y/ù'/'4/" | sed 'y/!\//\/>/' | sed 'y/&é"(-è_çà)°1234567890^¨$£\*µ%§/123567890-_!@#$%^&*()[{]}\\|"?/')"         # escaping '\' to '\\' is necessary so '\*' becomes '\\'
        [[ "$line" == "$LINE" ]] && continue

        echo "'$line' becomes '$LINE' on flirc's US virtual keyboard"

    done
elif [ "$1" == "help" ] || [ "$1" == "--help" ] || [ "$1" == "-h" ]; then
    usage 

else
    echo "Invalid argument"
    usage

fi

I use it to know what to type on Flirc's US Full Keyboard controller

 

flirc_key_converter
String to convert: azerty*,;:!
'a' becomes 'q' on flirc's US virtual keyboard
'z' becomes 'w' on flirc's US virtual keyboard
'e' becomes 'e' on flirc's US virtual keyboard
'r' becomes 'r' on flirc's US virtual keyboard
't' becomes 't' on flirc's US virtual keyboard
'y' becomes 'y' on flirc's US virtual keyboard
'*' becomes '\' on flirc's US virtual keyboard
',' becomes 'm' on flirc's US virtual keyboard
';' becomes ',' on flirc's US virtual keyboard
':' becomes '.' on flirc's US virtual keyboard
'!' becomes '/' on flirc's US virtual keyboard

 

Feel free to use it

Link to comment
Share on other sites

  • 1 month later...

To get the right decimal HID value from your keyboard to use in record_api command, you can use this in a shell command as well:

su -c "while true; do od --read-bytes=144 --width=144 -d /dev/input/event3 | awk 'NF > 1 { print \$12 }'; done"

On another note, I think it is a huuuuge hassle to do all this just to get my Flirc use the "-" key instead of the "ß". :-/

Link to comment
Share on other sites

To get the right decimal HID value from your keyboard to use in record_api command, you can use this in a shell command as well:

su -c "while true; do od --read-bytes=144 --width=144 -d /dev/input/event3 | awk 'NF > 1 { print \$12 }'; done"

On another note, I think it is a huuuuge hassle to do all this just to get my Flirc use the "-" key instead of the "ß". :-/

 

As I've mentioned in my post you can use the Flirc GUI app if you want. All you need to remember is to not to look at key labels in the GUI but the key position itself and match it to the hardware keyboard layout. So if you need to use Shift to get "1" then you need to select shift and 1 in the GUI etc. Just check what you need to press on your hardware keyboard and use the same key position and combination in the GUI.

  • Like 1
Link to comment
Share on other sites

Ahhhhhh thanks, I finally got what you mean. ;-) I now looked at my hardware keayboard where the key is that I want to program and then push that button at the same position on the GUI.

Ok, seems I could have saved some time, if I understood earlier how to trick the program to do what I want. But at least I am capable of reading HID codes, using flirc_util commands and some other stuff now. All on the first day using Flirc. :-D

 

Still hoping for a better layout handling in the future though.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...