[Samsung Galaxy R i9103] Adam77Root:
Hi everybody!

This thread is dedicated to containing all the kernel (and some other kernel-related) patches I create/port for our device. So I think it could help our kernel developers to focus on actual SGR-related work without worrying about examining and implementing everything that already have been created for other devices from scratch. I'll update this thread with all information whenever I do something related to the goal. I plan to make this a huge thread so please help us to keep it organized and ask common questions in the Q&A thread (in General section) or in PM (if nobody can answer your question). Thanks in advance!

BLN mod

What is BLN?

- Refer this article for more information.

What do I need to try it out on my device?

- Download my CWM-flashable zip from the following link (This installs my kernel plus my modified liblights (of course it makes a backup of the original one first)):

http://www.mediafire.com/?1cnua9uw3ckoiqk

What features does this kernel have?

version 3.1.10 (for ICS stock firmwares)

eMMC_ERASE_CAP disabled (totally safe to use)

it includes AOSP vibrator fix (it works with my pre-alpha CM10 build too) -> Hybrid kernel

Wi-Fi MAC address changing implemented

Keychord support enabled (start services using hardware keys -> revert to original MAC address by pushing 'volume down', 'volume up' and 'power' buttons simultaneously)

BLN support

- Download 'BLN Control - Free' or 'BLN Control - Pro' app from the Play Store. The pro version has some really nice additional features all of which are supported in my mod.

What do I need to enable it in my kernel?

- Apply my attached patch ('bln.patch') in your kernel source dir with 'patch -p1 < bln.patch'. This patch includes the BLN mod port from SiyahKernel3 (SGSII kernel). I removed its wakelock and earlysuspend dependency, our touchscreen driver has a different structure from that of SGSII touchscreen driver and it works without those quite well. I also added some cleanups regarding the original key led sysfs entries.

- Find 'Device Drivers->Input device support->Touchscreens->Atmel MXT224E Touchscreen Interface' in menuconfig and enable 'BLN Support' under it.

What do I need to enable it in my rom?

- Use a kernel that supports BLN.

- Extract 'system/lib/hw/lights.n1.so' from the CWM-flashable zip (in the link I previously attached) and put it into the appropriate folder.

- Optionally include BLN Control app.

Why do I need a special liblights?

- The original liblights doesn't support notifications since we don't have a led for that purpose. Epsylon3 uploaded the open source version of liblights he uses for CM7.2 to his GitHub. However, that unfortunately doesn't support stock Samsung roms (Button backlight doesn't work.), so I had to hack it a little to make it work. By default, the stock rom can set the brightness of the button backlight according to light conditions. I tried several options but didn't notice any difference in brightness, so my modified version returns 255 (0xFF) as brightness whenever it's set to some non-zero value (zero means turning it off). I also added support for BLN through the common Android notification way.

I uploaded its sources to GitHub:

https://github.com/Adam77Root/liblights_bln

Keychord support

What is it?

- If it is enabled in the kernel, init can start services triggered by hardware keys.

Why should I use it?

- I made a simple yet quite reasonable use of it. I created a service in my init.rc, which runs a script ('/system/xbin/resetmac.sh') that turns Wi-Fi off and resets the original MAC address by writing an invalid one ('13:37:13:37:13:37') into the '/efs/wifi/.mac.info' file. This runs whenever I push 'volume down' (114), 'volume up' (115) and 'power' (116) buttons simultaneously. (I had to disable bugmailer first.) You can find keycodes in '/system/usr/Generic.kl'.

- Example code ('init.rc'):

service resetmac /system/bin/sh /system/xbin/resetmac.sh
class main
disabled
oneshot
keycodes 114 115 116

- Example code ('/system/xbin/resetmac.sh') (chmod it to 700):

svc wifi disable
echo 13:37:13:37:13:37 > /efs/wifi/.mac.info

What do I need to enable it in my kernel?

- Simply enable 'Device Drivers->Input device support->Miscellaneous devices->Key chord input driver support' in menuconfig.

- Of course it has advantages only if you enable something in your init files too.

Wi-Fi MAC address changing

Please refer my previous thread for more information and on how to use/implement it.

Every custom modification to devices have risks. Use these at your own risk!

Have fun and enjoy! :)