[MODULE] Magisk Custom Keylayout - Magisk

Magisk Custom Keylayout
Searches /sdcard and /external_sd for *.kl files and place them to /system/usr/keylayout, systemless-ly ;p
It doesnt do any checking of the keylayout, besides that it exists, so be careful of adding/replacing a broken keylayout.
Why?
Quickly add (a) keylayout file(s) without permanently modifying your /system .
XDA:DevDB Information
Custom Keylayout Systemless-ly, Tool/Utility for all devices (see above for details)
Version Information
Status: Stable
Created 2018-09-11
Last Updated 2018-09-11

Not sure if this is the correct place, or the Magisk forum would be more appropriate. Mods can ya confirm?

iddeen said:
Magisk Custom Keylayout
Click to expand...
Click to collapse
Hi, is this the right place to ask questions? I'm surprised there are no other posts here so far.
I have a Nvidia Shield Tv and there is a Logitech Harmony Smart Keyboard connected to it via bluetooth.
By default there is some QWERTY uk or us layout used but I'd need German QWERTZ layout.
So in system -> keyboard there is a setting called "physical keyboard", selecting it I can choose different layouts, also German.... which is great...but unfortunately the Shield somehow looses this setting upon reboot, sometimes also upon a ui crash and everything is reverted back to default QWERTY.
Now this obviously is an issue on Nvidia's side but I won't hold my breath until they fix it, so I looked into changing the default layout.
My knowledge here is very limited so maybe you can help:
I guess the default layout ist the Generic one. Could I also change the generic one with your module?
I found out that in /system/usr/keylayout there is the file Generic.kl.
However in /system/usr/keychars there are also files like Generic.kcm.
Now I'm confused which one I'd need to replace so the layout on my bt keyboard will change.
Do you know the difference of both files, locations?
Also, how does your module work? Just place a .kl file somewhere in sdcard root and reboot?

Related

[Help] Trying to make module, getting stuck at bootloop

I'm trying to make a module that tricks the Nexus 6 to thinking it's a Pixel for the unlimited, original quality photo backup. Not really experienced in doing this stuff and not sure what I'm doing wrong. When I flash this, it won't boot.
The Disclaimer for anyone trying this: This will likely ONLY work on Nexus 6. The XML system file is named differently on the 6p and 5x and the rest of the xml code here might be different, breaking other features.
In a nutshell, what this is supposed to do is replace /system/etc/sysconfig/google.xml with a modified xml file. I was considering looking up how to simply add the code to the xml file, but not sure how you'd target a location to inject the code to in the file. There's an opening and closing tag it needs to sit between. But if this can be done, it would probably expand support to more devices than just the Nexus 6.
EDIT: I found a typo in my module. This was the problem
Have you made sure you're using the correct encoding and line endings, and that it doesn't need any other permissions than those set by the module? Also, have you made sure that there are no other files that also need changing so there'll be conflict if you don't change them all?
In theory, you should be able to use a script (in post-fs-data.sh maybe?) to copy (cp command) the original file into your module folder and then use more scripting to edit/replace/prepend/append (sed, echo, and so on) the lines you want. I've never tried it myself or seen anyone do it though, that's why I'm saying "in theory".
Didgeridoohan said:
Have you made sure you're using the correct encoding and line endings, and that it doesn't need any other permissions than those set by the module? Also, have you made sure that there are no other files that also need changing so there'll be conflict if you don't change them all?
In theory, you should be able to use a script (in post-fs-data.sh maybe?) to copy (cp command) the original file into your module folder and then use more scripting to edit/replace/prepend/append (sed, echo, and so on) the lines you want. I've never tried it myself or seen anyone do it though, that's why I'm saying "in theory".
Click to expand...
Click to collapse
Thanks for the suggestion. I am a visually creative person. My extent of programming is HTML and CSS. So this is a quite the learning experience for me. Plus statistically, learning a language (and programming is similar to language) is more difficult for people as they get older... I'm not that old, but I'm not young either lol.
I'm not sure what you mean about encoding. I mean, I understand what encoding is, but not how to check it or verify what it should be.
If it helps, directly replacing the file in System by itself (not using Magisk) does work and make the necessary changes/affect. So I am assuming no other files are necessary to be modified or replaced. In fact, the XML doesn't reference any other outside files that I've noticed. I thought simply replacing it through Magisk would work as well. I haven't tried specifying permissions, but I can try that next.
Glad it worked. Typos can be a pain in the ass!
Now on to making it device independent...

[KEYLAYOUT] Localized Keylayouts ported from Photon Q (QWERTZ/QWERTY)

I've just decided to publish the keylayout which i have ported from photon q.
(Source) (Original Source)
You don't have to replace any system files as it comes as apk wich installs additional keylayouts to choose in settings.
I attached a image of the generic qwertz (german) layout but it also contains qwerty and special Croatian and Czech layouts.
(external download mirror)
If you have any problems while installing on Lineage 13 or 14 see post #4
Have Fun ^-^
Awesome, but unfortunately it seems to be targeted only at 11.0 does not work on my device that runs LineageOS 13.0
I am not getting an error message just "not installed". Would it be possible to install it on or update it for 13 or 14?
t--b said:
Awesome, but unfortunately it seems to be targeted only at 11.0 does not work on my device that runs LineageOS 13.0
I am not getting an error message just "not installed". Would it be possible to install it on or update it for 13 or 14?
Click to expand...
Click to collapse
Hmm, for me it installs and works fine on 13.0 and 14.1...
Maybe your download was corrupted?
Otherwise you could try to put the APK in /system/app or extract the APK and manually replace layout files..
Hummtaro said:
Otherwise you could try to put the APK in /system/app
Click to expand...
Click to collapse
I have put the apk in a created folder with the same name as the apk in /system/app/ (-> /system/app/MaseratiKeypad) and aligned the permissions with the already existing apps in /system/app. Rebooted and indeed the Maserati Keyboards can be selected now.
Had some fun with Emacs in full screen and the alt/ctrl key are working with sym/ok as I already tried a while ago but failed. After several attempts I gave up.
Thanks a lot for sharing the app and helping me further.
Is it possible to add my own keyboard layout (link) to the application?
It looks like it is not possible to change the hardware keyboard layout on LineageOS 14.1 by just swapping files in /system/usr/key*/omap4-keypad.k*.
EDIT: Found a way.
Some clues.
In case you would like to add your own keyboard layout you would have to:
change in your kcm file "type ALPHA" line (if exists) to "type OVERLAY";
if you have also the kl file you need to add related changes to the kcm file like for example:
line in .kl file
Code:
key 222 ALT_LEFT WAKE_DROPPED
to line in .kcm file
Code:
map key 222 ALT_LEFT
put your kcm file in the res/raw directory;
add an entry about your kcm file to xml/keyboard_layouts.xml.
Not working on Unihertz Titan. Android 9.
diejuse said:
Not working on Unihertz Titan. Android 9.
Click to expand...
Click to collapse
This is normal because the application (or rather - the built-in key layout) utilizes key identifiers which are tied to a phone's hardware - in this particular case - Photon Q's hardware.
In order to make it work on Unihertz Titan you would have to make a key layout modification based on Titan's kcm and kl files, not the Photon Q's.

Magisk Module development help

This is my first attempt at a Magisk Module (to fix a issue with a few poorly coded legacy apps and not trip safety net) inject or replace a font and set proper permission on the file
My super simple experiment is here (based on the template from Git)
https://drive.google.com/file/d/1PHdRjzefpSMg51KUOffo4FtqlfoxshOM
Magisk gives me a error when I try to install
I probably did something wrong, hopefully someone can point me in the correct direction (error one, not a valid Magisk Module, error two Magisk is not activated)
I appreciate any insight - please move this post to the correct location if needed
If you want someone to look at the module you'll have to enable sharing for the file first...
But, your errors are usually:
1 - the zip has been packaged wrongly (not the proper file/directory structure
2 - using an old template
Take a look in the official docs on how to work with the current module and module installation setup:
https://topjohnwu.github.io/Magisk/guides.html
Let's try this link:
https://drive.google.com/file/d/1PHdRjzefpSMg51KUOffo4FtqlfoxshOM/view?usp=sharing
I started on Git, but I may have inadvertently been in the wrong place / pulled the wrong file -- I will go back through that link you provided tomorrow and see if something jumps out at me
Yeah, you have a whole host of mixed issues there...
First, all the module files have to be in the root of the module zip, not in the magisk-module-DroidSansFallback you have them in now (this is the "not a Magisk module").
Second, your update-binary is a webpage... That ain't gonna work very well. When you download the module_installer.sh script, save it from the raw view (there's a button above the code when you open the file on GitHub).
Last (but this is only cosmetical really, since it won't affect anything) you found some really old module to base your work on, because the config.sh file hasn't been used for ages, and the readme file is ancient.
Fix the above and follow the instructions in the docs and you should be good to go.
Is there a current template on Git for the blank files?
I am here:
https://topjohnwu.github.io/Magisk/guides.html
Made the updates, going to try it now - but I would like to get a proper template setup
There is no longer an official template provided.
The current module installation setup is so simple that it really doesn't need it. Put whatever files you want to mount in /system, whatever boot script or prop files (as described in the docs) you want to run in the root of the zip, create the module.prop (again, described in the docs) so that you'll have some info about the module in the Manager, zip it up and flash it.
If you want to customise things more you do that with the customize.sh script (described in the docs).
If you really need a template there's always @Zackptg5's MMT-Ext...
So I downloaded a current module and looked through the files / structure and then the docs -- and now I have this
https://drive.google.com/file/d/1z4tlH6wGDpq0UnkxPF0f6i-DohcKnux-/view?usp=sharing
When I go to /system/fonts I now see DroidSansFallback.ttf (it was not present before installing the module)
and no error messages!!
I think I need to read a little more, on Android 5-8 adding this font into /system/fonts (manually) fixed my problem - now I am on Android 9 (OnePlus 6t TMO variant) and I do not see any changes from adding the file (fonts.xml issue?)
I really wanted to try this as a learning experience, and because the old method trips CTSProfile to false
I appreciate your patience - at least now I have a better starting point
All you need for the font file to be mounted is the /system/fonts/DroidSansFallback.ttf file in the module society directory. The REPLACE variable you've set in customize.sh is only for replacing directories with empty ones, not files (so you can remove it since it might be causing a conflict). Details in the docs:
https://topjohnwu.github.io/Magisk/guides.html#remove-folders
updated (linked file updated as well) no change.. .. ..
I did double check that the module places the file in the correct location, and when the module is disabled the file is removed
I found this on a random Google search (ASE) from a unrelated topic (Chinese character support)
On Android 9 it's Noto CJK, e. g. "Noto Sans CJK JP" font family (located in /system/fonts/NotoSansCJK-Regular.ttc). There is no DroidSansFallback.ttf anymore.
Could that explain why adding the file did not work?
Very possible. As you say, the module looks fine and works as intended (places the file where you want it), so the issue likely lies elsewhere.
I will take a stab at injecting a modified fonts.xml and see if that changes anything - thanks!
I experimented with adding a line into the fallback section of the fonts.xml (to reference the new font), and replacing the fonts.xml with a older version from Android 8 --- neither had any effect that I could discern

Question Moto Edge 20 - any rom options to fix the Google assistant button? (CS are unhelpful)

Hello.
I want to know if there's any rom I can try that fixes the problem of having the left side hardware button hardcoded to the useless Google assistant.
I'm apparently not alone with this issue but customer service has proven useless, only claiming "the button was not designed to be user configurable" and writing it of as "it a feature, not a bug"
Any pointers would be really helpful.
Hey. This can be done with root.
[Magisk] [Module] Remap Assistant Button
Hey everyone, this is just a super simple Magisk module, but could be useful to someone else if you don't want to make it yourself: it just replaces the GPIO key layout file in order to remap the assistant button to the Camera button. There's...
forum.xda-developers.com
You can edit this module, but make sure to do it while it's zipped (extract the file you want to edit onto the desktop, edit it and then replace the file inside the .zip folder, but DO NOT extract the zip folder itself). In system/usr/keylayout you can edit Key 217 to whatever you like from sites that list key names (such as https://archive.paragonwiki.com/wiki/List_of_Key_Names). Edit the customitze.sh device name from "nio" to "berlin". Then transfer the file to your device and flash in Magisk.
I personally changed the Key 217 to SYSRQ so that it become a screenshot key, however you can change it to whatever you like.
Thanks a lot, I will give it a shot
TheExileFox said:
Thanks a lot, I will give it a shot
Click to expand...
Click to collapse
Did it work for you?

[REQUEST] Module to replace a file in vendor/etc

I have an LG V60 phone and I would like to put the phone in "high impedance mode" all the the time for more power to the earphones even if they are less than 50 ohm impedance.
In LG V40/50, it was very simple by rooting the phone and making some modifications in the one of the files that was in the "vendor/etc" directory. The problem with LG V60 is it does not allow any write access to the vendor folder at all.
So the only feasible option that I can think of is to create a Magisk module that replaces the original file with the modified one. My biggest disadvantage is not knowing anything about writing codes including Magisk module ones. So I was wondering if anyone could create a Magisk module that would replace the original file through Magisk?
ADDTIONAL INOFRMATION:
I am running Magisk 25 on a fully rooted LG V60.
The file that needs to be changed is mixer_paths.xml and it resides in the "vendor/etc" folder. I have created the modified file.
So if someone is able to develop a module to accomplish this, I will place the modified file in the "system/vendor/etc" folder of the Magisk module, as I understand it.
Many thanks for your support!
You can use this template system in future as its super easy
The template itself is here
GitHub - Zackptg5/MMT-Extended: Magisk Module Template Extended
Magisk Module Template Extended. Contribute to Zackptg5/MMT-Extended development by creating an account on GitHub.
github.com
click the Code button, then download zip
then extract the zip into a folder and rename the folder "MMT-Extended-master" to the something more meaningful, like the name of your module
Read the wiki and docs here to go step by step to create your first module:
Home
Magisk Module Template Extended. Contribute to Zackptg5/MMT-Extended development by creating an account on GitHub.
github.com
Notably the heading:
How do I make a MMT Extended mod?​
The steps for a simple file addition/replacement module, which are simple, should be steps 1-4, then 8. Then zip up the modules (as a zip) and test.
For you, if you read along (in Step 3) you will need to create a folder vendor, under the existing system one, and then a further etc folder under vendor, and put the necessary file (mixer_paths.xml in there.
If you try and fail, post back and someone will assist. But we prefer people to at least read the documentation and try first, ideally...this is the way the great didgeridoohan mentored myself and many others, he was not big on spoonfeeding
Imagine the satisfaction you might get finding out youre capable of such feats...i promise its not rocket surgery
Feel free to PM even, if you get stuck and think you have a silly question - of course knowing me, and i do, you'll probably get an even sillier, and off topic answer as well...
hint: you can knock out this basic module in far far less time than it took me to write all this
Thank you!
So my changes look like this:
1. Put the modified file in the system/vendor/etc folder of the Magisk module.
2. Made the needed changes to the customize.sh as attached.
Royaltiger said:
Thank you!
So my changes look like this:
1. Put the modified file in the system/vendor/etc folder of the Magisk module.
2. Made the needed changes to the customize.sh as attached.
Click to expand...
Click to collapse
Yes, though you'll need to uncomment (remove the leading #) from the set_perm lines to make them active, also you only really need the 2nd one
Royaltiger said:
Thank you
73sydney said:
Yes, though you'll need to uncomment (remove the leading #) from the set_perm lines to make them active, also you only really need the 2nd one
Click to expand...
Click to collapse
Click to expand...
Click to collapse
So I made the module with the suggested changes in customize.sh and put the modified mixer_path.xml file in the system/vendor/etc folder of the module. Module installs fine with Magisk but when it reboots, the device hangs on the initial LG screen and does not go anywhere from there.
I am attaching the customize.sh snapshot. Also, attached is the module file.
See here under "Disabling/uninstalling modules manually" if youre not able to boot
Module Issues:Magisk and MagiskHide Installation and Troubleshooting guide
www.didgeridoohan.com
I am assuming that it is not possible to accomplish what I wanted to achieve.
Royaltiger said:
I am assuming that it is not possible to accomplish what I wanted to achieve.
Click to expand...
Click to collapse
mixer_paths files have been replaced for years, long before magisk even...i did it back as far as the Galaxy S2 from memory, so im not sure why this didnt work for you, was the mxer_paths file specifically for your device? i have no clear idea why it hasnt worked for you
this thread has a guide to making /system RW, so you could manually copy the file and overwrite it, but id really consider how much you want to replace mixer_paths before i set out to do that
V60 Bootloader Unlock and Magisk Root
Earlier today I was alerted to https://www.cnblogs.com/yanhua-tj/p/15525593.html which has the actual firehose and steps to unlock! However it seems to be in Simplified Chinese so I'll translate it here for you. The firehose is attached below...
forum.xda-developers.com
73sydney said:
mixer_paths files have been replaced for years, long before magisk even...i did it back as far as the Galaxy S2 from memory, so im not sure why this didnt work for you, was the mxer_paths file specifically for your device? i have no clear idea why it hasnt worked for you
this thread has a guide to making /system RW, so you could manually copy the file and overwrite it, but id really consider how much you want to replace mixer_paths before i set out to do that
V60 Bootloader Unlock and Magisk Root
Earlier today I was alerted to https://www.cnblogs.com/yanhua-tj/p/15525593.html which has the actual firehose and steps to unlock! However it seems to be in Simplified Chinese so I'll translate it here for you. The firehose is attached below...
forum.xda-developers.com
Click to expand...
Click to collapse
Actually I had no problem in editing the mixer_tavil.xml file in LG V40/50. But when it comes to LG V60, the file is read-only. There is no way to edit it due to dynamic partition. Hence, I was seeking the only option available i.e., via Magisk module.
Royaltiger said:
Actually I had no problem in editing the mixer_tavil.xml file in LG V40/50. But when it comes to LG V60, the file is read-only. There is no way to edit it due to dynamic partition. Hence, I was seeking the only option available i.e., via Magisk module.
Click to expand...
Click to collapse
So, I encountered the same problem and found what you did wrong. I was able to write my own Magisk module and it works wonderfully. It took so much time to understand how to do it because there is no proper tutorial.
If you are still active and trying to know how to do it the right way, here comes the explanation:
The Replace = " /system/vendor/etc/ " must not be written as it completely wipes the actual folder from your phone. This is why you were not able to turn the phone on. It should be like this:
Replace = " " (That part must be blank)
The rest of the code is good. If you try it like this now, you will see it will work, just like mine did.
Cheers
Does not work. May I see your module? Please upload it here as attachment.
I even put my edited file under /data/adb/modules/<my directory>/system/vendor/etc. It shows up in Magisk as a module and the file loads (as it is not visible in file explorer) but there is no change in volume. So the thing is not working.

Categories

Resources