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)

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