Active Topics

 



Notices


Reply
Thread Tools
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#31
Originally Posted by hawaii View Post
Interested in implementing tapping the power button, to disconnect the call instead of the camera button (which works brilliantly, by the way).

If not, I can localize and make a personal patch.
Ya, that would be fine but the thing is when pressing power button it pops up a menu and I don't know how I can cancel that and only do what I want. If you can tell me how, I can implement that and also I'm working on proximity sensor coz the one I'm using at the moment isn't giving stable result - meaning in the day time, night and night time with the room lights on. Maybe because I chose the shorthand (easy way) Can anyone plz check this one and report me back?. 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.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#32
Originally Posted by jaeezzy View Post
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.
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.

Last edited by qwerty12; 2010-03-20 at 08:15. Reason: 'l', even
 

The Following User Says Thank You to qwerty12 For This Useful Post:
pillar's Avatar
Posts: 154 | Thanked: 124 times | Joined on Mar 2007
#33
Shortcutd uses proximityd which I think could be used for easy proximity reading. Maybe it could be useful here as well?
 
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#34
Originally Posted by qwerty12 View Post
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.
Thanks for the info but I just couldn't make use of GIOChannel. Here's how I did:

Code:
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;
}
Any help would be great. Thanks
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#35
Originally Posted by jaeezzy View Post
Thanks for the info but I just couldn't make use of GIOChannel. Here's how I did:

Code:
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;
}
Any help would be great. Thanks
I'd be lying if I said I knew, so all I can do is point you to headphoned: http://repo.or.cz/w/headphoned.git/b...dphoned.c#l280
 

The Following User Says Thank You to qwerty12 For This Useful Post:
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#36
I've just uploaded the current version 0.1-5 to both devel and my #1 post. Its more matured now As, always all info are in that same post.
 

The Following User Says Thank You to jaeezzy For This Useful Post:
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#37
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
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#38
Originally Posted by jaeezzy View Post
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
https://bugs.maemo.org/show_bug.cgi?id=9070#c3 - the first paragraph there should sum it up.
 
jaeezzy's Avatar
Posts: 664 | Thanked: 160 times | Joined on Jul 2008 @ Australia
#39
Originally Posted by qwerty12 View Post
https://bugs.maemo.org/show_bug.cgi?id=9070#c3 - the first paragraph there should sum it up.
Thanks for the info and does that mean I've to wait until the release of PR1.2 to be able to upload downloadable package in extras-* repo?
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#40
Originally Posted by jaeezzy View Post
Thanks for the info and does that mean I've to wait until the release of PR1.2 to be able to upload downloadable package in extras-* repo?
Nah, you should be OK -- you don't appear to depend on any components that are new to PR 1.1.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 08:17.