![]() |
2010-03-20
, 03:09
|
|
Posts: 664 |
Thanked: 160 times |
Joined on Jul 2008
@ Australia
|
#31
|
![]() |
2010-03-20
, 08:11
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#32
|
Coz all I'm doing now is reading the files from /sys/class/hwmon/hwmon1/device/ namely adc0 and adc1 every 1 second and as they return numeric values, I'm just using that to turn speakers on/off. Can someone plz tell what they are actually, coz they are giving random results in different scenarios like I mentioned above and from what I found in the web, it is suppose to give proximity value.
The Following User Says Thank You to qwerty12 For This Useful Post: | ||
![]() |
2010-03-20
, 09:05
|
|
Posts: 154 |
Thanked: 124 times |
Joined on Mar 2007
|
#33
|
![]() |
2010-03-21
, 02:01
|
|
Posts: 664 |
Thanked: 160 times |
Joined on Jul 2008
@ Australia
|
#34
|
That would be due to those being the values for the light sensor... You want the file "/sys/bus/platform/devices/proximity/state" which can have a state of "open" or "closed".
P.S. GIOChannels provide a nicer alternative to watching files.
int fd = open("/sys/bus/platform/devices/proximity/state", O_RDONLY, O_NONBLOCK, O_NOCTTY); GIOChannel *channel = g_io_channel_unix_new(fd); g_io_add_watch(channel, G_IO_IN | G_IO_PRI, (GIOFunc)readState, NULL); .......... gboolean readState(GIOChannel *channel, GIOCondition cond, gpointer data){ gchar *state; gsize size; GIOStatus ret = g_io_channel_read_line(channel, &state, &size, NULL, NULL); if (ret != G_IO_STATUS_ERROR){ printf("STATE: %s", state); if (strcmp(state, "open") == 0){ ........... } else if (strcmp(state, "closed") == 0){ ........... } g_free(state); }else return FALSE; return TRUE; }
![]() |
2010-03-21
, 07:19
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#35
|
Thanks for the info but I just couldn't make use of GIOChannel. Here's how I did:
Any help would be great. ThanksCode:int fd = open("/sys/bus/platform/devices/proximity/state", O_RDONLY, O_NONBLOCK, O_NOCTTY); GIOChannel *channel = g_io_channel_unix_new(fd); g_io_add_watch(channel, G_IO_IN | G_IO_PRI, (GIOFunc)readState, NULL); .......... gboolean readState(GIOChannel *channel, GIOCondition cond, gpointer data){ gchar *state; gsize size; GIOStatus ret = g_io_channel_read_line(channel, &state, &size, NULL, NULL); if (ret != G_IO_STATUS_ERROR){ printf("STATE: %s", state); if (strcmp(state, "open") == 0){ ........... } else if (strcmp(state, "closed") == 0){ ........... } g_free(state); }else return FALSE; return TRUE; }
The Following User Says Thank You to qwerty12 For This Useful Post: | ||
![]() |
2010-03-22
, 01:21
|
|
Posts: 664 |
Thanked: 160 times |
Joined on Jul 2008
@ Australia
|
#36
|
The Following User Says Thank You to jaeezzy For This Useful Post: | ||
![]() |
2010-03-22
, 06:30
|
|
Posts: 664 |
Thanked: 160 times |
Joined on Jul 2008
@ Australia
|
#37
|
![]() |
2010-03-22
, 10:32
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#38
|
ok I think I've messed up couple of things in extras-devel repo as it's says dependency missing and I've no idea why and it can't be downloaded (I'm just noticing it). I checked some other packages and in every of them its "libosso1 (>=2.23)" but how come mine has "libosso1 (>=2.26)" and its in this where the problem lies. I'm using scratchbox only nothing else and in control file in Depends its ${shlibsepends}. Any help would be great however installing the provided deb file in the #1 post goes well. Thanks
![]() |
2010-03-22
, 11:18
|
|
Posts: 664 |
Thanked: 160 times |
Joined on Jul 2008
@ Australia
|
#39
|
https://bugs.maemo.org/show_bug.cgi?id=9070#c3 - the first paragraph there should sum it up.
![]() |
2010-03-22
, 11:21
|
|
Posts: 4,274 |
Thanked: 5,358 times |
Joined on Sep 2007
@ Looking at y'all and sighing
|
#40
|