Closed Bug 753245 Opened 12 years ago Closed 6 years ago

bad orientation sensor data on Nexus S

Categories

(Core :: Hardware Abstraction Layer (HAL), defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: djf, Unassigned)

References

Details

In widget/gonk/OrientationObserver.cpp, the OrientationObserver::Notify method is getting bad sensor data on the Nexus S.  Adding logging to that method shows that Notify is repeatedly called with a pitch of -0.015625 and a roll of 0. This never changes, regardless of the actual orientation of the phone.

This starts happening when I call screen.mozUnlockOrientation() and continues until I call screen.mozLockOrientation() with one of the four orientation values.

I have no idea whether it is related, but after locking the orientation I often see this message in the log:

E/SensorService(   85): Info::setDelayForIdent(ident=0x40133588, ns=100000000) failed (No such file or directory)
This looks like to be a driver issue.
On Nexus S, /dev/input/event6 readings remains constant no matter how the device is rotated:

130|root@android:/ # getevent
add device 1: /dev/input/event6
  name:     "compass"
add device 2: /dev/input/event5
  name:     "cypress-touchkey"
add device 3: /dev/input/event4
  name:     "lightsensor-level"
add device 4: /dev/input/event3
  name:     "proximity"
add device 5: /dev/input/event2
  name:     "herring-keypad"
add device 6: /dev/input/event1
  name:     "gyro"
add device 7: /dev/input/event0
  name:     "mxt224_ts_input"
/dev/input/event6: 0002 0004 ffffffff
/dev/input/event6: 0002 0008 00000003
/dev/input/event6: 0000 0000 00000000
/dev/input/event6: 0002 0004 ffffffff
/dev/input/event6: 0002 0008 00000003
/dev/input/event6: 0000 0000 00000000
/dev/input/event6: 0002 0004 ffffffff
/dev/input/event6: 0002 0008 00000003
/dev/input/event6: 0000 0000 00000000
/dev/input/event6: 0002 0004 ffffffff
/dev/input/event6: 0002 0008 00000003
/dev/input/event6: 0000 0000 00000000
/dev/input/event6: 0002 0004 ffffffff
/dev/input/event6: 0002 0008 00000003
/dev/input/event6: 0000 0000 00000000
/dev/input/event6: 0002 0004 ffffffff

In comparison, this is from SGS2. /dev/input/event8 readings changes when device changes orientation:

130|root@android:/ # getevent
add device 1: /dev/input/event8
  name:     "compass_sensor"
add device 2: /dev/input/event7
  name:     "sec_touchkey"
add device 3: /dev/input/event6
  name:     "gyro_sensor"
add device 4: /dev/input/event5
  name:     "light_sensor"
add device 5: /dev/input/event4
  name:     "proximity_sensor"
add device 6: /dev/input/event3
  name:     "sii9234_rcp"
add device 7: /dev/input/event2
  name:     "sec_touchscreen"
could not get driver version for /dev/input/mice, Not a typewriter
add device 8: /dev/input/event1
  name:     "gpio-keys"
add device 9: /dev/input/event0
  name:     "max8997-muic"
/dev/input/event8: 0002 0008 00000003
/dev/input/event8: 0002 0003 000010e0
/dev/input/event8: 0002 0004 ffffef02
/dev/input/event8: 0002 0005 00000491
/dev/input/event8: 0000 0000 00000000
/dev/input/event8: 0002 0008 00000003
/dev/input/event8: 0002 0003 000014bd
/dev/input/event8: 0002 0004 fffffa0e
/dev/input/event8: 0002 0005 fffffd88
/dev/input/event8: 0000 0000 00000000
/dev/input/event8: 0002 0008 00000003
/dev/input/event8: 0002 0003 0000209e
/dev/input/event8: 0002 0004 00000044
/dev/input/event8: 0002 0005 fffffaad
/dev/input/event8: 0000 0000 00000000
/dev/input/event8: 0002 0008 00000003
/dev/input/event8: 0002 0003 00002288
/dev/input/event8: 0002 0004 ffffffb3
/dev/input/event8: 0002 0005 fffffe86
/dev/input/event8: 0000 0000 00000000
/dev/input/event8: 0002 0008 00000003
/dev/input/event8: 0002 0003 00002287
/dev/input/event8: 0002 0004 00000276
/dev/input/event8: 0002 0005 000001af
/dev/input/event8: 0000 0000 00000000
/dev/input/event8: 0002 0008 00000003
/dev/input/event8: 0002 0003 00002f86
/dev/input/event8: 0002 0004 ffffffe3
/dev/input/event8: 0002 0005 ffffece6
Any chance we can get this working in time for Friday's demo?  I'm hoping to demo a working camera app then on the Nexus S and would love to have it respond to orientation changes.
Doug, you were poking at sensors in the other bug. Is this related?
I don't think so.  The calls david is making into gonk for mozUnlockOrientation don't do the same thing.

david,

Can you load this into the browser:
   http://dl.dropbox.com/u/8727858/physical-events/index.html

Do you see the expected/correct orientation values?
Okay, this is wild.  If I visit that web page on the Nexus S, I get accelerometer data, and suddenly, gaia apps start responding and rotating. But rebooting gets me back into the broken state.  So somehow listening for device motion events unwedges the sensors.
Some tests shows that the accelerometer has to be enabled for orientation sensor to get valid value on Nexus S. Devicemotion event enables accelerometer, linear accelerometer and gyroscope so after it orientation works. Since android's system_service is responsible for listening to all sensors, this is not a problem if the hardware library is implemented in this way. But we need to investigate more about such crosstalk between sensors before making changes to hal or gonk code to make it generic.
Depends on: 788975
Fun fact: currently on my Nexus S with up-to-date Gecko & Gaia, screen rotation won't work until I load the page suggested in comment #4. Once it has been loaded, the feature works very well.
And it stops working as long as the page is not loaded anymore.
(In reply to Alexandre LISSY :gerard-majax from comment #7)
> Fun fact: currently on my Nexus S with up-to-date Gecko & Gaia, screen
> rotation won't work until I load the page suggested in comment #4. Once it
> has been loaded, the feature works very well.

We used to have some code somewhere in the system app that registered an event listener on one of the sensor, copying code from the page in comment 4.  This was to workaround this very issue.  The code must have been removed.
The workaround is still here, but this bug re-emerged recently. There is obviously something wrong :/. As long as I load the page from dropbox, it's working.
We should remove any hardware dependent code from system app. I'll do it in recently WM refactor.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.