yashsingh1/xdaforums huggingface dataset:
[Galaxy S I9000 Android Development] Necromancer3:
Startosk i think i found the problem with the Auto-Brightness adjustment i have.

you cap the user input lux at 3000, the kernel max lux, which means i can't have a lower brightness increase rate then 1:1 (current lux / max lux).

the formula you are using is roughly

( current_lux / max_lux ) * max_brightness

so to get a lower increase rate i set the max_brightness lower, but then when i get out into a into a high brightness environment i cant reach the max brightness.

a more steep increase in brightness (lux < 3000) looks like this

the most slow/moderate increase is with lux = 3000 = max_lux

with lower increase in brightness (with brightness < 255 or lux > 3000 = max_lux) we get this

as you see, when the kernel receives max_lux value, the brightness is not max_brightness. we cannot achieve max_brightness with lower increase in brightness.

a solution i thought of is allowing a lux higher then the System/kernel Max lux to moderate the incline and add

a lux "threshold" that would increase the brightness rapidly to get to the max_brightness under max_lux

that would look like this

here is the basic form

SYS_MAX_Brightness = 255

SYS_MAX_LUX = 3000

CURRENT_LUX =

//get user values

user_lux = // allowed to be higher then 3000

user_threshold =

user_min_brightness =

user_max_brightness =

// the end/return value

brightness

if user_lux > SYS_MAX_LUX and CURRENT_LUX > user_threshold then

-- factor = (1 - (user_threshold/lux))*(SYS_MAX_LUX - user_threshold)

-- brightness = (user_threshold/user_lux)*SYS_MAX_Brightness + (CURRENT_LUX - user_threshold)*factor

---if brightness > user_max_brightness then

----- brightness = user_max_brightness

---end

else

-- brightness = (CURRENT_LUX / user_lux )*user_max_brightness

end

if brightness > user_max_brightness then

-- brightness = user_max_brightness

end

if brightness < user_min_brightness then

-- brightness = user_min_brightness

end

return brightness

you can also add a "trigger" that will use full brightness if a certain lux amount is reached.

it will look like this

the trigger is independent of the threshold, for example

if CURRENT_LUX > trigger then

-- brightness = SYS_MAX_Brightness

end
[Galaxy S I9000 Android Development] superkoal:
Depends on how you define free ram.

I think the one shown in system settings is quite ok for comparison.
[Galaxy S I9000 Android Development] stratosk:
Hi,

Thanks for you analysis. I will further check your data.

But first I would like to mention 2 points:

1) The max lux according to my measurements is 3000. I never get more that 3000 (in the kernel) from the sensor.

2) You can not set the max_lux value (I mean the value that is used to normalize the current lux) greater than 3000.

So, you will never get the above graph. As user you can cap the max brightness.

You can also set that max_lux value to a lower value than 3000. With this you can achieve a steeper increase in brightness with lower values from sensor.

Do you agree so far?

Also for your convenience you may see the code:

https://github.com/stratosk/samsung-kernel-aries/blob/jb-4.2.1/drivers/video/samsung/sema_autobr.c
[Galaxy S I9000 Android Development] Necromancer3:
1) yes i understand that you can't get a higher value then 3000 in the kernel.

2) right now it is impossible to set the max_lux greater then 3000, but if you would allow to set a "lux" value (not the system max_value) to use instead you could get this graph.

with the formula of

(current_lux / max_lux) * max_brightness

setting the max_brightness to lower value also decreases the steepness of the brightness increase just as a max_lux > 3000 would.

so this graph is possible, but the problem with it, as i stated, that when you go out to full sun and you need full brightness, you won't get it.

currently you can only get a steeper increase in brightness, but i want lower increase in brightness, even lower then with max_lux 3000.

with lower brightness and lower increase the battery will last longer, but as i go out the brightness is capped, doesn't reach the max_brightness of 255 and i can't see anything.

thats the problem: allowing a more moderate increase in brightness while still reaching the maximum brightness (of 255). what makes it problematic is that you don't get lux higher then 3000 and thats why i suggest using a threshold divider, low increase under certain conditions, and steeper increase under other conditions to reach the max brightness.

i forgot to add some explanations:

SYS_MAX_Brightness = 255 // system/kernel max brightness

SYS_MAX_LUX = 3000 // system/kernel max lux value

CURRENT_LUX = // current lux recorded by the sensor

//get user values

user_lux = // allowed to be higher then 3000 - to have a more moderate increase in brightness and saving power. a possible range is 1-9000 (3 times lower then the current slowest incline)

user_threshold = // range: 1-3000, before the threshold brightness will increase slowly, after the threshold it will steeply go to full brightness. default: 3000 [off].

user_min_brightness = 255 // cap the max brightness. range: 1-255 default: 255 [off]

user_max_brightness = 1 // cap the min brightness. range: 1-255 default: 1 [off]

user_brightness_jump = 3000 // (mentioned it in the bottom of the comment) when the sensor reports that much lux, the brightness is set to full regardless of incline slope/graph. default 3000 [off]
[Galaxy S I9000 Android Development] stratosk:
OK, so we are talking about an enhancement in code. Not for a malfunction. Correct?

I will check your proposal and I will think about it.

If you are familiar with C, you may make your enhancement against my code. I can build it for you to test it.

I think that maybe we can use a 2nd degree polynomial for better results. What do you think?
[Galaxy S I9000 Android Development] Necromancer3:
here is an example. to make it easier lets assume the following values:

max_lux is 200 (the maximum lux the sensor can report)

max_brightness is 100

user_lux 400 // twice higher then the max_lux means 0.5 incline in brightness then normal

user_threshold 190 // 0.5 incline in brightness almost all the way to the max_lux, in the last 10 lux steep incline to reach max_brightness

------------------- sensor reports 150 lux ----------------------

since user_lux > SYS_MAX_LUX but CURRENT_LUX is NOT > user_threshold (150 is not > 190) we calculate the brightness using the "else":

brightness = 150/400*100 = 37.5 (good. under this incline 200 should produce 50 brightness)

----------------- sensor reports 190 lux -------------------------------------------------------

same calculation

brightness = 190/400*100 = 47.5 (almost the maximum achieved by this incline)

---------------- sensor reports 195 lux ---------------------------------------

this time user > SYS_MAX_LUX but CURRENT_LUX and CURRENT_LUX > user_threshold

factor = (1 - (190/400))*(200-190) = 5.25

brightness = (190/400)*100 + (195 - 190)*5.25 = 47.5 + 26.25 = 73.73

---------------- sensor reports 200 lux ---------------------------------------

factor = (1 - (190/400))*(200-190) = 5.25

brightness = (190/400)*100 + (200 - 190)*5.25 = 47.5 + 52.5 = 100 (max brightness!)

edit: yes im familiar with C, just wrote it as a formula to pass the theory.

what do you mean? second degree Polynomial? i don't know if our eyes needs a linear increase or parabolic increase in brightness as result of a linear increase in surrounding brightness.

or do you mean something else?
[Galaxy S I9000 Android Development] yavu:
But why Android can't show the real free ram or the whole real apps in ram? This was so since android exist and know 4.2.2 it's the same.
[Galaxy S I9000 Android Development] Necromancer3:
you need to add new values (not sure its the best name, english is my 2nd language)

sa_tuners.threshold

sa_tuners.trigger

and add them to the tune menu.

i used

sa_tuners.lux instead of sa_tuners.max_lux because its not necessarily the max lux

i think these are all the calculation changes that are needed inside the autobr_handler function:

static void autobr_handler(struct work_struct *w)
{
int diff;
float factor;

/* Get the adc value from light sensor and
normalize it to 0 - max_brightness scale */
//sa_info.sum_update_br += ls_get_adcvalue() * sa_tuners.max_brightness /
//sa_tuners.max_lux;

// max_brightness trigger
if (ls_get_adcvalue() > sa_tuners.trigger)
sa_info.sum_update_br += DRV_MAX_BRIGHTNESS;

else if (sa_tuners.lux > DRV_MAX_LUX && ls_get_adcvalue() > sa_tuners.threshold) { // steep incline to max_brightness
factor = (1 - (sa_tuners.threshold/sa_tuners.lux))*(DRV_MAX_LUX - sa_tuners.lux);
sa_info.sum_update_br += (sa_tuners.threshold/sa_tuners.lux)*DRV_MAX_BRIGHTNESS + (ls_get_adcvalue() - sa_tuners.threshold)*factor;
} else sa_info.sum_update_br += ls_get_adcvalue() * DRV_MAX_BRIGHTNESS / sa_tuners.lux; // user moderated incline in brightness

if (++sa_info.cnt < 5)
goto NEXT_ITER;

/* Get the average after 5 samples and only then adjust the brightness*/
sa_info.update_br = sa_info.sum_update_br / 5;
pr_debug("%s: update_br: %u", __func__, sa_info.update_br);
pr_debug("%s: old_br: %u", __func__, sa_info.old_br);

sa_info.update_br = ((sa_tuners.alpha * sa_info.update_br) +
(sa_tuners.beta * sa_info.old_br)) /
sa_tuners.norm;
sa_info.old_br = sa_info.update_br;
pr_debug("%s: filtered update_br: %u", __func__, sa_info.update_br);

pr_debug("%s: update_br: %u, current_br: %u", __func__,
sa_info.update_br, sa_info.current_br);

/* cap the update brightness within the limits */
if (sa_info.update_br < sa_tuners.min_brightness)
sa_info.update_br = sa_tuners.min_brightness;
if (sa_info.update_br > sa_tuners.max_brightness)
sa_info.update_br = sa_tuners.max_brightness;

/* the difference between current and update brightness */
diff = abs(sa_info.current_br - sa_info.update_br);

if (diff > 1 && diff <= sa_tuners.instant_upd_threshold) {
/* update one step every SAMPLE_PERIOD * 5 */
step_update();

} else if (diff > sa_tuners.instant_upd_threshold) {
/* instantly update */
instant_update();
} else
sa_info.current_br = sa_info.update_br;

pr_debug("%s: after current_br: %u", __func__, sa_info.current_br);

/* reset counters */
sa_info.sum_update_br = 0;
sa_info.cnt = 0;

NEXT_ITER:
schedule_delayed_work(&ws, sa_info.delay);
}

all i added was the

// max_brightness trigger

if - else if - else
[Galaxy S I9000 Android Development] stratosk:
OK, thanks.

I will check the code, since it needs some changes. For example, you can't have floats in kernel (or better floats are very "expensive" in kernel).

Please give me some time. I will try to compile a version for you tonight or tomorrow.

BTW, yes I mean a parabolic increase of brightness. Maybe it will match better to your graph:

http://i.imgur.com/QcCae1D.jpg

EDIT:

I'm sorry for the delay. I'm watching the latest news about Cyprus. It will definitely affect my real job.
[Galaxy S I9000 Android Development] Necromancer3:
the environmental brightness/lux increase in linear fashion, i assume the screen brightness needs to do the same. i guess that to clearly see the screen you need to maintain a constant difference? between the screen brightness and the environmental one.

so i think a second degree polynomial might fail in this case (being too dark or too bright under certain lux conditions, and giving good brightness values only on under few lux values).

also the polynomial has to start from 0 and result in 255 under 3000 lux with the ability to play with its curve (change the curve, but the start point and the end point must remain constant).

that requires some serious thinking.
[Galaxy S I9000 Android Development] grinder777:
AW: [KERNEL] Semaphore JB 2.9.15

My hopes are with you!

md p9516 - root -waiting for cwm -- thnx2all
[Galaxy S I9000 Android Development] sandman303:
Re: [KERNEL] Semaphore JB 2.9.15

Hi, I was on slim bean and trying to flash this kernel....pls hellpppppppp

PS: I was trying to flash 2.9.15
[Galaxy S I9000 Android Development] Necromancer3:
flash 2.9.15s with CWM
[Galaxy S I9000 Android Development] Bejda:
Which Slim Bean version and..well..what happened?
[Galaxy S I9000 Android Development] pl4cid:
AW: [KERNEL] Semaphore JB 2.9.15

Thanks Strato,

sadly this will be the last update for me, next week I'm going to sell my sgs after nearly 3 years. Most of the time I ran your kernel, it is slim and the most reliable in my opinion. Keep up the good work my friend, you do a really remarkable job!

Tapatalked
[Galaxy S I9000 Android Development] sandman303:
Re: [KERNEL] Semaphore JB 2.9.15

hi i was on slim bean build 2 and i tryed both s and no s still the same....
[Galaxy S I9000 Android Development] Ahmad_Ashraf:
Re: [KERNEL] Semaphore JB 2.9.15

Why did you try it its already there in slim bean
[Galaxy S I9000 Android Development] elhennig:
Maybe this post got lost due to other question that came up in the same time, at least I did not see any answer.

So here is my question again: Is it possible to have ntfs support (maybe even exfat) in Semaphore?
[Galaxy S I9000 Android Development] pxrave:
check that

ntfs is not really kernel related

http://xdaforums.com/showthread.php?t=1724078
[Galaxy S I9000 Android Development] ReM0815:
AW: [KERNEL] Semaphore JB 2.9.15

Works fine for me in Slim rc2
[Galaxy S I9000 Android Development] ts1506:
Re: [KERNEL] Semaphore JB 2.9.15

This is the semaphore thread and this stupid question has been answered 100's of times. Please search.

Sent from my dad's stocky i9300 sgs3
[Galaxy S I9000 Android Development] Neel.I:
there might be an advanced boot option in developer settings,which in turn is activated by tapping the build number 7 times
[Galaxy S I9000 Android Development] stratosk:
Sorry, I missed this post.

Actually, I wouldn't like an embedded ntfs support in kernel, since the kernel does not support full write operations.

Maybe, it's better to try a userspace driver for ntfs or exfat as pxrave mentioned.

Though, you still need support from kernel with fuse.ko module (Filesystem in Userspace)

fuse module is already implemented in Semaphore.
[Galaxy S I9000 Android Development] stratosk:
You welcome!

Thanks for your kind words.

Enjoy your new device, my friend!
[Galaxy S I9000 Android Development] kaarburo:
You can raise the CPU Min with Semaphore Manager?
[Galaxy S I9000 Android Development] pramathesh:
Re: [KERNEL] Semaphore JB 2.9.15

My ram falls back to 397mb after restart why doesn't the big mem settings stick through the reboot. I'm on slim rom
[Galaxy S I9000 Android Development] radicspeter:
Re: [KERNEL] Semaphore JB 2.9.15

Try Reboot again.

Tapatalk 2-vel küldve az én GT-I9000-ről
[Galaxy S I9000 Android Development] joebacsi72:
Re: [KERNEL] Semaphore JB 2.9.15

Hi!

Semaphore Manager don't work anymore for Me. It has no root access. Yesterday still worked fine.

The other root apps (Titanium backup, Terminal, Lucky Patcher, etc.) are good.

Tapatalk 2-vel küldve az én GT-I9000-ről JB_4.2.2_NIGHTLY + Semaphore_2.9.15s
[Galaxy S I9000 Android Development] ts1506:
Try to clear Semaphore manager data in recovery and try again.
[Galaxy S I9000 Android Development] RivalComp:
Re: [KERNEL] Semaphore JB 2.9.15

Try to check Semaphore Manager's root permission under SuperSU settings.
[Galaxy S I9000 Android Development] joebacsi72:
Re: [KERNEL] Semaphore JB 2.9.15

Nothing change. :(

Tapatalk 2-vel küldve az én GT-I9000-ről JB_4.2.2_NIGHTLY + Semaphore_2.9.15s
[Galaxy S I9000 Android Development] ts1506:
Go under Settings-> superuser and try deleting all references to semaphore manager , then reboot and see.
[Galaxy S I9000 Android Development] joebacsi72:
Re: [KERNEL] Semaphore JB 2.9.15

Superuser give permission.

Tapatalk 2-vel küldve az én GT-I9000-ről JB_4.2.2_NIGHTLY + Semaphore_2.9.15s
[Galaxy S I9000 Android Development] joebacsi72:
Re: [KERNEL] Semaphore JB 2.9.15

I tryed but the problem is still here. :(

I flashed CyanCore 1.8s but the Manager has no root access.

I don't understand but all root apps work fine ( now installed Sqlite installer and it got root acces) except the Semaphore Manager.

Tapatalk 2-vel küldve az én GT-I9000-ről JB_4.2.2_NIGHTLY + Semaphore_2.9.15s
[Galaxy S I9000 Android Development] twili9ht:
I just flashed the latest Nightly and I don't have any problems with root access for the Semaphore Manager.

I do clear Dalvik cache after every flash and reboot though.
[Galaxy S I9000 Android Development] thETImo:
Re: [KERNEL] Semaphore JB 2.9.15

Uninstall and reflash the app.

Sent from my SGS Classic

via banana split.
[Galaxy S I9000 Android Development] joebacsi72:
Re: [KERNEL] Semaphore JB 2.9.15

Now I flashed FISHEARS LVM kernel and installed manualy the modded NSTools (like a normal apk), I need 409MB RAM and everything work fine. NSTools has root access. If I install the Semaphore Manager give no root access.???

I give up. But I like Semaphore. :(

Tapatalk 2-vel küldve az én GT-I9000-ről JB_4.2.2_NIGHTLY + FISHEARS_3.0.70_LVM
[Galaxy S I9000 Android Development] eejee:
Re: [KERNEL] Semaphore JB 2.9.15

Had this issue after installing and using Secdroid. Had to get rid of Secdroid and reflash the rom to solve it.

Verstuurd van mijn GT-P5100 met Tapatalk
[Galaxy S I9000 Android Development] radicspeter:
Re: [KERNEL] Semaphore JB 2.9.15

Try to change superuser app to another... And then you have to refresh your su binary and then try sema app again. ;)

Tapatalk 2-vel küldve az én GT-I9000-ről
[Galaxy S I9000 Android Development] joebacsi72:
Re: [KERNEL] Semaphore JB 2.9.15

With SU is same the problem. Maybe once I will a factoryreset to make.

Tapatalk 2-vel küldve az én GT-I9000-ről JB_4.2.2_NIGHTLY + FISHEARS_3.0.70_LVM
[Galaxy S I9000 Android Development] paokaras45:
Re: [KERNEL] Semaphore JB 2.9.15

Hi.

I am running slimbean 4.2.2 v2.5 with sema 2.9.15s.

I cant run wifi direct apps like superbeam or fast file transfer.

Few days back, with previus versions of slim4.2.2 and sema kernel I was.

Has anything changed latetly?
[Galaxy S I9000 Android Development] tsatomas:
Re: [KERNEL] Semaphore JB 2.9.15

Delete superuser log in order to give permissions from the beginning.
[Galaxy S I9000 Android Development] Necromancer3:
i found a mistake, factor calculation should be

factor = (1 - threshold/lux)*(max_brightness/(max_lux - threshold) )

i didn't know float is expensive.

is all the calculus involves integers only? or only defining float variables is expensive?

does (10/3)*4 result in 12 or 13?

if the calculation is done with fractions, then simply combine it to one line

sa_info.sum_update_br += (sa_tuners.threshold/sa_tuners.lux)*DRV_MAX_BRIGHTNESS + (ls_get_adcvalue() - sa_tuners.threshold)*((1 - (sa_tuners.threshold/sa_tuners.lux))*(DRV_MAX_BRIGHTNESS/(DRV_MAX_LUX - sa_tuners.lux)));

if it isn't then we need to find a way to correct that.

---------------- sensor reports 195 lux ---------------------------------------

this time user > SYS_MAX_LUX but CURRENT_LUX and CURRENT_LUX > user_threshold

factor = (1 - (190/400))*(200-190) = 5.25 = 5

brightness = (190/400)*100 + (195 - 190)*5 = 47 + 25 = 72 (instead of 73.73)

---------------- sensor reports 200 lux (integer) ---------------------------------------

factor = (1 - (190/400))*(200-190) = 5.25 = 5

brightness = (190/400)*100 + (200 - 190)*5 = 47 + 52 = 97 (instead of 100)

---------------- sensor reports 3000 lux (real values) ---------------------------------------

factor = (1 - (2900/6000))*(255/(3000-2900)) = 1.3175

brightness = (2900/6000)*255 + (3000- 2900)*1.3175 = 123.25 + 131.75 = 255 (out of 255)

---------------- sensor reports 3000 lux (integer ) ---------------------------------------

factor = (1 - (2900/6000))*(255/(3000-2900)) = 1.3175 = 1

brightness = (2900/6000)*255 + (3000- 2900)*1 = 123+ 100 = 223 (instead of 255)

the difference isn't high, although truth be told when you can't see the screen every fraction of brightness counts.
[Galaxy S I9000 Android Development] spambayes:
-- Deleted --

Reinstalled and all is working now.
[Galaxy S I9000 Android Development] Rokostar:
AW: [KERNEL] Semaphore JB 2.9.15

The Lockscreen Animation while unlocking is sometimes laggy is that kernel or Rom releated ?
[Galaxy S I9000 Android Development] Neel.I:
Hi Startos,

There is this one problem I am facing for sometime now(on and off actually).Yesterday's was quite bad,went from almost 50% to 20%,in like 10 mins(Powered off an on the device,twice)

Most of the times when I reboot or power on my phone,there is like a 15-20% battery drop.But,if I let it be idle,it gains back like 10%.But if I use it immediately,then it starts draining from that point

Not sure what exactly is the problem with this one,any settings I might be using that could cause this?

My current setup is No-op & ondemand,Hugemem,no OC-UV.
[Galaxy S I9000 Android Development] jugster:
Sv: [KERNEL] Semaphore JB 2.9.15

IMHO that's the battery showing aging signs. Sometimes when flashing from full battery mine will show only a couple of percent left at next boot up. However that is wrong and as time passes android slowly corrects itself. The battery stats are weird during that time as it seems the battery is charging while no power is connected.

Also I'm no longer able to charge to 100% as was common like a year ago.

Despite these facts the battery will easily last a week left untouched.

Signature? Signature!
[Galaxy S I9000 Android Development] beint:
Re: [KERNEL] Semaphore JB 2.9.15

And also when we flashoholics constantly flash, battery stats never get the time to correct itself.

Sent from my sending thingy
[Galaxy S I9000 Android Development] gazza1988:
Re: [KERNEL] Semaphore JB 2.9.15

I find that charging a battery to 100%. Removing the battery and pressing the power button for 10s then putting the battery back in and turning it on helps.

If I don't then my battery stats page looks like a roller coaster.
[Galaxy S I9000 Android Development] Starsream88:
Re: [KERNEL] Semaphore JB 2.9.15

Try to set min cpu frequency to 200Mhz instead of 100.
[Galaxy S I9000 Android Development] Rokostar:
Sorry that dont help
[Galaxy S I9000 Android Development] Neel.I:
I doubt,just got a new battery about a month back!

Yea,agree on the fact that while flashing,the stats are off,because of the activities in recovery.

These problems are during boot ups/reboot/reboot to recovery,like say I switch on my phone,and then reboot it for the full 409mb RAM,i lose about 10-15% on my battery for basically doing nothing(1-2% is understood,because of the whole booting process).And as you pointed out,it does correct itself most of the times,but this happens only if I leave it unattended.
[Galaxy S I9000 Android Development] stratosk:
IMO, this is not kernel related. This is how the battery (controller) reports voltage.

I think that it will be fine, after a couple of cycles of full charging-discharging.
[Galaxy S I9000 Android Development] stratosk:
Yes, you may have only integers. You can have floating point arithmetic in kernel but it's not recommended at all due to extra kernel handling.

Anyway, I prepared a version which handles the brightness with a simple polynomial function (y=x^2).

With this approach I don't need to change the tunables. Please let me know if it behaves better.
[Galaxy S I9000 Android Development] Necromancer3:
is your brightness calculation is also being truncated when you divide the numbers?

its already been flashed into my phone.

i'll assess its output values and report back soon.
[Galaxy S I9000 Android Development] AusMatt:
Re: [KERNEL] Semaphore JB 2.9.15

Had an SOD today with CM10.1 20130324 Nightly.

Details:

- I'm running Semaphore 2.9.15s and patched libs "JB_BigMem_26-aug-12"

- No over clock or voltage changes

- SmartassV2 (without Smooth UI) / CFQ

- WiFi PM FAST

- SD Card read ahead 512KB

- No modules

- Not using SAI

- Not using Deep Idle

- I use CyanDelta

I've only recently switched to SmartassV2 / CFQ and was using Ondemand / ROW (or SIO) for a long time before that without trouble.
[Galaxy S I9000 Android Development] yavu:
Is 2.9.17 only a test version? can I take semaphore S version for helly bean? I would have the possibility to activate bigmem if I need. Normally I will use semaphore S version with disabled bigmem, so that everything function.