PDA

View Full Version : Maemo 5 proximity sensor API?


zolakt
12-22-2009, 12:03 PM
Hi,

can anyone tell me where can I find some details about programming proximity (and other) sensors?
I searched the development section, but found nothing, except it is a part of "Mode Control Entity(MCE)".

More specifically, I'm trying to find out does the proximity sensor keep a value of measured distance, and how far can it measure.

Thanks in advance.

sampppa
12-22-2009, 12:13 PM
You can read proximity sensor from sysfs entry:

cat /sys/devices/platform/gpio-switch/proximity/state

but this only gives you 2 states, "open" and "closed"

kwotski
12-22-2009, 01:17 PM
Might be worth a look:

http://talk.maemo.org/showthread.php?p=436236#post436236

@sampppa - what other states would you expect, like how proximate, in centimeters?

zolakt
12-22-2009, 01:19 PM
Thanks sampppa,
but that's not what I'm looking for.
I really need the distance, not just the state.

@kwotski - it's not a state, but "how proximate in centimeters" is what I'm looking for. Thanks for the link, but it doesn't solve my problem.

kwotski
12-22-2009, 01:31 PM
zolakt - are you sure the device actually does that? From what I can see, it's just a two-state switch, open and closed are all you're going to get.

I'd love to be proved wrong though!

zolakt
12-22-2009, 01:36 PM
I'm not sure what it does.
But if it's a two state thing, it's a touch sensor.
It has nothing to do with proximity.

hopbeat
12-22-2009, 01:38 PM
@zolakt, being able to detect distance does not have anything to do with being proximity sensor.

Wiki is your friend (http://en.wikipedia.org/wiki/Proximity_sensor) :)

kwotski
12-22-2009, 01:39 PM
Well, I think it detects if something is very proximate (near) or if it isn't, so the two states :) But I could be wrong. I'd be very pleased to be wrong! Please prove me wrong! :)

zolakt
12-22-2009, 01:53 PM
@hopbeat - Unfortunately you are right. But it also doesn't rule out the possibility of measuring.
"Some sensors have adjustments of the nominal range or means to report a graduated detection distance."

I seriously doubt that this one has this ability, which is a huugggeee disappointment. A lot of very interesting things could be done with it.

But, like kwotski says, someone please prove me wrong.

Btw. do I need to contact Nokia tech support for this, or are there some of them on this forum. I think they are the only ones who could answer this. Everything else is just speculation.

sampppa
12-22-2009, 01:59 PM
I dont think you can get that info out in centimeters. It detects if something is "near" the sensor. This is used for example to detect if the phone is near the ear to shutdown display for power saving. (and also to know if device is in pocket?)

hqh
12-22-2009, 02:17 PM
The proximity sensor is connected to a GPIO like other switches. You can't get readings other than 1 and 0.