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)

OVK 2010-01-19 12:05

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

Originally Posted by Bec (Post 481735)
Honestly, no. What was working in symbian programs like "MagicKey" was probably the dependency on a dbus-like feature in symbian.

Simply expecting an input in dbus doesn't work without a special application, like in our case the phone application.

But the most authorized person on this matter, is obviously qwerty12 (see first post) so you should ask him.

Did you check the headphoned app that I linked? It is for Maemo 5 and already sends one command (pause) to Mediaplayer.

andrei1089 2010-01-19 12:24

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

Originally Posted by OVK (Post 481743)
Did you check the headphoned app that I linked? It is for Maemo 5 and already sends one command (pause) to Mediaplayer.

The problem is not to send a pause message to Mediaplayer, but to catch the signal emitted when the button on the headset is pressed.

OVK 2010-01-19 12:31

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

Originally Posted by andrei1089 (Post 481776)
The problem is not to send a pause message to Mediaplayer, but to catch the signal emitted when the button on the headset is pressed.

Yes. I was just thinking that because headphoned is already listening to the headphone state it could probably also be used (after some modifications) also to see if some signals are emitted from headphones.

If I am correct the phone app is listening (or the incoming/outgoing call awakes something that is listening) to the signals from the AV connector (it has to be, otherwise the call ending button would not work). I think it should be possible to make also other apps to sense the button presses. I thought that headphoned would have been a logical place to start the investigations/additions.

I asked thp, the author of the headphoned, in other thread if I have understood his app correctly.

OVK 2010-01-19 13:31

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
OK, I thought this a bit more and I think that I probably should clarify my thinking so that there is no misunderstandings.

As I see this, there are two things that are needed:
1. Button presses need to sensed by N900
2. Presses need to be translated to commands for Mediaplayer

For the requirement number 1:
As we now from dbus-monitor, in the normal state N900 does not sense the button presses from the headset. However, the call can be ended by the button press of the default headset. Now: what is awake and listening to the AV plug in this state? What awakes it (phone app or just incoming/outgoing call) How do we awake it without turning on the Phone app?

For the requirement number 2:
The headphoned also sends commands to Mediaplayer. I think that it would be relatively easy to expand the functionality to also send other commands. First we just need to find out what kind of signals different headsets send to N900. If I am correct, this could be probably found out with dbus-monitor when we first find out how to make the N900 aware of the button presses.

Does this make any sense to you more experienced users? Is there something that simply just cannot be done for some reason (technical limitation, I am suggesting wrong methods...). :confused:

After all, I am not a programmer, just a typical end user. :o

thp 2010-01-19 17:35

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
At least on Maemo 5 the headset button was exposed as a hal input device at /org/freedesktop/Hal/devices/platform_retu_headset_logicaldev_input

Check out the Panucci source for how it's used there (search for headset_button):

http://nikosapi.org/git/panucci/tree...usinterface.py
http://nikosapi.org/git/panucci/tree...cci/panucci.py

Edit: After reading the whole thread, it seems like this is not working anymore on the N900..

Arif 2010-01-19 17:40

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
I haven't read the whole thread....but is it possible to write a driver for the remote included with the N95 ? :p

Bec 2010-01-26 17:51

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
We would like to address any headset model. Unfortunately receiving the signal from the headset is quite complicated.

Vote for this (see the link in my signature) to give this request more priority for developing.

lstoll 2010-01-28 19:51

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Judging by Bec's dumps and having a quick look at the original code, it looks like the HID device for the headset changed from platform_retu_headset_logicaldev_input on pre N900 to computer_logicaldev_input_1 , which would stop the original code working.

Running something like this python script hacked from the code in kagu[1] would confirm this change, and what to listen for in an updated version of headset-control, or some new app: http://gist.github.com/289070

I also don't see any button messages in the dbus-monitor dump, however I'm not sure how dbus works - maybe items like this which are 'watched' won't show there?

Note this is just a theory, and untested - I don't have access to a N900 or know anything about dbus, just interested in buying one and concerned about getting the button to work with the media player!

([1] http://kagumedia.com/projects/kagu/b.../kagu/maemo.py)

andrei1089 2010-01-29 10:24

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

Originally Posted by lstoll (Post 499924)
Judging by Bec's dumps and having a quick look at the original code, it looks like the HID device for the headset changed from platform_retu_headset_logicaldev_input on pre N900 to computer_logicaldev_input_1 , which would stop the original code working.

Running something like this python script hacked from the code in kagu[1] would confirm this change, and what to listen for in an updated version of headset-control, or some new app: http://gist.github.com/289070

I also don't see any button messages in the dbus-monitor dump, however I'm not sure how dbus works - maybe items like this which are 'watched' won't show there?

Note this is just a theory, and untested - I don't have access to a N900 or know anything about dbus, just interested in buying one and concerned about getting the button to work with the media player!

([1] http://kagumedia.com/projects/kagu/b.../kagu/maemo.py)

I've tried something similar with your code but didn't work. In fact it worked only during a phone call, so the phone application somehow activates the button.

lstoll 2010-01-29 12:43

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

Originally Posted by andrei1089 (Post 500662)
I've tried something similar with your code but didn't work. In fact it worked only during a phone call, so the phone application somehow activates the button.

Interesting, so you received the click messages on dbus when the phone app was running? Did you have to be in a call for them to show up, or was just the app running sufficient?

Also, can anyone confirm if the button works to end skype and gtalk calls as well?

Trying to work out which part of the comm stack this is all happening..

Oh and lastly, what package does the phone ui app belong to? I've poked around in the repository an managed to find the translations, but not the binary itself.

Maybe I should just go down and buy one, will make this much easier.

andrei1089 2010-01-29 13:48

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

Originally Posted by lstoll (Post 500822)
Interesting, so you received the click messages on dbus when the phone app was running? Did you have to be in a call for them to show up, or was just the app running sufficient?

Also, can anyone confirm if the button works to end skype and gtalk calls as well?

Trying to work out which part of the comm stack this is all happening..

Oh and lastly, what package does the phone ui app belong to? I've poked around in the repository an managed to find the translations, but not the binary itself.

Maybe I should just go down and buy one, will make this much easier.

Only during a phone call. Haven't tried with a Skype call.

andrei1089 2010-02-01 13:43

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
I've just tried with a Skype call, the signal is emitted.

qwerty12 2010-02-09 12:47

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
This is due to Nokia's policy system through OHM. Not much information is available on it and Nokia's plugins implementing the policies are closed source (as usual). The phone app switches the policy to phone mode which allows the D-Bus signal of the button being pressed to be broadcast and, AFAIK, blocks other sources of sound etc. so it wouldn't make sense to have the "phone" policy always activated...

All that I know about it is, policy changes are broadcast over D-Bus; some of the plugins have configuration settings in /usr/share/policy and the plugins themselves are closed source so if they can't be configured to allow broadcasting of the ButtonPressed signal all the time, we're SOL. Personally, I'd like to know if there is a sysfs entry that is changed when the button is pressed so that we can do what thp did: monitor the file. This way, we avoid ****ing with the undocumented and closed-source components of the Policy system.

OK, /usr/lib/ohm/libohm_buttons.so is the library responsible, AFAIK.


Perhaps not: "stop ohmd" doesn't result in anything... Still, I'd like to know if it has a sysfs entry :)

El Amir 2010-03-01 04:34

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Does this mean that THIS is fake advertising ? :confused:

Bec 2010-03-03 16:07

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

shadowjk 2010-03-04 19:04

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
I have AD-54 as in the above ebay ad. The headphone passthrough works, and it gets recognized as headset instead of headphones. None of the buttons work. I'd assume the mic in ad-54 works but I have not tested.

gazza_d 2010-03-09 22:55

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Don't suppose anyone has managed to get any information on or if the buttons on an AD-54 generate any useable signals on Maemo especially OS2008.

I've managed to trash my original headset which the button did work on, and am now going to use a spare AD-54. I can pause using headphoned, but unplugging is a bit clunky.

If anyone has any ideas, I am happy to test and have a play about. dbus-monitor, dbus-monitor --system, and dmesg all do not seem to register anything except plug/unplug events

sygys 2010-03-30 10:47

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
i contacted the maker of headphoned directly via message. but dont have any respons yet about if its possible to make it fix.

I dont understand it really... How is it possible with this amount of wizkids surfing around here that no one took this oppertunity to make it work.

Whats wrong with all these guys... do they ever listen to the none programmers? This is a feature many people want. i know there must be something possible. because the call button works when being in a call!

Instead people make garbage like n900fly.... im getting anoyed! i know its possible someone please make it!

andrei1089 2010-03-30 11:12

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

Originally Posted by sygys (Post 587979)
Instead people make garbage like n900fly.... im getting anoyed! i know its possible someone please make it!

It's not developers fault that there's no documentation on how to activate the headset button. You really shouldn't use those kind of words for an opensource application voluntarily developed.

Laughing Man 2010-03-31 00:06

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

Originally Posted by sygys (Post 587979)
i contacted the maker of headphoned directly via message. but dont have any respons yet about if its possible to make it fix.

I dont understand it really... How is it possible with this amount of wizkids surfing around here that no one took this oppertunity to make it work.

Whats wrong with all these guys... do they ever listen to the none programmers? This is a feature many people want. i know there must be something possible. because the call button works when being in a call!

Instead people make garbage like n900fly.... im getting anoyed! i know its possible someone please make it!

You want a certain feature? Find a developer willing to do it on their spare time. Most projects are the results of their interests. Can't? Then try paying them, I'm sure if you pay enough money you'll find someone willing to do it.

Just because people want it doesn't mean the developers on the forum is going work on it. For one thing the developers have a variety of skill, different code backgrounds, knowledge of the internal maemo OS, etc. Secondly, what they work on is from their own interest and often using their own time. Nokia isn't paying them. And I doubt they get alot of donations from people for the existing work they do. God knows I should probably get around to donating to the people I have on the Maepad list.

Bec 2010-03-31 03:58

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
I don't have anything against paying - as far as I'm concerned make it a paid app...

But the thing seems to be... we don't know what has to be activated so that the phone can recive commands from the headset via d-bus... things seem to have come to a halt...

Laughing Man 2010-04-01 01:02

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

Originally Posted by Bec (Post 589147)
I don't have anything against paying - as far as I'm concerned make it a paid app...

But the thing seems to be... we don't know what has to be activated so that the phone can recive commands from the headset via d-bus... things seem to have come to a halt...

The point wasn't that it should be a paid app or not. It was more that the developer works on this in his/her free time. Thus it's unreasonable to demand features or insult developers.

I do wish the N900 had more documentation of its more closed features though.

cb22 2010-04-03 03:30

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

Originally Posted by Laughing Man (Post 590663)
I do wish the N900 had more documentation of its more closed features though.

I made a post about this at http://talk.maemo.org/showthread.php?p=589071

As you can see there are lots of replies :(
Perhaps filing a bug would be the correct thing to do?

cb22 2010-04-03 03:50

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Cancel that above post, it seems I've found a way to do it :)
cat /sys/devices/platform/nokia-av/detect will give 4 when the button is not pressed, and 2 when it is pressed!

EDIT: Unfortunately, this seems to be useless, unless you feel like polling a file repeatedly for changes.

MrWeasel 2010-04-03 07:17

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
Considering how much CPU usage is generated by mediaplayer, indeed I feel like constantly polling a file rather than pulling out my n900 everytime I'd like to change the song (especially on the bike).

Besides: there is a program that does exactly the same for the proximity sensor (proximityd). I guess it would be quite easy to change the file and the dbus interface it generates.

Bec 2010-04-03 07:20

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
I'm sure there have to be more ingenious ways but if nothing else is at hand polling is excellent for me :D

qwerty12 2010-04-03 07:48

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

Originally Posted by cb22 (Post 593405)
EDIT: Unfortunately, this seems to be useless, unless you feel like polling a file repeatedly for changes.

That's why you have inotify and the lovely GIOChannels. :)

If no one else wishes to have a go, I can give thp a patch for headphoned. No point in running two daemons...

Bec 2010-04-03 07:58

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
that would be great!

jaeezzy 2010-04-03 08:22

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

Originally Posted by qwerty12 (Post 593468)
That's why you have inotify and the lovely GIOChannels. :)

If no one else wishes to have a go, I can give thp a patch for headphoned. No point in running two daemons...

that would be great also, if possible, i would love to have double clicking action to go to previous or sth.

andrei1089 2010-04-03 08:27

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

Originally Posted by qwerty12 (Post 593468)
That's why you have inotify and the lovely GIOChannels. :)

If no one else wishes to have a go, I can give thp a patch for headphoned. No point in running two daemons...

Unfortunately, I don't think you can use inotify with sysfs

qwerty12 2010-04-03 08:36

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

Originally Posted by andrei1089 (Post 593504)
Unfortunately, I don't think you can use inotify with sysfs

That would explain why my usage of inotify-tools didn't help much...

thp uses a GIOChannel to monitor /sys/devices/platform/gpio-switch/headphone/state and headphoned sleeps for most of the time so I guess using one to monitor the file cb42 told us about wouldn't do any harm...

@jaeezzy, that's a good idea. Will come up with logical ways to handle that one

Bec 2010-04-03 08:45

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

Originally Posted by jaeezzy (Post 593498)
that would be great also, if possible, i would love to have double clicking action to go to previous or sth.

There's a brainstorm about this also: http://maemo.org/community/brainstor..._input_reader/

Code:

-support input gestures such as double tap and long press

andrei1089 2010-04-03 10:09

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

Originally Posted by qwerty12 (Post 593508)
That would explain why my usage of inotify-tools didn't help much...

thp uses a GIOChannel to monitor /sys/devices/platform/gpio-switch/headphone/state and headphoned sleeps for most of the time so I guess using one to monitor the file cb42 told us about wouldn't do any harm...

@jaeezzy, that's a good idea. Will come up with logical ways to handle that one

I hacked a bit on the headphoned code adding another watch for the file /sys/devices/platform/nokia-av/detect but it doesn't detect any change

Then I've tried with inotifywait for both files /sys/devices/platform/nokia-av/detect and /sys/devices/platform/gpio-switch/headphone/state
I've been surprised to see that a change is detected only for the latter. So I think there's no other way than polling the file.

qwerty12 2010-04-03 10:21

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

Originally Posted by andrei1089 (Post 593579)
So I think there's no other way than polling the file.

Indeed. Nokia's ****ish behaviour regarding this is pissing me off. I'm tempted to upload a nokia-av.ko file that doesn't disable the button.

--

I've figured out what happens: When inserting a headset, /usr/lib/ohm/libohm_accessories.so will register it to the system as plain headphones. Plain headphones do not have a button, so why would pressing it do anything? When the policy changes to "phone", this file will re-register the headset as a - *gasp* - headset; this is why (if you monitor HAL) you "see" the headphones being "removed and reinserted".

Making a replacement /usr/lib/ohm/libohm_accessories.so that would register the headset in the first place as a headset wouldn't be hard work (riiiight...) thanks to IDA Pro and the examples of plugins found in the OHM package but there's no point when you can just modify nokia-av.ko to not disable the button, which is what I will be doing soon. **** you, Nokia, and your stupid decisions.

cb22 2010-04-04 16:37

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

Originally Posted by andrei1089 (Post 593579)
I hacked a bit on the headphoned code adding another watch for the file /sys/devices/platform/nokia-av/detect but it doesn't detect any change

Then I've tried with inotifywait for both files /sys/devices/platform/nokia-av/detect and /sys/devices/platform/gpio-switch/headphone/state
I've been surprised to see that a change is detected only for the latter. So I think there's no other way than polling the file.

Yeah, that's what I thought of doing originally, but then after playing around a bit more (my kernel hacking knowledge is pretty much limited to printk's) I realized that all sysfs does is call a relevant piece of code in the driver, that value doesn't exist until you actually read it.

Quote:

Making a replacement /usr/lib/ohm/libohm_accessories.so that would register the headset in the first place as a headset wouldn't be hard work (riiiight...) thanks to IDA Pro and the examples of plugins found in the OHM package but there's no point when you can just modify nokia-av.ko to not disable the button, which is what I will be doing soon. **** you, Nokia, and your stupid decisions.
I looked over nokia-av.c and I probably missed the code that actually handles the disabling... I ended up wading through twl-madc before eventually going to bed. It would be awesome to finally be able to use the damn button... Good luck :)

rojicha07 2010-04-04 18:17

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

I am completely new at this, but I would like that when I press the button of the headset, the song changes (instead of pause it)... how can I do this?

Any help would be appreciated...

Thanks!

cb22 2010-04-04 19:47

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

Originally Posted by rojicha07 (Post 595209)
Hi:

I am completely new at this, but I would like that when I press the button of the headset, the song changes (instead of pause it)... how can I do this?

Any help would be appreciated...

Thanks!

At the moment, it is impossible to even get events from pressing the button, so it can't be done at the moment (not even pausing). Unless you have an N810 / N800.

NLChris 2010-04-07 16:43

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

Originally Posted by cb22 (Post 593405)
Cancel that above post, it seems I've found a way to do it :)
cat /sys/devices/platform/nokia-av/detect will give 4 when the button is not pressed, and 2 when it is pressed!

EDIT: Unfortunately, this seems to be useless, unless you feel like polling a file repeatedly for changes.

This only works on the standard black inear headset (with the white plugs)

It does not work with the AD-43 & HS-45 Stereo Headset, then it returns 0 :confused: I'd do anything to help with this issue. Unfortunately i have no experience in linux kernel programming. :(

e0x 2010-04-19 13:53

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

Originally Posted by qwerty12 (Post 593592)
Indeed. Nokia's ****ish behaviour regarding this is pissing me off. I'm tempted to upload a nokia-av.ko file that doesn't disable the button.

--

I've figured out what happens: When inserting a headset, /usr/lib/ohm/libohm_accessories.so will register it to the system as plain headphones. Plain headphones do not have a button, so why would pressing it do anything? When the policy changes to "phone", this file will re-register the headset as a - *gasp* - headset; this is why (if you monitor HAL) you "see" the headphones being "removed and reinserted".

Making a replacement /usr/lib/ohm/libohm_accessories.so that would register the headset in the first place as a headset wouldn't be hard work (riiiight...) thanks to IDA Pro and the examples of plugins found in the OHM package but there's no point when you can just modify nokia-av.ko to not disable the button, which is what I will be doing soon. **** you, Nokia, and your stupid decisions.

any luck with this ?

qwerty12 2010-05-15 13:32

Re: [ANNOUNCE] headset-control : Make the headset button actually manipulate tracks.
 
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...


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

vBulletin® Version 3.8.8