[KERNEL] My kernel patches

Adam77Root

Inactive Recognized Developer
Jul 3, 2012
2,535
11,160
0
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'):
Code:
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):
Code:
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! :)
 

Attachments

Last edited:

khpatel4991

Senior Member
Jan 16, 2012
414
101
73
New Brunswick
I'm on Frankenstein ROM 4.0.2 and ardatdat 4.2b4 right now, is it safe to flash your kernel plus bln mod directly,and do I need to mount/system before flashing and clear cache and dalvik cache after???

Sent from my GT-I9103 using Tapatalk 2
 

Adam77Root

Inactive Recognized Developer
Jul 3, 2012
2,535
11,160
0
I'm on Frankenstein ROM 4.0.2 and ardatdat 4.2b4 right now, is it safe to flash your kernel plus bln mod directly,and do I need to mount/system before flashing and clear cache and dalvik cache after???

Sent from my GT-I9103 using Tapatalk 2
I'm on that rom too. It is safe.

Sent from my GT-I9103
 
  • Like
Reactions: khpatel4991

khpatel4991

Senior Member
Jan 16, 2012
414
101
73
New Brunswick
I flashed the kernel,wiped cache and dalvik cache, downloaded bln mod pro but not able to understand the patch part,can you explain the procedure in detail,about how to apply the patch

Sent from my GT-I9103 using Tapatalk 2
 

Adam77Root

Inactive Recognized Developer
Jul 3, 2012
2,535
11,160
0
I flashed the kernel,wiped cache and dalvik cache, downloaded bln mod pro but not able to understand the patch part,can you explain the procedure in detail,about how to apply the patch

Sent from my GT-I9103 using Tapatalk 2
You don't have to patch anything. That part id for kernel devs. My kernel already contains it.

Sent from my GT-I9103
 
  • Like
Reactions: khpatel4991

'cooleagle'

Retired Forum Moderator
Jan 19, 2012
1,919
1,148
0
This is awesome bud ! :)

I'm yet to try cause I have to use NTFS pen drives during the next few days, will flash it after that. I had a small request if possible look into it.

I was going through dev sicopat's threads & I found that he had enabled BLN for the stock SMS app by modding it. The link to the MOD is currently down as it was uploaded on multiupload which had shut down for some time. But I'm searching for an alternate link, will notify you if I find one.

Here's the link to the ROM's thread: http://forum.xda-developers.com/showthread.php?t=1164516 (Check Post no. 2, Updates: v3.0).

If possible can you MOD the stock ICS SMS, stock ICS Samsung Email app(not Gmail) / Social Hub for enabling BLN in them ? As per Sicopat's thread as of now this can't be enabled even if we download the BLN Control Pro app & we've to use 3rd party apps. Maybe you can get in touch with him to enable the same.

Hope it'll be possible for you to do so. Cheers ! :)
 
Last edited:

pudup

Senior Member
Feb 18, 2012
793
132
73
How do I use this with ardatdat kernel? Or do I have to use yours or wait for ardatdat to implement it?

"I like spelling my name backwards"
 

mhca

Senior Member
Jun 21, 2011
58
4
0
First of all thanks Adam. This is a long awaited MOD; I have been missing notification LEDs since my change from HTC to SGR.

I have installed your zip through CWM, wiped cache and dalvik cache and bought BLN control app.
The test looks fine, but I have yet to get it to work with an SMS application. I still just use the stock application which doesn't give LED notification.


But I experienced an issue with the modded kernel related to touch. It however disappeared after having the screen off for a few minutes.
When I held icons and try to move them to another position, it lost my touch after 1-1½ second. Similarly I couldn't flick halfway to a new page and hold it there for more than 1½ second.

I'll give an update if it comes back, but this is the first time I have experienced such an issue, and therefore I expected it to be related to this modification.

BR, MHCA
 

Adam77Root

Inactive Recognized Developer
Jul 3, 2012
2,535
11,160
0
But I experienced an issue with the modded kernel related to touch. It however disappeared after having the screen off for a few minutes.
When I held icons and try to move them to another position, it lost my touch after 1-1½ second. Similarly I couldn't flick halfway to a new page and hold it there for more than 1½ second.
Hm, I haven't experenced such problem yet. Pls update me on this when it happens one more time and I'll investigate on it.

Sent from my GT-I9103
 

mhca

Senior Member
Jun 21, 2011
58
4
0
Hm, I haven't experenced such problem yet. Pls update me on this when it happens one more time and I'll investigate on it.

Sent from my GT-I9103
I just experienced issues again. It is quite annoying when trying to hold down a key on the keyboard to type a number instead of a letter. Failed multiple times.
I then tried holding home screen icons and most of the times it just opened the application as if I had clicked them.

I don't know how you will be able to investigate it, such things can probably be hard to replicate.