(Need Root)Enable Automatic Light Sensor on Xperia Ray

Search This thread

trankieu.com

New member
Apr 2, 2012
1
0
good job

work nice!

i use Ray firm 0.62
i've set echo 1.1.1.0 and replace file als_curve

Please test it under strong light like as the sun ,you will see it different;)
 

j sta

Senior Member
Works for me. Put 3,1,1,0 and with brightness down to 20% can see difference plain. Even tried 6,1,1,0 but the screen been changing with a slight tilt of the phone from side to side - annoying, 3,1,1,0 is good. Thats tested in a room with a light on, will see tomorrow in daylight.

Sent from my ST18i using XDA
 

j sta

Senior Member
I think I accidentally changed something in the config while editing on the phone, I dont see it working anymore.
Could someone please copy and paste the whole text for me?
No jokes please :)

Sent from my ST18i using XDA
 

arcatarc

Senior Member
I think I accidentally changed something in the config while editing on the phone, I dont see it working anymore.
Could someone please copy and paste the whole text for me?
No jokes please :)

Sent from my ST18i using XDA

# Audio jack configuration
dev=/sys/devices/platform/simple_remote.0
echo 0,201,1600 > $dev/accessory_min_vals # default = 0,200,1600
echo 200,1599 > $dev/accessory_max_vals # default = 200,1600
echo 0,100,280,500,700 > $dev/button_min_vals # default = 0,100,300,600,700
echo 99,199,399,699,5000 > $dev/button_max_vals # default = 99,199,399,699,5000
echo 512 > $dev/btn_trig_period_freq # Button Period Freq(Hz) default = 512
echo 16 > $dev/btn_trig_period_time # Button Period Time(cycle) default = 16
echo 512 > $dev/btn_trig_hyst_freq # Button Hysteresis Freq(Hz) default = 512
echo 16 > $dev/btn_trig_hyst_time # Button Hysteresis Time(Cycle) default = 16
echo 500 > $dev/btn_trig_level # default = 500

# Proximity sensor configuration
dev=/sys/bus/i2c/devices/0-0054/
val_cycle=0
val_nburst=15
val_freq=0
val_threshold=1
val_filter=1

nv_param_loader 60240 prox_cal
val_calibrated=$?
case $val_calibrated in
1)
nv_param_loader 60240 threshold
val_threshold=$?
nv_param_loader 60240 rfilter
val_filter=$?
;;
esac

echo $val_cycle > $dev/cycle # Duration Cycle. Valid range is 0 - 3.
echo $val_nburst > $dev/nburst # Number of pulses in burst. Valid range is 0 - 15.
echo $val_freq > $dev/freq # Burst frequency. Valid range is 0 - 3.
echo $val_threshold > $dev/threshold # sensor threshold. Valid range is 0 - 15 (0.12V - 0.87V)
echo $val_filter > $dev/filter # RFilter. Valid range is 0 - 3.

# LMU AS3676 Configuration
dev=/sys/devices/i2c-0/0-0040/leds/
echo 1,1,1,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]
echo 1 > $dev/lcd-backlight/als/enable #Sensor on/off. 1 = on, reg 90h
echo 12900 > $dev/torch/max_current

# TI BQ275xx firmware loader
bq275xx_fwloader

#!/system/bin/sh
# Sd Fix

if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]; then
echo "2048" > /sys/devices/virtual/bdi/default/read_ahead_kb
fi


Sent from my ST18i using XDA App
 
Last edited:
  • Like
Reactions: j sta

j sta

Senior Member
Thanks arcatarc,
will have a look in a moment.

Edit.
Yes it worked, I was missing the bottom part:

#!/system/bin/sh
# Sd Fix

if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]; then
echo "2048" > /sys/devices/virtual/bdi/default/read_ahead_kb
fi


Thanks, fixed and happy
 
Last edited:

arcatarc

Senior Member
Thanks arcatarc,
will have a look in a moment.

Edit.
Yes it worked, I was missing the bottom part:

#!/system/bin/sh
# Sd Fix

if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi

if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]; then
echo "2048" > /sys/devices/virtual/bdi/default/read_ahead_kb
fi


Thanks, fixed and happy

I'm happy for you,but i think the problem was in another line,because this line are added by myself to increase sd card speed!

Sent from my ST18i using XDA App
 

j sta

Senior Member
Well, must have been something else so.
I wish I could comment on the card speed, I even tried a couple of sd tools from the market last week, cause was changing the stock to a larger one, but the apps were so so... No option of random speed test...

Anyways, thanks for that, ALS didn't work, now it does :)

Sent from my ST18i using XDA
 

Ray-Out

Member
Apr 20, 2012
8
2
The following is valid for my ray with ICS:

ALS works even without changes although it is nearly unnoticable as it takes ages to go to the lowest value allowed by the current brightness settings.

I got the time it takes to react on changes in ambient light down to usable values using 0,2,4,0 and 0,1,2,0

Valid values for the 1st value seem to be 0 to 3, for second and third values they go from 0 to 7 and fourth value i kept at 0 as it would only make zero brightness brighter.

The setting on the attached image gives the widest range of brightness from about 16% to about 98% and corresponds to the 6th entry (line 7) of my ray's original als_curve.conf. 1 Step more will range from about 18% to 100% brightness. Everything above will only change the lowest brightness and always go up to 100% under bright light or sunlight. Settings below my setting will lower the low limit a bit per level and the upper limit gets down.

als_curve.conf explanation: first number must always be 1, second number is the low limit of brightness, the third number is the upper limit of brightness. The rest of the line defines the shape of the "curve".

I'm currently working on a als_curve.conf with a wide range of full-range settings to find some useful "shapes" to use a ray at the same brightness-setting at night and under sunlight.
 

Attachments

  • brightness4.jpg
    brightness4.jpg
    17.7 KB · Views: 349
Last edited:

qrim

Senior Member
Dec 18, 2011
73
4
Estonia
Not working in my Ray. I use bootuv5 KERNEL, Repack4pda_6 ROM, I change 0,0,0,0 to 3,2,2,0 and save. Then I open again that fail and this showing 0,0,0,0! :confused:
Working, I forgot to delete the als_curve.conf file.
 
Last edited:

vlzkcbcb

Member
May 10, 2010
17
7
can i get your files??

The following is valid for my ray with ICS:

ALS works even without changes although it is nearly unnoticable as it takes ages to go to the lowest value allowed by the current brightness settings.

I got the time it takes to react on changes in ambient light down to usable values using 0,2,4,0 and 0,1,2,0

Valid values for the 1st value seem to be 0 to 3, for second and third values they go from 0 to 7 and fourth value i kept at 0 as it would only make zero brightness brighter.

The setting on the attached image gives the widest range of brightness from about 16% to about 98% and corresponds to the 6th entry (line 7) of my ray's original als_curve.conf. 1 Step more will range from about 18% to 100% brightness. Everything above will only change the lowest brightness and always go up to 100% under bright light or sunlight. Settings below my setting will lower the low limit a bit per level and the upper limit gets down.

als_curve.conf explanation: first number must always be 1, second number is the low limit of brightness, the third number is the upper limit of brightness. The rest of the line defines the shape of the "curve".

I'm currently working on a als_curve.conf with a wide range of full-range settings to find some useful "shapes" to use a ray at the same brightness-setting at night and under sunlight.


Can I get your files??

"als_curve.conf" and "hw_config.sh" for ICS.

Please??
 

Ray-Out

Member
Apr 20, 2012
8
2
als_curve.conf is the original file from Nordic ICS Image.

The relevant part of my hw_config.sh
Code:
# LMU AS3676 Configuration
dev=/sys/devices/i2c-0/0-0040/leds/
echo 0,2,4,0 > $dev/lcd-backlight/als/params  #[gain],[filter_up],[filter_down],
[offset]
echo 1 > $dev/lcd-backlight/als/enable  #Sensor on/off. 1 = on, reg 90h
echo 12900 > $dev/torch/max_current

As everything is done in the LED-Controller i think changing the stepping itself is impossible but imho not needed. If the first value is at max (3) then even small changes in ambient brightness level change the value dramatically. This is the reason i left it at 0.
It is possible to check the value in service-menu under ambient light sensor. This value takes the 4 parameters into account and is the input to the current setting from als_curve.ini which in turn gives the brightness.

Edit: Still trying to find time to get the curves plotted.

Edit2: Analyzed the row for the Line corresponding to my brightness-setting:
Values are from sensors as readable using the service-menu.

Minimum Brightness is 41 for my setting.
Medium Brightness (127) is active for a value of 62.
It reaches maximum brightness (251) with a value of 150.
 
Last edited:
  • Like
Reactions: cajhin

tmt2003@gmail.com

Senior Member
Dec 12, 2011
54
4
Tbilisi
I've found the way to enable ALS on Ray:
Using root explorer Change this value in hw_config.sh(inside system/etc):
# LMU AS3676 Configuration
dev=/sys/devices/i2c-0/0-0040/leds/
echo 0,0,0,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]
echo 1 > $dev/lcd-backlight/als/enable #Sensor on/off. 1 = on, reg 90h
echo 12900 > $dev/torch/max_current
To
# LMU AS3676 Configuration
dev=/sys/devices/i2c-0/0-0040/leds/
echo 3,2,2,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]
echo 1 > $dev/lcd-backlight/als/enable #Sensor on/off. 1 = on, reg 90h
echo 12900 > $dev/torch/max_current​

Optional:replace als_curve.ini with the one i provide(is from arc):for me is better.
UPDATE:I've deleted the "als_curve.ini" from phone and changed
echo 3,2,2,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]
to
echo 1,1,1,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]

now backlight seem more"wide range".

what numbers in original neo or arc hw_config.sh files? and why sonyericsson don`t enable this function by default
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 61
    I've found the way to enable ALS on Ray:
    Using root explorer Change this value in hw_config.sh(inside system/etc):
    # LMU AS3676 Configuration
    dev=/sys/devices/i2c-0/0-0040/leds/
    echo 0,0,0,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]
    echo 1 > $dev/lcd-backlight/als/enable #Sensor on/off. 1 = on, reg 90h
    echo 12900 > $dev/torch/max_current
    To
    # LMU AS3676 Configuration
    dev=/sys/devices/i2c-0/0-0040/leds/
    echo 3,2,2,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]
    echo 1 > $dev/lcd-backlight/als/enable #Sensor on/off. 1 = on, reg 90h
    echo 12900 > $dev/torch/max_current​

    Optional:replace als_curve.ini with the one i provide(is from arc):for me is better.
    UPDATE:I've deleted the "als_curve.inf" from phone and changed
    echo 3,2,2,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]
    to
    echo 1,1,1,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]

    now backlight seem more"wide range".

    UPDATE: New CWM version added(InstallazioneALS_Xperia_Ray.zip):flash via recovery.

    UPDATE:In official ics 4.0.4 i found the best way is to delete als_curve.inf (after change echo 1,1,1,0 )

    UPDATE 08/November: for a fast response (istantaneous dim change) flash (Fast Response)InstallazioneALS_Xperia_Ray.zip

    If you like my work make a donation(51% will be donate to UNICEF):
    EVERY DAY CHILDREN DIE NEEDLESSY!!!
    https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Q94WGHC4F2DH2
    10
    ALS

    try my app
    not very clean, not fast, not nice, not general
    but can be usefull on some eric phones
    tested on xperia pro, neo - android 2.3
    3
    Hi arcatarc. I'm on JJ 3.2 rom. I searched this thread and you told, that in JJ's rom is ALS enabled by default. When i open hw_config.sh(inside system/etc) it shows, that:
    # LMU AS3676 Configuration
    dev=/sys/devices/i2c-0/0-0040/leds/
    echo 0,0,0,0 > $dev/lcd-backlight/als/params #[gain],[filter_up],[filter_down],[offset]

    Also i think its not enabled (it was the same on JJ 3.1). Or JJ enabled it by another way?

    echo 1 > $dev/lcd-backlight/als/enable #Sensor on/off. 1 = on, reg 90h
    line is enabling als

    echo 0,0,0,0 ... means that als is most wide range, lowest up response, lowest down response, and has no offset...
    first 3 values you can change from 0-7, the last one I don't know
    1
    yeah, I saw it "working"... with a step or two at most. I am really disappointed by how SE implemented this. Even the brightness manual slider seams to have 15-16 steps, i.e. it's not smooth. I had a HTC Hero and auto-brightness/slider were flawless.
    1
    Should i do update from sd card or
    wipe dalvik cache,factory reset,wipe cache and then install from sd card???:confused::confused::confused:

    ---------- Post added at 10:56 AM ---------- Previous post was at 10:53 AM ----------

    Should i do update from sd card or
    wipe dalvik cache,factory reset,wipe cache and then install from sd card???

    Only flash zip from cwm...