Screen orientation and backlight sensing for the Nexus 7

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Screen orientation and backlight sensing for the Nexus 7

Jani Monoses-2
Hello,

There's a blueprint about sensor related tasks on the Nexus 7

https://blueprints.launchpad.net/ubuntu/+spec/desktop-r-arm-input-sensor-
drivers

I'd like your input regarding the best place in our stack such features
should be exposed to other software and to users.

There's a small test app written in Go that can be run on the Nexus 7
that will orient the screen and set brightness depending on tablet
position and ambient light respectively.

https://code.launchpad.net/~jani/+junk/nexus
On the Nexus 7 : Install golang, go build nexus.go, sudo ./nexus -v or
download the prebuilt static binary from http://people.canonical.com/
~jani/a

However, to prevent adding yet another daemon with non-negligible memory
footprint (~1.8M), I think behavior and various thresholds should be
configurable in the Control Center GUI and the functionality added to one
or several of the existing daemons written in C.
AFAIK there are no generic kernel and userland APIs for such sensors,
save for device specific sysfs knobs so this may be a good opportunity to
think about how to expose such hardware features in a device independent
manner in the future.

Thoughts?

thanks
Jani


--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Oliver Grawert
hi,
Am Donnerstag, den 17.01.2013, 16:04 +0000 schrieb Jani Monoses:

> Hello,
>
> There's a blueprint about sensor related tasks on the Nexus 7
>
> https://blueprints.launchpad.net/ubuntu/+spec/desktop-r-arm-input-sensor-
> drivers
>
> I'd like your input regarding the best place in our stack such features
> should be exposed to other software and to users.
>
> There's a small test app written in Go that can be run on the Nexus 7
> that will orient the screen and set brightness depending on tablet
> position and ambient light respectively.
>
> https://code.launchpad.net/~jani/+junk/nexus
> On the Nexus 7 : Install golang, go build nexus.go, sudo ./nexus -v or
> download the prebuilt static binary from http://people.canonical.com/
> ~jani/a
this is just awesome ... !!!

>
> However, to prevent adding yet another daemon with non-negligible memory
> footprint (~1.8M), I think behavior and various thresholds should be
> configurable in the Control Center GUI and the functionality added to one
> or several of the existing daemons written in C.
> AFAIK there are no generic kernel and userland APIs for such sensors,
> save for device specific sysfs knobs so this may be a good opportunity to
> think about how to expose such hardware features in a device independent
> manner in the future.
>
> Thoughts?
while i think that ambient light detection and rotation should be
separated and implemented as gnome-settings-daemon modules and that we
should additionally have something event driven from the kernel side
instead of polling, i also think that this is quite a huge
implementation task and feature freeze isn't so far out anymore ...

i think we should go with the standalone daemon for the moment, add some
cmdline/conffile ways for configuration (feature on/off at least) and
work out proper blueprints for 13.10. that way we have the function in
place asap and can collect and fix bugs for it in 13.04, this will make
sure that we have the underlying bits fully in place for 13.10 and can
concentrate on the split into modules and UI elements...

the size is indeed a bit concerning and it would be better to just have
it in plain C unless the go binaries can be made smaller

ciao
        oli

--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Bryce Harrington-5
On Fri, Jan 18, 2013 at 12:36:00PM +0100, Oliver Grawert wrote:

> > However, to prevent adding yet another daemon with non-negligible memory
> > footprint (~1.8M), I think behavior and various thresholds should be
> > configurable in the Control Center GUI and the functionality added to one
> > or several of the existing daemons written in C.
> > AFAIK there are no generic kernel and userland APIs for such sensors,
> > save for device specific sysfs knobs so this may be a good opportunity to
> > think about how to expose such hardware features in a device independent
> > manner in the future.
> >
> > Thoughts?
>
> while i think that ambient light detection and rotation should be
> separated and implemented as gnome-settings-daemon modules and that we
> should additionally have something event driven from the kernel side
> instead of polling, i also think that this is quite a huge
> implementation task and feature freeze isn't so far out anymore ...

Yes, getting things accepted into g-s-d upstream might be too time
consuming to make it by FF.  I'm betting this is not something we'd want
to carry permanently as a distro patch, so we'd want to get it upstream
at some point.

> i think we should go with the standalone daemon for the moment, add some
> cmdline/conffile ways for configuration (feature on/off at least) and
> work out proper blueprints for 13.10. that way we have the function in
> place asap and can collect and fix bugs for it in 13.04, this will make
> sure that we have the underlying bits fully in place for 13.10 and can
> concentrate on the split into modules and UI elements...
>
> the size is indeed a bit concerning and it would be better to just have
> it in plain C unless the go binaries can be made smaller

Would bash or python be ok?  I'm guessing this isn't performance
critical, and it looks like everything in nexus.go could be done in
either of those languages.

Btw, I've put the xrotate script into the xdiagnose package, so we can
drop it from the nexus7 image.  Work on generalizing it for other
devices is ongoing, and I'd be open to keeping it either in bash or
rewriting it into python.

Bryce




--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Oliver Grawert
hi,
Am Freitag, den 18.01.2013, 18:37 -0800 schrieb Bryce Harrington:

> > i think we should go with the standalone daemon for the moment, add some
> > cmdline/conffile ways for configuration (feature on/off at least) and
> > work out proper blueprints for 13.10. that way we have the function in
> > place asap and can collect and fix bugs for it in 13.04, this will make
> > sure that we have the underlying bits fully in place for 13.10 and can
> > concentrate on the split into modules and UI elements...
> >
> > the size is indeed a bit concerning and it would be better to just have
> > it in plain C unless the go binaries can be made smaller
>
> Would bash or python be ok?  I'm guessing this isn't performance
> critical, and it looks like everything in nexus.go could be done in
> either of those languages.
sure, that would be perfect

>
> Btw, I've put the xrotate script into the xdiagnose package, so we can
> drop it from the nexus7 image.  
thanks ! i'll drop it with the next upload

ciao
        oli

--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Martin Pitt-4
In reply to this post by Bryce Harrington-5
Bryce Harrington [2013-01-18 18:37 -0800]:
> Would bash or python be ok?  I'm guessing this isn't performance
> critical, and it looks like everything in nexus.go could be done in
> either of those languages.

Can we pretty please stop writing long-running daemons in Python? As
much as I like it for applications, its startup cost, increased memory
requirements, and comparatively low performance/high battery usage
behaviour for such tasks which involve polling many times a second
make Python the wrong choice for writing daemons on mobile platforms.

Martin
--
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Robert Park
In reply to this post by Jani Monoses-2
Agreed. We are trying really hard to make Friends work as an event-based daemon that only runs when it is responding to something, rather than being a long-running daemon. And we're profiling the hell out of it so that it's not such a burden when it is running.

But if I had known back when I was hired that mobile was such a huge focus, I would have advocated for rewriting it in vala, not python.

Martin Pitt <[hidden email]> wrote:

>Bryce Harrington [2013-01-18 18:37 -0800]:
>> Would bash or python be ok?  I'm guessing this isn't performance
>> critical, and it looks like everything in nexus.go could be done in
>> either of those languages.
>
>Can we pretty please stop writing long-running daemons in Python? As
>much as I like it for applications, its startup cost, increased memory
>requirements, and comparatively low performance/high battery usage
>behaviour for such tasks which involve polling many times a second
>make Python the wrong choice for writing daemons on mobile platforms.
>
>Martin
>--
>Martin Pitt                        | http://www.piware.de
>Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
>
>--
>ubuntu-devel mailing list
>[hidden email]
>Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel
--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Oliver Grawert
In reply to this post by Jani Monoses-2
hi,

i just uploaded http://paste.ubuntu.com/1555763/ which should do for
now, it would be great if someone could re-implement /usr/bin/acceld in
actual C .. polling like that from a shell script adds some CPU overhead
that we could avoid ...

feel free to fix up any glitches you see with the scripts

ciao
        oli

--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel

signature.asc (205 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Jani Monoses-2
On Mon, 21 Jan 2013 17:00:00 +0100, Oliver Grawert wrote:

> hi,
>
> i just uploaded http://paste.ubuntu.com/1555763/ which should do for
> now, it would be great if someone could re-implement /usr/bin/acceld in
> actual C .. polling like that from a shell script adds some CPU overhead
> that we could avoid ...

I am looking into what it takes to add this functionality to gnome-
settings-daemon that already has support for screen orientation and a
certain type of accelerometer. If that does not work out without being
too intrusive we should look into making this into C as you suggest.

Jani


--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel
Reply | Threaded
Open this post in threaded view
|

Re: Screen orientation and backlight sensing for the Nexus 7

Jani Monoses-2
On Mon, 21 Jan 2013 19:22:46 +0000, Jani Monoses wrote:

> On Mon, 21 Jan 2013 17:00:00 +0100, Oliver Grawert wrote:
>
>> hi,
>>
>> i just uploaded http://paste.ubuntu.com/1555763/ which should do for
>> now, it would be great if someone could re-implement /usr/bin/acceld in
>> actual C .. polling like that from a shell script adds some CPU
>> overhead that we could avoid ...
>
> I am looking into what it takes to add this functionality to gnome-
> settings-daemon that already has support for screen orientation and a
> certain type of accelerometer. If that does not work out without being
> too intrusive we should look into making this into C as you suggest.

This is the current status. I'll probably upload the g-s-d equivalent of
the shell script today.

https://bugs.launchpad.net/ubuntu-nexus7/+bug/1110360/comments/2

Jani


--
ubuntu-devel mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel