From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
alsa-devel@alsa-project.org, linux-input@vger.kernel.org,
mjg59@srcf.ucam.org
Subject: Re: Jack reporting v2
Date: Wed, 4 Jun 2008 00:38:14 +0100 [thread overview]
Message-ID: <20080603233813.GA30512@sirena.org.uk> (raw)
In-Reply-To: <20080603105920.ZZRA012@mailhub.coreip.homeip.net>
On Tue, Jun 03, 2008 at 11:17:26AM -0400, Dmitry Torokhov wrote:
> Pros for using input devices:
> - we already have them
...and it already models switches.
As mentioned in the description of the original patch there's also the
fact that the existing implementations I've found are doing things this
way. The only in-kernel ones are corgi and spitz which skip the input
device overhead by using the keyboard input device.
There is an additional motivation for using an input device for jacks -
it is common to support a button implemented by shorting the microphone
connection as well as simply detecting the presence of something in the
jack.
> Cons:
> - space consideration. Input_dev structure is quite fat. It has all
> the capabilities strings exported through sysfs, hist of other
> attributes, etc. On top of that we have a character device (evdev)
> plus its own sysfs representation. IOW lots of stuff.
I'm not sure how many systems this is a concern for these days (the
things I found exporting to user space at the minute are embedded) but
it could be an issue.
> - input device require ioctl to get the switch state, no easy way to
> do it through sysfs.
That sounds like something that is worth adding anyway, regardless of
what gets done with jacks.
> - As the number of types of connectors grows new switches will need to
> be added to input, potentially completely unrelated. My lacmus test
> for it - does it make sense to add network cable state to inputi
> core?
The number of potential switches could get rather large, yes - to my
mind it's the main concern with using the input API.
> Do you think that something small that has only one sysfs device per
> switch and uses KOBJ_ONLINE/KOBJ_OFFLINE to signal state change would
> be better suited here?
It's certainly doable and it would avoid any issues with memory overhead
and with the number of switch types.
Jacks would in general have more than one thing to report - as well as
jacks for headsets with both headphone and optional microphone support
on one physical jack many devices will also be able to give an idea of
the device connected to a jack, doing things like distinguishing between
speakers and headphones. This information could still be exported via
the sort of interface you suggest, for example with one sysfs file per
thing that can be detected contents indicating the state for that thing.
It could also be exported as environment variables along with the
uevent. The jack API would be able to standardise the names so that
shouldn't be an issue.
Ignoring the buttons it should be fairly straightforward from a kernel
point of view. I'm not sure how some of the userspace people would feel
about it, mainly those in embedded systems not already dealing with
uevents, but if they don't want to use netlink then uevent_helper should
do the job for them even though it is a bit more cumbersome than the
input API.
Buttons would presumably end up as an input device registered only if
supported by the jack - this would be easy enough for the kernel.
If jack reporting is implemented this way we'd want to add a comment
indicating that SW_HEADPHONE_INSERT shouldn't be used.
next prev parent reply other threads:[~2008-06-03 23:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-29 21:09 [PATCH/RFC 1/2] Add jack reporting API for ALSA Mark Brown
2008-05-29 21:09 ` [PATCH/RFC 2/2] Add microphone and headset reporting Mark Brown
2008-05-30 8:15 ` [PATCH/RFC 1/2] Add jack reporting API for ALSA Takashi Iwai
2008-05-30 10:15 ` Mark Brown
2008-06-03 10:40 ` Jack reporting v2 Mark Brown
2008-06-03 10:42 ` [PATCH 1/2] Add jack reporting API for ALSA Mark Brown
2008-06-03 10:42 ` [PATCH 2/2] Add microphone and headset reporting Mark Brown
2008-06-03 14:49 ` Jack reporting v2 Takashi Iwai
2008-06-03 15:36 ` Mark Brown
2008-06-03 15:17 ` Dmitry Torokhov
2008-06-03 23:38 ` Mark Brown [this message]
2008-06-06 14:23 ` Mark Brown
2008-07-01 9:24 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080603233813.GA30512@sirena.org.uk \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=mjg59@srcf.ucam.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox