maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Multimedia (https://talk.maemo.org/forumdisplay.php?f=32)
-   -   [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks. (https://talk.maemo.org/showthread.php?t=21182)

cb22 2010-05-15 13:38

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Awesome work, might I ask how you managed to figure it out? I was searching high and low for what the phone app did, but didn't manage to find anything... Actually, I think I even recall taking a snapshot using alsa-ctl, then restoring it after hanging up, but I still didn't notice a change.

qwerty12 2010-05-15 13:52

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Well, I figured it was time to come good on my promise so I grabbed the kernel source and started reading Nokia's Kernel Guide.
Anyway, after making unsuccessful modifications to drivers/misc/nokia-av.c and sound/soc/rx51.c to try and force it to enable the button even if "a normal pair of headphones" are plugged in (my understanding of electronics is even worse than my coding skills), I realised that having the mic enabled along with the button are mutually exclusive (this "bias" stuff).

Since my attempts at hackihg the driver failed, I looked at what was actually doing the disabling on the users' side: the Policy system. Did a grep in /usr/share/policy for "bias" and found a text file that could be exited. Made disabling the bias the same thing as enabling it and rebooted it in hope.

rajil.s 2010-05-16 10:22

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by qwerty12 (Post 659580)

I will be uploading an "enabler" package to extras-devel later on today along with a quick daemon that pauses/plays a track in the Media Player. Ultimately, if thp allows it, I'd like to get it into headphoned but thp uses libdbus and I like dbus-glib...

any luck with the 'enabler' package?

Cheers

qwerty12 2010-05-16 10:29

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by rajil.s (Post 660609)
any luck with the 'enabler' package?

Cheers

It's in -devel. It's rather useless without anything utilizing it, however, so I'm still in the process of porting of Headset Control to C (MAFW-only ATM) :)

tym81 2010-05-16 18:06

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by qwerty12 (Post 659580)
Oh, yes, baby; you bet your *** there's progress!

Here's how to enable it:
Open the file /usr/share/policy/etc/current/alsaped.conf and replace "jackbias-off = jack-bias: off" with "jackbias-off = jack-bias: on"; reboot and watch the System bus.

I will be uploading an "enabler" package to extras-devel later on today along with a quick daemon that pauses/plays a track in the Media Player. Ultimately, if thp allows it, I'd like to get it into headphoned but thp uses libdbus and I like dbus-glib...

Hello,
I have a Maemo 5/PR1.1 :
Code:

Nokia-N900-51-1:~# uname -a
Linux Nokia-N900-51-1 2.6.28.10power-omap1 #1 PREEMPT Thu Apr 15 00:30:53 EEST 2010 armv7l unknown

I have not found "bias" in "/usr/share/policy" :confused:

I have just add to /usr/share/policy/etc/current/alsaped.conf this line :

Code:

jackbias-off = jack-bias: on
and reboot, but the dmesg or dbus-monitor command don't detect headphone buttons.

Any idea ?

Thanks in advance.

tym.

qwerty12 2010-05-17 17:46

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by tym81 (Post 661147)
I have not found "bias" in "/usr/share/policy" :confused:

Hello,

You sure? I have it here and the only thing that differs is that I'm using LPR 1.2.

Anyway, just pushed Headset Control 0.2 to Extras-devel.

[Insert standard, usual Extras-devel warning]

By default - when pressing the button - it tells MAFW to pause/play the track.
If you set the GConf key /apps/headset-control/next-mode to true, a press will result in it skipping to the next track in whatever state the Media Player is currently in (Paused/Stopped/Playing etc.)

Implementing a "if button held" functionality would've been nice, but the only time a signal gets emitted is when the button is depressed.
A "delay between presses" functionality would've also been nice, but it seems the nokia-av module enforces a mandatory delay before you can press the button again. It's too long, IMO, for any sort of delay in the program for sending different commands.

Also, because the ability for a signal to be emitted when pressing the signal was intermittent, Headset Control will force the button to be enabled (if a Nokia headset is plugged in, of course) on startup and 5 seconds after a call is ended. (Code snippet here: http://slexy.org/view/s21Wl6YqxI)

Best regards.

MohammadAG 2010-05-17 18:04

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by qwerty12 (Post 662802)
Hello,

You sure? I have it here and the only thing that differs is that I'm using LPR 1.2.

Anyway, just pushed Headset Control 0.2 to Extras-devel.

[Insert standard, usual Extras-devel warning]

By default - when pressing the button - it tells MAFW to pause/play the track.
If you set the GConf key /apps/headset-control/next-mode to true, a press will result in it skipping to the next track in whatever state the Media Player is currently in (Paused/Stopped/Playing etc.)

Implementing a "if button held" functionality would've been nice, but the only time a signal gets emitted is when the button is depressed.
A "delay between presses" functionality would've also been nice, but it seems the nokia-av module enforces a mandatory delay before you can press the button again. It's too long, IMO, for any sort of delay in the program for sending different commands.

Also, because the ability for a signal to be emitted when pressing the signal was intermittent, Headset Control will force the button to be enabled (if a Nokia headset is plugged in, of course) on startup and 5 seconds after a call is ended. (Code snippet here: http://slexy.org/view/s21Wl6YqxI)

Best regards.

Not working here, dmesg doesn't show anything about a button press.
Code:

[ 3669.544677] wlan0: no IPv6 routers present
[ 4989.052886] headphone (GPIO 177) is now connected
[ 4990.585937] input: headset button as /class/input/input4
[ 4990.896972] kb_lock (GPIO 113) is now closed
[ 4991.083923] kb_lock (GPIO 113) is now open
[ 4992.263610] slide (GPIO 71) is now open
[ 5003.388519] slide (GPIO 71) is now closed
[ 5076.966796] headphone (GPIO 177) is now disconnected
[ 5084.677673] headphone (GPIO 177) is now connected
[ 5085.795196] input: headset button as /class/input/input5
MohammadAG-N900:~#


qwerty12 2010-05-17 18:26

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by MohammadAG (Post 662829)
Not working here, dmesg doesn't show anything about a button press.
Code:

[ 3669.544677] wlan0: no IPv6 routers present
[ 4989.052886] headphone (GPIO 177) is now connected
[ 4990.585937] input: headset button as /class/input/input4
[ 4990.896972] kb_lock (GPIO 113) is now closed
[ 4991.083923] kb_lock (GPIO 113) is now open
[ 4992.263610] slide (GPIO 71) is now open
[ 5003.388519] slide (GPIO 71) is now closed
[ 5076.966796] headphone (GPIO 177) is now disconnected
[ 5084.677673] headphone (GPIO 177) is now connected
[ 5085.795196] input: headset button as /class/input/input5
MohammadAG-N900:~#


What about "dbus-monitor --system"?
Also, what does "cat /sys/devices/platform/nokia-av/type" return? With the HS-48's I have, it returns 4.
Is it actually running (sorry, I'm not used to writing Upstart scripts)?
If you have ltrace installed, you can check what it's doing - a press of the headset button should lead it into the function that gets called when the button gets pressed; you should see it calling "mafw_renderer_*".
If you have syslog running, messages emited by the object will be sent there.
Also, you may need to start playing from the desktop widget initially to populate the playlist (I don't know enough about MAFW to attempt it myself, alas).

Finally, if it still doesn't work, maybe Nokia added the jackbias stuff in PR 1.2 :confused:

gazza_d 2010-05-17 18:35

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by qwerty12 (Post 660617)
It's in -devel. It's rather useless without anything utilizing it, however, so I'm still in the process of porting of Headset Control to C (MAFW-only ATM) :)

MAFW-only? I don't suppose that means OS2008 at some point does it? Or have I got more chance of a date with Paris??

not expecting anything btw!

qwerty12 2010-05-17 18:37

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Quote:

Originally Posted by gazza_d (Post 662879)
MAFW-only? I don't suppose that means OS2008 at some point does it? Or have I got more chance of a date with Paris??

not expecting anything btw!

No, but what's wrong with the deb in #1?

On OS2008, it's only possible to pause/play tracks unless you work for Nokia...


All times are GMT. The time now is 00:47.

vBulletin® Version 3.8.8