The Problem: The Volume Up and Volume Down Keys of my Headset; Xiaomi Earphone Mi Hybrid Pro HD 2, did not work on my Redmi 5 Plus build.
Using KeyTest App, I identified that the keys were not mapped to any function.
How to fix;
In /system/usr/keylayout/Generic.kl
Change:
key 257 BUTTON_2
key 258 BUTTON_3
To
#key 257 BUTTON_2
#key 258 BUTTON_3
key 257 VOLUME_UP
key 258 VOLUME_DOWN
Save and reboot.
Should work here after.