From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: Re: [alsa-devel] [PATCH] ALSA: ctl: allow TLV read operation for callback type of element in locked case
Date: Mon, 23 Dec 2019 18:42:34 +0900 [thread overview]
Message-ID: <20191223094233.GA15438@workstation> (raw)
In-Reply-To: <20191223093347.15279-1-o-takashi@sakamocchi.jp>
On Mon, Dec 23, 2019 at 06:33:47PM +0900, Takashi Sakamoto wrote:
> At present, when an element has callback function for TLV information,
> TLV read operation returns EPERM if the element is locked. On the
> other hand, the read operation is success when an element has allocated
> array for TLV information. In both cases, read operation is success for
> element value expectedly.
You can regenerate the issue by executing below Python 3 scripts:
(Installation of alsa-gobject[1], PyGObject[2] and amixer(1) in
alsa-utils is required.)
After element is locked, amixer reports EPERM for any read operation of
TLV information.
```
#########after locked#########
numid=28,iface=PCM,name='Playback Channel Map'
; type=INTEGER,access=r---lR--,values=6,min=0,max=36,step=0
: values=0,0,0,0,0,0
amixer: Control hw:1 element TLV read error: Operation not permitted
```
======== 8< --------
#!/usr/bin/env python3
from sys import argv,exit
import subprocess
import gi
gi.require_version('ALSACtl', '0.0')
from gi.repository import ALSACtl
def lock_elems(card, targets, locked):
for target in targets:
card.lock_elem(target, locked)
def run_amixer(label, targets):
print('{:#^30}'.format(label))
args = ['amixer', '-c', str(card_id), 'cget', '(placeholder)']
for target in targets:
args[4] = "iface=PCM,name='{}'".format(target.get_name())
subprocess.run(args)
if len(argv) < 2:
print('One argument is required for the numerical ID of soundcard.')
exit(1)
card_id = int(argv[1])
card = ALSACtl.Card.new()
card.open(card_id)
targets = list(filter(lambda e: e.get_name().find("Channel Map") >= 0,
card.get_elem_id_list()))
run_amixer('before locked', targets)
lock_elems(card, targets, True)
run_amixer('after locked', targets)
lock_elems(card, targets, False)
run_amixer('after released', targets)
# The lock is surely released automatically when control character device is
# released. Thus it's safe to terminate the above codes in its middle.
======== 8< --------
[1] https://github.com/alsa-project/alsa-gobject/
[2] https://pygobject.readthedocs.io/en/latest/
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2019-12-23 9:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-23 9:33 [alsa-devel] [PATCH] ALSA: ctl: allow TLV read operation for callback type of element in locked case Takashi Sakamoto
2019-12-23 9:42 ` Takashi Sakamoto [this message]
2019-12-23 15:03 ` Takashi Iwai
2019-12-24 10:02 ` Takashi Sakamoto
2019-12-24 14:31 ` Takashi Iwai
2019-12-24 12:56 ` Jaroslav Kysela
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=20191223094233.GA15438@workstation \
--to=o-takashi@sakamocchi.jp \
--cc=alsa-devel@alsa-project.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.