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

From: Daniel M German dmg at uvic.ca
Date: Fri Oct 19 01:22:46 EEST 2007
 Kemal Hadimli twisted the bytes to say:


 Kemal> Here's how I did it in Python, took some testing.
 Kemal> https://www.guardiani.us/projects/kagu/changeset/670

 Kemal> The SVN Kagu now pauses playback if the headphones are disconnected.

A big thank you! Kemal. I have download it and it works!

I also like the remote playing feature using command line
options.


--daniel



 Kemal> On 10/18/07, Austin Che <list-maemo at austinche.name> wrote:
 >> 
 >> > g_io_add_watch() if you're using glib, inotify if you're not (man
 >> > inotify(7)).
 >> >
 >> > Regards: David
 >> 
 >> Thanks for the suggestion but I can't get this to work. If I use:
 >> GIOChannel *io = g_io_channel_new_file("/sys/devices/platform/gpio-switch/headphone/state", "r", NULL);
 >> g_io_add_watch(io, G_IO_IN|G_IO_OUT|G_IO_PRI|G_IO_ERR|G_IO_HUP|G_IO_NVAL, test_io_watch, NULL);
 >> 
 >> and I print out the GIOCondition in test_io_watch, I get a
 >> constant stream (number 10) with nothing extra seen when the headphone
 >> is plugged in or out. Using individual conditions leads to either
 >> the function never being triggered or always being triggered. What
 >> should I be watching for?
 >> _______________________________________________
 >> maemo-developers mailing list
 >> maemo-developers at maemo.org
 >> https://lists.maemo.org/mailman/listinfo/maemo-developers
 >> 


 Kemal> -- 
 Kemal> Kemal


-- 
--
Daniel M. German                  
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

More information about the maemo-developers mailing list