At Fri, 25 Dec 2009 14:22:38 -0600, David Fries wrote:
From: David Fries david@fries.net
Only restore the old value if it differs from the requested value, because if it has changed restoring the old value overrides the change. Take for example, a voice modem with a .conf that sets preserve off-hook. Start playback (on-hook to off-hook), start record (off-hook to off-hook), stop playback (off-hook to restore on-hook), stop record (on-hook to restore off-hook), Clearly you don't want to leave the modem "on the phone" now that there isn't any playback or recording active.
Signed-off-by: David Fries david@fries.net
Thanks for the patch (and sorry for overlooking for a long time!) Applied now to GIT tree. It's a nice improvement.
Comments welcome.
The default modem.conf has, hooks.0 { type ctl_elems hook_args [ { name "Off-hook Switch" preserve true value "on" lock false optional true } ] } I wrote the patch to be, if you didn't modify it, don't restore the value. I also thought that it might work to check to see if the current mixer value matches the requested value (which is the value the program set on open), and only set the old value if it hasn't been externally modified. The theory being if something else changed the mixer value, we don't want to by default overwrite that change.
Some additional flags could also be added to leave the current behavior alone and add the if you didn't modify it, don't restore it, or if it changed after you set it, don't restore it. Here are some flag names if that would be preferred, preserve_if_different restore_if_unmodified no_squash restore_overrides preserve_if_changed.
Well, this would be just a feature no one will ever use :) If anyone stumbles the problem regarding this, we can implement such flags.
Setting the lock isn't really an option, because then you can't manually "hang up" the modem if you needed to.
On a side note, do any of the alsa voice/software modems support notifying userspace when the line is ringing? I'm using intel8x0m, not that I think it matters here.
I don't know of any, too.
Takashi