View Single Post
Old 06-06-2022, 07:46 PM   #2
Renate
Onyx-maniac
Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.Renate ought to be getting tired of karma fortunes by now.
 
Posts: 3,960
Karma: 17500001
Join Date: Feb 2012
Device: Nook NST, Glow2, 3, 4, '21, Kobo Aura2, Poke3, Poke5, Go6
You got me scratching my head. Since Android is (basically) Linux you can do this the Linux way. That's the way I've always done it. Then I realized that there is the Android Setting with selecting keyboard layout. I can only presume that that's done after the Linux system has already mapped things around. Gee, that makes things complicated. The attached drawing shows how it works without the Android Settings. The Android Settings is yet another layer!

I tried the Android Settings under System/Languages/Physical Keyboard and it works.

In the Linux world we have key layout files (*.kl) and key chararacter maps (*.kcm). For Android we also have input device configuration files (*.idc). These are all found in /system/usr/keylayout, /system/usr/keychars and /system/usr/idc (respectivelly). To make your own files your device will need to be rooted or Magisk-ed.

Whether you are using a wired USB keyboard or a Bluetooth keyboard really doesn't make a difference. USB was/is the standard and Bluetooth pretends that it is (kind of) a USB keyboard. Both are identified by a vendor ID (VID) and a product ID (PID).

So here's my Vendor_05ac_Product_0220.idc file:
Code:
# Configuration for Russian Bluetooth keyboard 05ac/0220

device.internal = 0

keyboard.layout = Generic
keyboard.characterMap = Russian
Since the keyboard is basically a standard English keyboard with funny things written on the keytops, the layout that I need to use is the standard one. OTOH, A "J" key has to generate a Russian "O" character (not a simple 006f for an Latin O, but a 043e for a Russian O).
Here is a part of my Russian.kcm:
Code:
key J {
    label:                              'J'
    base:                               '\u043e'
    shift, capslock:                    '\u041e'
}
Ok, this all seems like a lot of work, but you can probably find a Persian .kcm file easily. It also has the advantage that you can further customize. Let's say you often intermix Persian and French. You can set Alt-C to give you a c with cedilla (the squiggly tail).

So, in short, to answer your actual question. You can definitely do this the Linux way (if you're rooted/Magisk-ed). If the Android Settings lets you set the keyboard to Japanese and Russian but not Persian then the Settings is not going to help you. It might just be a case of different Perisan keyboards.

I just learned that you can write an app for injecting your own key character maps. For the real dirt on that, see: https://developer.android.com/refere...YBOARD_LAYOUTS

Since I'm already rooted and customized I'll stick with my method.
Attached Thumbnails
Click image for larger version

Name:	keyboard.png
Views:	427
Size:	9.1 KB
ID:	194165  
Renate is offline   Reply With Quote