Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Clemens Ladisch <clemens@ladisch.de>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: Some questions about userspace control elements
Date: Thu, 05 Feb 2015 08:51:17 +0900	[thread overview]
Message-ID: <54D2B075.4050005@sakamocchi.jp> (raw)
In-Reply-To: <54CE675A.80004@ladisch.de>

Hi Clemens,

I find a curious issue about the userspace element. Could I ask you to
give some comments about

The code is this one line.

sound/core/control.c:1188
{{{
kctl.count = info->owner ? info->owner : 1;
}}}
http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/core/control.c?id=6ccd93bdb989507717edb375d40534f1177822c5#n1188

In this code, the value in struct snd_ctl_elem_info.owner is assigned to
struct snd_kcontrol.count. The meaning of these two member is completely
different but assigned.

include/sound/control.h:67
{{{
struct snd_kcontrol {
...
unsigned int count;
...
};
}}}
http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/include/sound/control.h?id=6ccd93bdb989507717edb375d40534f1177822c5#n67

include/uapi/sound/asound.h:851
{{{
struct snd_ctl_elem_info {
...
__kernel_pid_t owner;		/* owner's PID of this control */
...
};
};
}}}
http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/include/uapi/sound/asound.h?id=6ccd93bdb989507717edb375d40534f1177822c5#n851
(I wonder why the value with _kernel_pid type is exported to userspace...)

I guess that the reason is to limit the number of event generated when
the control element set is operated. Actually, my sample code reports
one event every time when operating the control element with 10 entries.
But I believe this is the different behaviour as the kernel control
elements do.

sound/core/control.c:257
{{{
kctl.count = ncontrol->count ? ncontrol->count : 1;
}}}
http://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/core/control.c?id=6ccd93bdb989507717edb375d40534f1177822c5#n257

For me, the behaviour of userspace control element is a bit strange. The
behaviour is legal as a control element?


Regards

Takashi Sakamoto

  parent reply	other threads:[~2015-02-04 23:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01 11:41 Some questions about userspace control elements Takashi Sakamoto
2015-02-01 17:50 ` Clemens Ladisch
2015-02-02 14:14   ` Takashi Sakamoto
2015-02-04 23:51   ` Takashi Sakamoto [this message]
2015-02-05  0:44     ` Takashi Sakamoto
2015-02-06  9:38       ` Clemens Ladisch
2015-02-07  1:58         ` Takashi Sakamoto
2015-02-07 15:45           ` Clemens Ladisch
2015-02-08 10:57             ` Takashi Sakamoto

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=54D2B075.4050005@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.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