[maemo-developers] how to detect if the headphones are plugged?

From: David Weinehall david.weinehall at nokia.com
Date: Thu Oct 18 03:38:48 EEST 2007
On ons, 2007-10-17 at 16:15 -0400, ext Austin Che wrote:
> Daniel M German <dmg at uvic.ca> wrote:
>     
> > is there a way to detect if the headphones are plugged?
> >
> > I am irritated that music playing software does not pause when the
> > headphones are removed (like the ipod) and would like to write a patch
> > to make it an option.
> 
> ~ $ cat /sys/devices/platform/gpio-switch/headphone/state 
> connected
> ~ $ cat /sys/devices/platform/gpio-switch/headphone/state 
> disconnected
> 
>     I'd also be interested to know if there's a way to be notified
>     about this rather than just polling.

g_io_add_watch() if you're using glib, inotify if you're not (man
inotify(7)).


Regards: David

More information about the maemo-developers mailing list