Alsa-Devel Archive on
 help / color / Atom feed
From: Takashi Sakamoto <>
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
Message-ID: <20191223094233.GA15438@workstation> (raw)
In-Reply-To: <>

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):
    args = ['amixer', '-c', str(card_id), 'cget', '(placeholder)']
    for target in targets:
        args[4] = "iface=PCM,name='{}'".format(target.get_name())

if len(argv) < 2:
    print('One argument is required for the numerical ID of soundcard.')
card_id = int(argv[1])

card =

targets = list(filter(lambda e: e.get_name().find("Channel Map") >= 0,
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< --------

Alsa-devel mailing list

  reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23  9:33 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191223094233.GA15438@workstation \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Alsa-Devel Archive on

Archives are clonable:
	git clone --mirror alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ \
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone