Notices


Reply
Thread Tools
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#71
Originally Posted by andrei1089 View Post
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
 

The Following 7 Users Say Thank You to qwerty12 For This Useful Post:
Bec's Avatar
Posts: 876 | Thanked: 396 times | Joined on Dec 2009
#72
Originally Posted by jaeezzy View Post
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
__________________
 

The Following User Says Thank You to Bec For This Useful Post:
andrei1089's Avatar
Posts: 81 | Thanked: 109 times | Joined on Apr 2009 @ Brasov/Cluj, Romania
#73
Originally Posted by qwerty12 View Post
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.
 

The Following 4 Users Say Thank You to andrei1089 For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#74
Originally Posted by andrei1089 View Post
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.

Last edited by qwerty12; 2010-04-04 at 14:46.
 

The Following 10 Users Say Thank You to qwerty12 For This Useful Post:
Posts: 82 | Thanked: 214 times | Joined on Jan 2010 @ Cape town
#75
Originally Posted by andrei1089 View Post
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.

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
 

The Following 5 Users Say Thank You to cb22 For This Useful Post:
Posts: 14 | Thanked: 4 times | Joined on Jan 2010
#76
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!
 

The Following User Says Thank You to rojicha07 For This Useful Post:
Posts: 82 | Thanked: 214 times | Joined on Jan 2010 @ Cape town
#77
Originally Posted by rojicha07 View Post
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.
 

The Following User Says Thank You to cb22 For This Useful Post:
Posts: 3 | Thanked: 1 time | Joined on Apr 2010
#78
Originally Posted by cb22 View Post
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 I'd do anything to help with this issue. Unfortunately i have no experience in linux kernel programming.
 

The Following User Says Thank You to NLChris For This Useful Post:
Posts: 66 | Thanked: 26 times | Joined on Apr 2010
#79
Originally Posted by qwerty12 View Post
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 ?
 

The Following User Says Thank You to e0x For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#80
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...
 

The Following 14 Users Say Thank You to qwerty12 For This Useful Post:
Reply

Tags
ad-54/hs-45, headset button


 
Forum Jump


All times are GMT. The time now is 18:40.