[SOLVED] P880 fix to proximity related issues - LG Optimus 4X HD

[Solution in post #4]
Many people reported issues with proximity sensor being buggy. If calibrating didn't work for you the issue is probably the same as mine.
This only affects third party apps screen on/off during calls should be working fine.
What happens is that any app requiring the use of proximity sensor will work straight after installation but will most likely stop working after a reboot.
This is caused by the fact that the values for our proximity sensor are 10cm for 'far' value and 3cm for near.
But what happens is that after a reboot the first sensor reading for near state is set to 0 as you can see from the log:
Code:
D/ProximitySensor( 495): ProximitySensor-enable EN(0), newState(0),mEnabled(1)
V/ProximitySensor( 495): [PROX]APDS PROX SET ENABLE: flags = 0
W/ProximitySensor( 495): ProximitySensor-[setInitialState], value(0.000000)
And this obviously confuses apps which recorded 3cm as value to trigger 'near' and is outside the tolerance range.
I don't know if this is present as bug from lg or is caused by incomplete tegra drivers on cm since it's the tegra.so library which has the drivers for the sensor if i'm not mistaken, but people told me they were having problems also on stock so...
This passage may be related to the problem:
Code:
E/ ( 152): file /data/data/com.nvidia.NvCPLSvc/files/driverlist.txt: not found!
I/ ( 152): Attempting to load EGL implementation /system/lib//egl/libEGL_tegra_impl
I/run-parts( 144): Usage: mount [-r] [-w] [-o options] [-t type] device directory
I/ ( 152): Loaded EGL implementation /system/lib//egl/libEGL_tegra_impl
D/libEGL ( 152): loaded /system/lib/egl/libGLESv1_CM_tegra.so
D/libEGL ( 152): loaded /system/lib/egl/libGLESv2_tegra.so
So dev gang, is this something we can work on?

i can 100% confirm there's issue with this on stock roms as well; f.e., viber won't turn off the screen automatically when it's near your face, while it works no problem on regular calls. good catch, hope this gets resolved somehow :good:

guys, we're in for a fix of this issue that LG screwed up in their kernel, so we'll have fully working proximity sensor! thanks, @Rudjgaard!

I'm going to discuss my findings here since I only talked in private to iodak and is only fare that p880 devs and eventual googlers get their share of knowledge (there are a few devices which have this problem out there)
The problem turned out to be the one described in op, different values for initialState and 'near' causing trouble in 3rd party apps, and this happens both on cm as on stock firmware
Our values are 0 initial, 3 near, 10 far. Since there is no logical reason for 'near' value to be at 3cm (I even talked directly with the developer of the driver at avagotech about this) I simply modified the kernel drivers for the sensor to read 0 when reading near state
After some testing I realized that this way everything works as it should and there have been no further bugs on proximity side
I thought about trying to change the SetInitialState value but it is defined in the sensor.tegra.so lib from which I'd rather keep away from.
So this is pretty much it, iodak already implemented the patch in his kernel. In case you are a kernel builder you can check his commit or grab my modified driver module from HERE

Seems there still are problems. I didn't had any my self.
http://forum.xda-developers.com/showthread.php?p=49911174
Sent from my LG-P880 using xda app-developers app

iodak said:
Seems there still are problems. I didn't had any my self.
http://forum.xda-developers.com/showthread.php?p=49911174
Sent from my LG-P880 using xda app-developers app
Click to expand...
Click to collapse
You talking about the screen off message i suppose, not the baseband one?
I guess the sensor can still have hiccups (how many times have you told people to recalibrate?)
I don't know the downloads you have on 9.9, but considered that everybody uses the phone for calling and thus proximity is used by everyone who installed the kernel, so...we can't really consider one report out of (hundred at least?) as significative.
Btw remember that most 4.4 roms use the proximity apk to handle in call proxi and that app must be calibrated when first launched because it reads all 3 values initial, near and far and then stores them

@Rudjgaard & @iodak thanks to both of you I can now use the app Gravity Screen On/Off with any problem THANK YOU VERY MUCH GUYS!!!

tristaoeast said:
@Rudjgaard & @iodak thanks to both of you I can now use the app Gravity Screen On/Off with any problem THANK YOU VERY MUCH GUYS!!!
Click to expand...
Click to collapse
I actually found the solution to this problem while testing with plexnor, his app was what made me look into it

Related

[Q] ALS and Prox sensor

Please pardon me if someone has already address this question - could not find a closely related response for sure.
Does anyone know if the Nexus One is using any other devices for ALS (ambient light sense) and Proximity detection - other than the Capella CM_3602?
In looking at the android 2.2 source, the driver code seems to set up the Prox (by assigning pin direction and IRQ association) but didn't seem to do much with the ALS.
Is ALS being done in some other area?
It would seem that ALS would require some computation to return proper Lux values.
At first I was under the impression that such a device would require initialization of various registers for configuring the device (via I2C ?), but according to the cm3602 data sheet, there is no I2C!
Configured a kernel to use I2C/dev (to look for any other light sensor devices) and only bus i2c-0 seems to be present. Is that correct - only 1 I2C bus in use?
Is there somewhere else I should be looking?
Thank you for your kind attention.
jbrenner said:
Please pardon me if someone has already address this question - could not find a closely related response for sure.
Does anyone know if the Nexus One is using any other devices for ALS (ambient light sense) and Proximity detection - other than the Capella CM_3602?
In looking at the android 2.2 source, the driver code seems to set up the Prox (by assigning pin direction and IRQ association) but didn't seem to do much with the ALS.
Is ALS being done in some other area?
It would seem that ALS would require some computation to return proper Lux values.
At first I was under the impression that such a device would require initialization of various registers for configuring the device (via I2C ?), but according to the cm3602 data sheet, there is no I2C!
Configured a kernel to use I2C/dev (to look for any other light sensor devices) and only bus i2c-0 seems to be present. Is that correct - only 1 I2C bus in use?
Is there somewhere else I should be looking?
Thank you for your kind attention.
Click to expand...
Click to collapse
AFAIK the nexus only uses that one capella cm3602 sensor as both a light sensor and proximity sensor....
I don't know too much about the driver side code, but there is only the one sensor and it is on the i2c bus.... the light sensor code might be called from another area... but again I'm not sure....
Good question, but I'm not quite sure if this is the right location to be posting it.... what were you looking to do with the light sensors?
Sent from my Nexus One
ALS and Prox sensor
Wow - thank you for your quick response and again I am sorry if this isn't the correct place to post the question. Please tell me is there is a more appropriate location and where that would be. I don’t want to ruffle any feathers.
I am looking to see if there is a way to find the cause and correct the issues others (including myself) have been experiencing (such as unexpected / annoying changes in display brightness, etc.). Also suspicious of dropped calls being related to prox – although probably the carrier.
Mostly though, I would like to help / contribute to the overall improvement and enjoyment for users of the Nexus One.
Without schematics and limited information (data brief vs. data sheets), it is a challenge.
You have mentioned there is only one sensor and it's on the I2C bus. Is it then the cm3602? And if so, I would guess that some of the pins on the device double as SCL and SDA - is that correct? Do you know which ones?
Any help would be appreciated!
Thank you again.
OK [Question answered] - the Capella cm_3602 device DOES NOT HAVE i2c capability.
The ALS data is a prop. voltage fed out of a pin. It's sensitivity is determined by a fixed resistor.
The analog out is provided/controlled internal to the device.
The Proximity is fixed and an interrupt is provided via another /pin.
Thus there isn't much one can do to improve the prox detection range and the user must simply live with the ALS.
It would have been nice if a 'programable' device had been used, thus it would have been capable of being calibrated.

[Q] Proximity sensor

Hey guys. I have looked around and can find no info on some of the tabs sensors. From what i understand the chipset is straight out of the galaxy s phones, which is the reason i see the existence of a proximity sensor but dont see any data from it.
Anyone have a clue whether it actually exists?
chipset and sensors are different things....even if the chipset supports a certain type of sensor doesn't mean it should be there if there is no need to be there.
galaxy tab doesn't need a proxy sensor cause you are not going to put it beside your face when calling...
triplex76 said:
chipset and sensors are different things....even if the chipset supports a certain type of sensor doesn't mean it should be there if there is no need to be there.
galaxy tab doesn't need a proxy sensor cause you are not going to put it beside your face when calling...
Click to expand...
Click to collapse
Doesn't need and doesn't have are different things. Point is, if it was stated that the tab has a proximity sensor, where is it?
I'm pretty sure it has one, in the unofficial CM build Technomancer says he fakes i at 10CM
There is no proximity sensor in Galaxy Tab.
My CM7 sensors driver pretends there is one and reports 10CM distance so the Phone app behaves better.
Thanks mate, that's what you said in the last thread back in October, but why do all the sensor pingers see it? Are they checking code rather than hardware?
Also, is there a working, sensitive light meter anywhere for the tabs ambient light sensor? The couple I've tried refuse to work...
There is working light sensor in the Tab. Both my CM7 and Samsung ROMs support it just fine. It has range from 0 to 6000 Lux snapped to one of several levels in the kernel driver. You can actually read it from sys interface.
The proximity sensor in my CM7 sensors driver is just software reporting constant 10cm to the system. The sensors test apps in my CM7 (I uses Sensor Test and Plot http://www.appbrain.com/app/sensor-test-and-plot/com.golborne.android.SensorTest) just reports 10cm from my fake sensor.
I think there is some leftover code in Samsungs sensors driver that may report presence of proximity sensor.
Yep, i use it as well, but my issue is with the three avaliable states the driver seems to report.
I get 5, 22 and 75. Are there only three levels then? And no way to modify them outside the kernel?
I can get up to 6000lux using strong LED flashlight directly on the sensor.
There is another sys device that can read unprocessed data that has values not snapped to 5,22,75 etc... but Samsung's driver uses the snapped device (and so is mine).
This is very annoying... im trying to make an app that needs a proximity sensor to work as intended so the light sensor as well as the sleep mode implementation are really no substitute.
In any case, im sure it will be quite usefull for all tablet owners running 2.2 and up and using a case. I will have a closed beta for xda members by the end of the day, so people can test it over the weekend.
Would you like a shot, mancer?
I don't know what would you do but if I understand why not to use the g-sensor ... just like in samsung omnia...put backwards enable silent courtesy mode.
the proximity sensor will be useful if you use the leather case to close the screen when touches the screen , like ipad 2 and galaxy tab 10.1 V they have proximity sensors , but i noticed that the sensor exists using sensor applications they see it exists but not giving readings
Hi - there is no sensor, the sensor list showing it is just a glitch from the galaxy s motherboards. And the functionality youre describing is already available in my app Killswitch - you can get both the lite and full version from my signature...
ftgg99 said:
Hi - there is no sensor, the sensor list showing it is just a glitch from the galaxy s motherboards. And the functionality youre describing is already available in my app Killswitch - you can get both the lite and full version from my signature...
Click to expand...
Click to collapse
Thanks I already bought it from market and it's great
Sent from my GT-P1000 using XDA App
Great! Im working on an update that will help improve the accuracy of the light sensor functions... been getting some flack for not updating it
Watch this space!

Is proximity working for you in apps?

Yes, another proximity question!
I have trouble with this sensor using 3rd party apps.
On system it works fine without a problem (screen on/off during phone call never had any problems)
but any apps which use this sensor stops working after rebooting.
-Gravity screen on/off
-Automaton gestures
-Automate it!
These are the apps I tried and encountered problems with...so pretty much all of them!
The sensor works, cpuz sees it working with both distances 3cm near and 10cm far, but apps don't :S
For example if I try to record sensor state in automate it it just reads '10 far' and notihng else.
aamof rules with sensor far work fine but with near don't....
I encountered this problem both across 10.1 and 10.2 and different roms...anybody else encountered this isse?
I recalibrated tegra.so from adb...I'll try to go back to stock and try from there recalibration but seen thtat it "works"
I'm not sure how that is going to help.....
Rudjgaard said:
Yes, another proximity question!
I have trouble with this sensor using 3rd party apps.
On system it works fine without a problem (screen on/off during phone call never had any problems)
but any apps which use this sensor stops working after rebooting.
-Gravity screen on/off
-Automaton gestures
-Automate it!
These are the apps I tried and encountered problems with...so pretty much all of them!
The sensor works, cpuz sees it working with both distances 3cm near and 10cm far, but apps don't :S
For example if I try to record sensor state in automate it it just reads '10 far' and notihng else.
aamof rules with sensor far work fine but with near don't....
I encountered this problem both across 10.1 and 10.2 and different roms...anybody else encountered this isse?
I recalibrated tegra.so from adb...I'll try to go back to stock and try from there recalibration but seen thtat it "works"
I'm not sure how that is going to help.....
Click to expand...
Click to collapse
yeah, i noticed in viber screen doesn't turn off when you put your phone enxt to your ear. i dont have any other apps that use proximity sensor other than phone app, but that one works without issues.
the issue persists in stock as well as custom roms. no idea how it was on ics, though
It also appears on stock?! wow never would've thought...
It's a pretty considerable bug to have never been mentioned before...
all problems with proximity encountered so far always seemed caused by bad calibration..
this kinda sux :S
Devs and wise people, do you think this could be caused by the fact that the 'near' state is set at 3cm reading and 3rd party apps look for 0 distance with 0% tolerance to have widespread compatibility?
Do you think it is possible to change these settings?

[Q] Direction/orientation in Google Maps wrong

Hi all,
I've found that in the Google Maps app, the direction that the app thinks I am facing is almost invariably wrong, and often varies wildly even when I'm not moving. I think it is related to the rotation vector sensor (Sensor.TYPE_ROTATION_VECTOR) but I was wondering if others had experienced similar problems.
I've looked at the various sensors (and compared them to a Nexus 5) and two stand out: the Uncalibrated Gyro (Sensor.TYPE_GYROSCOPE_UNCALIBRATED), and the Rotation Vector (Sensor.TYPE_ROTATION_VECTOR).
The Uncalibrated Gyro seems to sit with a z-axis value of 1.17 rad/s, and the rotation vector *sometimes* seems to stick at a high value too.
Anyway, the question is:
(1) Do other people find that Google Maps tends to detect them pointing in the wrong direction, or turning when they are in fact not turning, and
(2) Do other people find that the rotation vector sometimes sticks at a weirdly high value (if they have the tools to check: I wrote one to check myself, which I can attach if desirable but being unknown I don't know if anyone would trust to install it =)
Cheers.
This may seem a basic question, but did you try calibrating the compass via the service menu?
Enter *#*#7378423#*#* in the dialler.
Service tests
Compass
Follow the on screen guide.
That always seems to correct any "creep" or odd readings with my compass and gyro. You can also check the gyro from the service test menu.
Sent from my C6603 using Tapatalk
kingvortex said:
This may seem a basic question, but did you try calibrating the compass via the service menu?
Click to expand...
Click to collapse
Cheers, I did do that but it didn't seem to make a difference. However, now GMaps seems to be working pretty well so that's good. (It's done that before, but maybe this time it will last). However, the game Ingress is still having problems (which it doesn't have under Stock). Like GMaps, it tries to detect the direction you are facing. On Stock 4.4.4, Ingress does a tolerable job of detecting direction of facing - it mostly gets it right. However, using CM11 the behaviour is really weird: turning the phone has no effect until a tipping point, at which it is detected that I've done a sudden 180, and if I keep turning the phone it eventually happens again. Doing the phone-calibration-twirl has no effect in this case. (Note: that is rotational movement with the phone laying flat on a table, and a metaphorical tipping point. I'm not standing the phone up until it tips over)
Maybe related, but maybe not: Having done some more testing with a few ROMs and kernels, what I've found is that CM11 (both official and _infected builds, with both the included kernel or the multirom-modified kernel) don't provide a TYPE_GYROSCOPE_UNCALIBRATED sensor (where as the stock 4.4.4 ROM does).
That said, Ingress doesn't appear to *use* the TYPE_GYROSCOPE_UNCALIBRATED (instead only using LINEAR_ACCELERATOR, ROTATION_VECTOR and MAGNETIC_FIELD) so I'm a bit confused. (Edit: I believe these are the sensors being used based on the hex values being passed to getDefaultSensor in the smali of Ingress.)
The sensor results for both stock and CM11 look to be about the same, with the exception of the 'Uncalibrated Gyroscope' not being present in CM11 whereas it is present in stock 4.4.4. I think that sensor missing is probably a bug, but I'm not exactly sure where to report what is probably a device-specific bug for CyanogenMod.
tl;dr;
Calibration movements might have fixed it in Google Maps, but Ingress is still having problems in CM11 (but not Stock 4.4.4).
I think there is a sensor missing in CM11 that is in stock, and that's probably a bug. Where should a device-specific yuga bug in CM11 get reported?
This may seem a basic question, but did you try calibrating the compass via the service menu?
Enter *#*#7378423#*#* in the dialler.
Service tests
Compass
Follow the on screen guide.
That always seems to correct any "creep" or odd readings with my compass and gyro. You can also check the gyro from the service test menu.
Sent from my C6603 using Tapatalk
Sent from my C6603 using XDA Free mobile app
---------- Post added at 10:03 AM ---------- Previous post was at 09:19 AM ----------
Sorry guys for this copy paste, my mistake.
I have exactly the same problem.
Calibration do nothing.
Sent from my C6603 using XDA Free mobile app

GPS problem: abaut 20 satelies in view but not in use

Hello,
yesterday I have received my Z3 Compact from repair (digitizer was broken - replaced) and now gps don't work.
GPS test see abaut 20-22 satellites, but 0 in use. The screen shoots shows the situation.
The firmware was replaced in service (I do not remember what version was before).
The Phone is used in Poland but came from UK.
the WI-FI work properly, GSM and Bluetooth too.
What can I do to fix the GPS? Maybe is a software problem?
Please help me.
same problem here...
Check if accurate position is selected in location settings. If so, then give the Clear A-gps command in that software and step outside and let phone find sattelites in the old school non-assisted way. That should do it.
Had my Z3C for a week and just tried GPS today, with the same issue. It's picking up the satellites but just not locking. Tried factory resets, tried flashing to different rom's, tried the service menu where the test just says "Waiting for location update" ... GPS just doesn't want to lock on.
Looks like I might have to send it back unless anyone has any other suggestions?
Same problem here
I tried factory reset and FlashTool reset but it still don't work
On the outside sometimes it picks up some satellites but the signal is weak and i can't get a constant or acurrate location
I'm having the same problem. I ran a logcat and noticed this.
[ 04-11 07:11:11.922 16922:16922 I/Timeline ]
Timeline: Activity_launch_request id:com.chartcross.gpstest time:79643363
[ 04-11 07:11:11.924 824: 1474 I/ActivityManager ]
START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 pkg=com.chartcross.gpstest cmp=com.chartcross.gpstest/.GPSTest bnds=[536,170][712,370]} from uid 10108 on display 0
[ 04-11 07:11:11.934 824: 1474 W/ResourceType ]
Found multiple library tables, ignoring...
[ 04-11 07:11:11.967 824: 1898 I/ActivityManager ]
Start proc com.chartcross.gpstest for activity com.chartcross.gpstest/.GPSTest: pid=32342 uid=10000 gids={50000, 9997, 3003} abi=armeabi-v7a
[ 04-11 07:11:12.022 32342:32342 W/ResourceType ]
Found multiple library tables, ignoring...
[ 04-11 07:11:12.177 32342:32342 W/ResourcesManager ]
Asset path '/system/framework/com.android.media.remotedisplay.jar' does not exist or contains no resources.
[ 04-11 07:11:12.177 32342:32342 W/ResourcesManager ]
Asset path '/system/framework/com.android.location.provider.jar' does not exist or contains no resources.
Go to the dialer and type *#*#7378423#*#**it will take you to the service menu, go on service tests, scroll down, go to GPS, click "Purge Assistance Data" then run the GPS test on that same menu, make sure location in Settings is set to High accuracy.
Sent from my D5833 using XDA Free mobile app
Anyone found a solution for this issue?
My experience is the same as other users:
- statellites in view (23) but no fix
- tried the dialer solution, popping the sim and rebooting and clearing agps. Tried force stopping apps using Location Services. No success on any front.
Any ideas whatsoever? Obviously it's software if the gps sees the satellites... I'm will to root and go custom rom, but I'm hesitant since I don't feel that will help for sure.
buddy1234567 said:
My experience is the same as other users:
- statellites in view (23) but no fix
- tried the dialer solution, popping the sim and rebooting and clearing agps. Tried force stopping apps using Location Services. No success on any front.
Any ideas whatsoever? Obviously it's software if the gps sees the satellites... I'm will to root and go custom rom, but I'm hesitant since I don't feel that will help for sure.
Click to expand...
Click to collapse
Download GPS status from the Play Store. Use that to do a cold start for the GPS, but before doing so, recalibrate the compass first.
DaryllSwer said:
Download GPS status from the Play Store. Use that to do a cold start for the GPS, but before doing so, recalibrate the compass first.
Click to expand...
Click to collapse
Yep... Tried this again and still no success.... Just rooted the phone and now thinking about a Custom Rom, but I feel like I'm shooting in the dark here.... Any reason why it could see 20+ satellites and still not have a gps fix?
buddy1234567 said:
Yep... Tried this again and still no success.... Just rooted the phone and now thinking about a Custom Rom, but I feel like I'm shooting in the dark here.... Any reason why it could see 20+ satellites and still not have a gps fix?
Click to expand...
Click to collapse
Try to uninstall google play services (root required) and then download again via play store. It work for me.
How did you uninstall play services? Did you use titanium backup?
My solution to GPS problem
I had exactly the same problem as described in OP. After trying everything I could think of I've decided open the case. The inner rectangular frame (the one held with 5 screws that you have to take out right after disconnecting the NFC antenna) was not latched at one point near the GPS antenna connector. I took it out (the frame). The were some antennas on the edges (including GPS) where you could clearly see the connection points. Everything looked alright so I just inserted that frame back making sure every latch is OK and turned on the phone to check the GPS. It got a fix almost instantly. Before this I couldn't even get 1 satellite used out of many in view.
I think I could correct the frame mounting without even taking it out and disconnecting the NFC antenna.
The problem might have been caused by bending the phone kept in the rear pocket of my jeans while sitting or it was wrongly assembled by a service center which replaced the case under warranty (less likely because it was several month before the problems appear).
jacfry said:
I had exactly the same problem as described in OP. After trying everything I could think of I've decided open the case. The inner rectangular frame (the one held with 5 screws that you have to take out right after disconnecting the NFC antenna) was not latched at one point near the GPS antenna connector. I took it out (the frame). The were some antennas on the edges (including GPS) where you could clearly see the connection points. Everything looked alright so I just inserted that frame back making sure every latch is OK and turned on the phone to check the GPS. It got a fix almost instantly. Before this I couldn't even get 1 satellite used out of many in view.
I think I could correct the frame mounting without even taking it out and disconnecting the NFC antenna.
The problem might have been caused by bending the phone kept in the rear pocket of my jeans while sitting or it was wrongly assembled by a service center which replaced the case under warranty (less likely because it was several month before the problems appear).
Click to expand...
Click to collapse
Thank you Jacfry,
Your post solved my GPS trouble with an X Compact. When looking at the back of the phone, a screw in the bottom right corner of the frame was entirely loose. Screwed it in, and GPS is now working.
Hello,
I posted in the wrong section, but here is a fix for this problem : https://forum.xda-developers.com/t/gps-problem.3864011/post-85633027

Categories

Resources