-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hd-app-mgr: Add iio-sensor-proxy backend for rotation. #7
base: master
Are you sure you want to change the base?
Conversation
IIUC, that code belongs to mce, not h-d |
this is a prototype. to be looked at/tested by people with devices where randr rotation works correctly (pinephone? n900?) |
@freemangordon mce provides a dbus interface to the accelerometer that hildon-desktop uses to determine when to rotate to portrait. This provides the option to use iio-sensor-proxy instead of mce. this is beneficial because iio-sesnor-proxy supports all kinds of sensor divers while mce supports only one (n900) It is my intention to remove all sensor handling code from mce and replace it with iio-sesnor-proxy everywhere |
I think we shall keep the current interfaces intact and teach mce in iio-sensors. @MerlijnWajer - what do you think? |
|
Nice, thanks for the PR! I view mce as the abstraction to many hw parts of the phone. IMO, if h-d doesn't use much beyond rotation, let's have it rely on mce instead. That way we can also have one centralised way where we tweak the policy. Like, when do we decide we have actually rotated our device? We don't want that to go out of sync between programs: one thinking it is landscape, the other thinking it is portrait. I agree that having full access to the sensor is helpful for other programs, but h-d doesn't seem to be one of them, from a quick glance? |
There's also things like orientation lock applet, which if I recall correctly, relies on gconf settings to override the rotation settings, so I think that policy part is really best handled in mce. |
mce itself dosent use the accelerometer for anything and hildon desktop reads the gconf state by itself with no input from mce at all, so the policy is not handled in mce at all atm either. the only thing mce dose do is turn off poling when the display is off and during various other times, but because of how the iio interface works haveing mce do that with iio devices would be highly problematic so its best to have hildon unsubscribe from whatever dbus interface used to get the data. (iio or mce) |
As far as I can tell, mce also sends the new orientation over dbus. Are you saying that's not used? |
What is problematic about mce doing that? I don't understand. |
it is used by hildon as one of many factors to decide when to rotate.
This single input that mce accelerometer.c uses besides the accelerometer (and callibration data, also used by the proxy) is not policy. It is sensor fusion at best and not very usefull at that because the accelerometer will show landscape when the n900 is on the stand. its also very n900 specific so a replacment to accelerometer.c would likely ditch this anyways. All the real policy is in hildon, hildon decides when to rotate based on the roation-lock state, the current client, the keyboard state and so on. the real policy decisions are already in hildon, where imho they make sense. When mce sends the orientation signal it has no clue wheather this is reflected in the rotation state, so hildon and mce already "get out of sync". Mce is in this case really nothing other than an interface to the accelerometer, with no orientation policy in between. This is why mce adds nothing that iio-sensor-proxy dose not provide and therefore becomes suplus to requirements also note that iio-sensor-proxy dose not provide raw accelerometer data, it provides device roataion state (eg prortait, landscape not x,y,z m/s^2) |
mce chaning the poling rate on iio interface would cause all clients to that interface to get data at a different rate. |
wait, what other accelerometer clients we have besides iio-sensors? also, if mce talks to iio-sensors, then it is iio-sensor's job to control the polling (!?!) speed. And how is that different if the user is h-d and not mce. mce reporting n900 on stand as landscape is correct and very useful and this is applicable for other devices as well - like I have a tablet here with a case that have a stand (and a keyboard). Keep in mind that (at least on n900) enabling the accelerometer increases the power usage significantly, so I would really like to have only one 'proxy' between applications and HW. A proxy which is aware it runs on a battery operated device, which I doubt is the case for iio-sensors. So, the 'policy' about when to enable and how often to poll and what state to report should be in mce, not in h-d or in the other applications. |
in current leste we have mce and any client that wants raw x,y,z data in parallel using the kernel driver directly (because mce dose not provide this) and mce affects the polling rate behind everyones back, this is bad. with iio-sensor-proxy we have the same thing except that i iio-sensor-proxy uses only 1 polling rate, and closes the interface when none is suscribed to the iio-sensor-proxy dbus interface. Since, again, iio-sensor-proxy dose not provide raw x,y,z data any application that wants it will need to use the kernel driver directly. This senario is only mildly more predictable than the current behavior because only one poling rate is used and the kernel idles the chip when the last client stops using it. its still bad. the good news is that there is a branch of iio-sensor-proxy that also provides raw x,y,z data from the accelerometer next to all the other things iio-sensor-proxy provides (light lux and proximity). hildon could take the stand into considoration just like it dose the keyboard. the current situation makes no sense for sure, the stand is handled in mce and everything else is handled in hildon "policy" wise. i gues handling everything in mce also makes some sense. but since hildon already dose most of this while mce dose almost nothing and this makes hildon independant of mce moving everything into hildon makes the most sense. |
also note that the above polling problems dident exist in fremantle because the evdev accel interface was used. this interface however is declared obsolete by upstream and no current or future accelerometer driver will ever use it again. |
Add iio-sensor-proxy backend used preferentially to mce. mce is still used when iio-sensor-proxy is not available.
Not tested in a fully functional manner, as portrait mode results in a black screen on my device (droid 4), only tested that the signal is received correctly.