Hello community, here is the log from the commit of package alsa-tools for openSUSE:Factory checked in at 2012-05-08 06:44:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/alsa-tools (Old) and /work/SRC/openSUSE:Factory/.alsa-tools.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "alsa-tools", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/alsa-tools/alsa-tools.changes 2012-03-02 13:46:45.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.alsa-tools.new/alsa-tools.changes 2012-05-08 06:44:42.000000000 +0200 @@ -1,0 +2,13 @@ +Fri Apr 20 16:00:58 CEST 2012 - [email protected] + +- Backport upstream patches to add hda-verb program + +------------------------------------------------------------------- +Fri Apr 13 15:55:12 CEST 2012 - [email protected] + +- Backport patches from upstream + - Update README of hwmixvolume + - Add hdajackretask program +- Built some ISA-specific programs only for ix86 + +------------------------------------------------------------------- New: ---- 0001-alsa-tools-hwmixvolume-update-README-for-au88x0.patch 0002-hdajackretask-Add-new-program-for-easy-retask-of-hda.patch 0003-hdajackretask-Use-autotools.patch 0004-Import-hda-verb-0.4-to-alsa-tools-repo.patch 0005-Convert-hda-verb-to-use-automake.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ alsa-tools.spec ++++++ --- /var/tmp/diff_new_pack.p43Jyn/_old 2012-05-08 06:44:45.000000000 +0200 +++ /var/tmp/diff_new_pack.p43Jyn/_new 2012-05-08 06:44:45.000000000 +0200 @@ -16,6 +16,12 @@ # +# +%if %suse_version > 1140 +%define have_gtk3 1 +%else +%define have_gtk3 0 +%endif Name: alsa-tools BuildRequires: alsa-devel @@ -26,6 +32,9 @@ BuildRequires: libtool BuildRequires: update-desktop-files BuildRequires: xorg-x11-devel +%if %{have_gtk3} +BuildRequires: gtk3-devel +%endif %define package_version 1.0.25 Url: http://www.alsa-project.org/ Summary: Various ALSA Tools @@ -33,7 +42,8 @@ Group: Productivity/Multimedia/Sound/Utilities Version: 1.0.25 Release: 0 -Requires: alsa-firmware, fxload +Requires: alsa-firmware +Requires: fxload Source: ftp://ftp.alsa-project.org/pub/tools/alsa-tools-%{package_version}.tar.bz2 Source1: README.SuSE Source2: sbipatches.tar.bz2 @@ -43,6 +53,11 @@ Source8: envy24.png Patch: alsa-tools-desktop-fix.dif # Patch1: alsa-tools-git-fixes.diff +Patch101: 0001-alsa-tools-hwmixvolume-update-README-for-au88x0.patch +Patch102: 0002-hdajackretask-Add-new-program-for-easy-retask-of-hda.patch +Patch103: 0003-hdajackretask-Use-autotools.patch +Patch104: 0004-Import-hda-verb-0.4-to-alsa-tools-repo.patch +Patch105: 0005-Convert-hda-verb-to-use-automake.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -51,7 +66,8 @@ %package gui Summary: Various ALSA Tools with GUI Group: Productivity/Multimedia/Sound/Utilities -Requires: pyalsa, python-gtk +Requires: pyalsa +Requires: python-gtk %description gui Various tools for ALSA with GUI for controlling the configuration and @@ -71,12 +87,20 @@ cp %{SOURCE1} . %patch -p1 # %patch1 -p1 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +%patch105 -p1 %build export AUTOMAKE_JOBS="%{?_smp_mflags}" -ALL_PACKS="envy24control seq/sbiload sscape_ctl hdspconf hdsploader hdspmixer rmedigicontrol echomixer usx2yloader us428control as10k1 ld10k1 hwmixvolume" -%ifnarch ppc ppc64 -ALL_PACKS="$ALL_PACKS sb16_csp" +ALL_PACKS="envy24control seq/sbiload hdspconf hdsploader hdspmixer rmedigicontrol echomixer usx2yloader us428control as10k1 ld10k1 hwmixvolume hda-verb" +%ifarch %{ix86} +ALL_PACKS="$ALL_PACKS sb16_csp sscape_ctl" +%endif +%if %{have_gtk3} +ALL_PACKS="$ALL_PACKS hdajackretask" %endif for d in $ALL_PACKS; do (cd $d @@ -92,9 +116,12 @@ make -C as10k1/examples dsp %install -ALL_PACKS="envy24control seq/sbiload sscape_ctl hdspconf hdsploader hdspmixer rmedigicontrol echomixer usx2yloader us428control as10k1 ld10k1 hwmixvolume" -%ifnarch ppc ppc64 -ALL_PACKS="$ALL_PACKS sb16_csp" +ALL_PACKS="envy24control seq/sbiload hdspconf hdsploader hdspmixer rmedigicontrol echomixer usx2yloader us428control as10k1 ld10k1 hwmixvolume hda-verb" +%ifarch %{ix86} +ALL_PACKS="$ALL_PACKS sb16_csp sscape_ctl" +%endif +%if %{have_gtk3} +ALL_PACKS="$ALL_PACKS hdajackretask" %endif for d in $ALL_PACKS; do (cd $d @@ -148,9 +175,9 @@ %files %defattr(-, root, root) %doc %{_docdir}/%{name} -%{_bindir}/sscape_ctl %{_bindir}/sbiload -%ifnarch ppc ppc64 +%ifarch %{ix86} +%{_bindir}/sscape_ctl %{_bindir}/cspctl %endif %{_bindir}/hdsploader @@ -164,6 +191,7 @@ %{_sbindir}/dl10k1 %{_bindir}/lo10k1 %{_bindir}/init_* +%{_bindir}/hda-verb %{_datadir}/ld10k1 %{_libdir}/liblo10k1.so.* @@ -175,6 +203,9 @@ %{_bindir}/hdspmixer %{_bindir}/echomixer %{_bindir}/hwmixvolume +%if %{have_gtk3} +%{_bindir}/hdajackretask +%endif %{_datadir}/applications/*.desktop %{_datadir}/pixmaps/* ++++++ 0001-alsa-tools-hwmixvolume-update-README-for-au88x0.patch ++++++ >From a680841d4a2a142981d2038e9af0a07abc74c5d7 Mon Sep 17 00:00:00 2001 From: Raymond Yau <[email protected]> Date: Sun, 11 Mar 2012 11:37:22 +0800 Subject: [PATCH 1/3] alsa-tools: hwmixvolume - update README for au88x0 - Need to use alsa-driver kernel 3.4 for Aureal sound cards Signed-off-by: Raymond Yau <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> --- hwmixvolume/README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hwmixvolume/README b/hwmixvolume/README index 96bb0b4..9884ec2 100644 --- a/hwmixvolume/README +++ b/hwmixvolume/README @@ -13,5 +13,7 @@ This tool requires Python, pygtk, and alsa-pyton 1.0.22 or later. It is recommended to use at least Linux kernel 2.6.32 or alsa-driver 1.0.22; otherwise, the name of the program that is using a stream cannot be shown. +Need to use alsa-driver kernel 3.4 for Aureal sound cards +* Aureal Vortex/Vortex2/Advantage (driver: snd-au8820, snd-au8830, snd-au8810) Author: Clemens Ladisch <[email protected]> -- 1.7.9.2 ++++++ 0002-hdajackretask-Add-new-program-for-easy-retask-of-hda.patch ++++++ ++++ 1682 lines (skipped) ++++++ 0003-hdajackretask-Use-autotools.patch ++++++ >From d06008f39767d6377997c51a3c8eebb2100941f7 Mon Sep 17 00:00:00 2001 From: David Henningsson <[email protected]> Date: Fri, 13 Apr 2012 11:49:21 +0200 Subject: [PATCH 3/3] hdajackretask: Use autotools Start to use autotools as build system, just like the other programs in the alsa-tools suite. Signed-off-by: David Henningsson <[email protected]> --- hdajackretask/AUTHORS | 1 + hdajackretask/ChangeLog | 1 + hdajackretask/Makefile | 18 ------------------ hdajackretask/Makefile.am | 20 ++++++++++++++++++++ hdajackretask/NEWS | 1 + hdajackretask/configure.in | 10 ++++++++++ hdajackretask/gitcompile | 31 +++++++++++++++++++++++++++++-- 7 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 hdajackretask/AUTHORS create mode 100644 hdajackretask/ChangeLog delete mode 100644 hdajackretask/Makefile create mode 100644 hdajackretask/Makefile.am create mode 100644 hdajackretask/NEWS create mode 100644 hdajackretask/configure.in diff --git a/hdajackretask/AUTHORS b/hdajackretask/AUTHORS new file mode 100644 index 0000000..9f136d8 --- /dev/null +++ b/hdajackretask/AUTHORS @@ -0,0 +1 @@ +David Henningsson <[email protected]> diff --git a/hdajackretask/ChangeLog b/hdajackretask/ChangeLog new file mode 100644 index 0000000..70c7475 --- /dev/null +++ b/hdajackretask/ChangeLog @@ -0,0 +1 @@ +For news and changelog, refer to git repository history. This file is only present because autotools requires it. diff --git a/hdajackretask/Makefile b/hdajackretask/Makefile deleted file mode 100644 index c9c4043..0000000 --- a/hdajackretask/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -SOURCES = main-gtk.c sysfs-pin-configs.c apply-changes.c - -build: - $(shell sed 's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$$/\\n"/;' < README > README.generated.h) - gcc -g -O0 -Wall -o hda-jack-retask $(SOURCES) $(shell pkg-config --cflags --libs gtk+-3.0) - -clean: - -rm hda-jack-retask - -rm README.generated.h - -install: - install -Dm755 hda-jack-retask $(DESTDIR)/usr/bin/hda-jack-retask - install -Dm644 README $(DESTDIR)/usr/share/doc/hda-jack-retask/README - -uninstall: - -rm $(DESTDIR)/usr/bin/hda-jack-retask - -.PHONY: build install uninstall diff --git a/hdajackretask/Makefile.am b/hdajackretask/Makefile.am new file mode 100644 index 0000000..e0204bc --- /dev/null +++ b/hdajackretask/Makefile.am @@ -0,0 +1,20 @@ +EXTRA_DIST = gitcompile README +AM_CFLAGS = @GTK3_CFLAGS@ +bin_PROGRAMS = hdajackretask +man_MANS = +hdajackretask_SOURCES = main-gtk.c sysfs-pin-configs.c apply-changes.c +hdajackretask_LDADD = @GTK3_LIBS@ + +BUILT_SOURCES = README.generated.h +nodist_hdajackretask_SOURCES = README.generated.h +CLEANFILES = README.generated.h + +README.generated.h: + sed 's/\\/\\\\/g;s/"/\\"/g;s/^/"/;s/$$/\\n"/;' README >$@ + +alsa-dist: distdir + @rm -rf ../distdir/hdajackretask + @mkdir -p ../distdir/hdajackretask + @cp -RLpv $(distdir)/* ../distdir/hdajackretask + @rm -rf $(distdir) + diff --git a/hdajackretask/NEWS b/hdajackretask/NEWS new file mode 100644 index 0000000..70c7475 --- /dev/null +++ b/hdajackretask/NEWS @@ -0,0 +1 @@ +For news and changelog, refer to git repository history. This file is only present because autotools requires it. diff --git a/hdajackretask/configure.in b/hdajackretask/configure.in new file mode 100644 index 0000000..f839af3 --- /dev/null +++ b/hdajackretask/configure.in @@ -0,0 +1,10 @@ +AC_INIT([hdajackretask], [0.20120413]) +AC_CONFIG_SRCDIR([main-gtk.c]) +AM_INIT_AUTOMAKE +AC_PROG_CC +AC_PROG_INSTALL +AC_HEADER_STDC + +PKG_CHECK_MODULES(GTK3, gtk+-3.0) + +AC_OUTPUT(Makefile) diff --git a/hdajackretask/gitcompile b/hdajackretask/gitcompile index acc8825..10e057c 100755 --- a/hdajackretask/gitcompile +++ b/hdajackretask/gitcompile @@ -1,3 +1,30 @@ -#!/bin/sh +#!/bin/bash -make GITCOMPILE_ARGS="$*" +if test -z "$AUTOMAKE_DIR"; then + if test -d /usr/local/share/automake; then + AUTOMAKE_DIR=/usr/local/share/automake + fi + if test -d /usr/share/automake; then + AUTOMAKE_DIR="/usr/share/automake" + fi + if test -z "$AUTOMAKE_DIR"; then + AUTOMAKE_DIR=/usr/share/`ls /usr/share | grep automake | tail -n 1` + fi +fi + +for f in install-sh mkinstalldirs missing; do + cp -av $AUTOMAKE_DIR/$f . || exit 1 +done + +aclocal $ACLOCAL_FLAGS || exit 1 +automake --add-missing --copy || exit 1 +touch depcomp || exit 1 +autoconf || exit 1 +export CFLAGS='-O2 -Wall -pipe -g' +echo "CFLAGS=$CFLAGS" +echo "./configure $@" +./configure $@ || exit 1 +unset CFLAGS +if [ -z "$GITCOMPILE_NO_MAKE" ]; then + make || exit 1 +fi -- 1.7.9.2 ++++++ 0004-Import-hda-verb-0.4-to-alsa-tools-repo.patch ++++++ >From 21e250bfbc923b762bf35fae3c277633b793654a Mon Sep 17 00:00:00 2001 From: Takashi Iwai <[email protected]> Date: Fri, 20 Apr 2012 15:48:01 +0200 Subject: [PATCH] Import hda-verb 0.4 to alsa-tools repo Signed-off-by: Takashi Iwai <[email protected]> --- Makefile | 2 +- hda-verb/ChangeLog | 12 ++ hda-verb/Makefile | 15 +++ hda-verb/README | 36 ++++++ hda-verb/hda-verb.c | 347 ++++++++++++++++++++++++++++++++++++++++++++++++++ hda-verb/hda_hwdep.h | 44 +++++++ 6 files changed, 455 insertions(+), 1 deletion(-) create mode 100644 hda-verb/ChangeLog create mode 100644 hda-verb/Makefile create mode 100644 hda-verb/README create mode 100644 hda-verb/hda-verb.c create mode 100644 hda-verb/hda_hwdep.h diff --git a/Makefile b/Makefile index 893b394..bded637 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ TOP = . SUBDIRS = ac3dec as10k1 envy24control hdsploader hdspconf hdspmixer \ mixartloader pcxhrloader rmedigicontrol sb16_csp seq sscape_ctl \ us428control usx2yloader vxloader echomixer ld10k1 qlo10k1 \ - hwmixvolume hdajackretask + hwmixvolume hdajackretask hda-verb all: @for i in $(SUBDIRS); do \ diff --git a/hda-verb/ChangeLog b/hda-verb/ChangeLog new file mode 100644 index 0000000..cbecd9d --- /dev/null +++ b/hda-verb/ChangeLog @@ -0,0 +1,12 @@ +version 0.3: + - Add -l and -L option to show defined verbs and parameters + +version 0.3: + - Add a brief description about hwdep in README + - Add COPYING before someone blaming me + +version 0.2 + - public release + +version 0.1 + - embryo diff --git a/hda-verb/Makefile b/hda-verb/Makefile new file mode 100644 index 0000000..260831a --- /dev/null +++ b/hda-verb/Makefile @@ -0,0 +1,15 @@ +VERSION = 0.4 + +CC = gcc +CFLAGS = -Wall -O2 -g + +hda-verb: hda-verb.o + $(CC) -o $@ hda-verb.o + +clean: + rm -f hda-verb *.o + +dist: + cd ..; mv hda-verb hda-verb-$(VERSION); \ + tar cfz hda-verb-$(VERSION).tar.gz --exclude='.git*' hda-verb-$(VERSION); \ + mv hda-verb-$(VERSION) hda-verb diff --git a/hda-verb/README b/hda-verb/README new file mode 100644 index 0000000..2ec65b5 --- /dev/null +++ b/hda-verb/README @@ -0,0 +1,36 @@ +HDA-VERB -- Send a HD-audio command + +hda-verb is a small program to send HD-audio commands to the given +ALSA hwdep device on the hd-audio interface. + +First off, build HD-audio driver with hwdep support. For the kernel +config, set CONFIG_SND_HDA_HWDEP=y. When you build ALSA drivers from +alsa-driver tarball, usually this is set automatically. + +Once snd-hda-intel driver is built with the hwdep support, you should +have a hwdep device such as /dev/snd/hwC0D0. + +The program takes four arguments, the hwdep device name, the widget NID, +the verb and the parameter. For example, + + % hda-verb /dev/snd/hwC0D0 0x12 0x701 2 + +The verb argument can be a string like "PARAMETERS". Also the +parameter argument can be a string like "VENDOR_ID" as well. + + % hda-verb /dev/snd/hwC0D0 0x0 PARAMETERS VENDOR_ID + +The string is case insensitive. Also, it doesn't have to be the full +string but only has to be unique. E.g. "par" is enough to mean +"PARAMETER", and "set_a" is enough as "SET_AMP_GAIN_MUTE". + + % hda-verb /dev/snd/hwC0D0 2 set_a 0xb080 + +The program executs the given verb, shows the result and quits. +Usually you need to be root to run this command. + + +*WARNING* +Use this program carefully. Sending an invalid verb may screw up the +codec communication, which requires either a reboot or reloading of +the sound driver eventually. diff --git a/hda-verb/hda-verb.c b/hda-verb/hda-verb.c new file mode 100644 index 0000000..2577ae0 --- /dev/null +++ b/hda-verb/hda-verb.c @@ -0,0 +1,347 @@ +/* + * Accessing HD-audio verbs via hwdep interface + * Version 0.3 + * + * Copyright (c) 2008 Takashi Iwai <[email protected]> + * + * Licensed under GPL v2 or later. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> +#include <sys/ioctl.h> +#include <sys/io.h> +#include <sys/types.h> +#include <sys/fcntl.h> + +#include <stdint.h> +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; + +#include "hda_hwdep.h" + +#define AC_VERB_GET_STREAM_FORMAT 0x0a00 +#define AC_VERB_GET_AMP_GAIN_MUTE 0x0b00 +#define AC_VERB_GET_PROC_COEF 0x0c00 +#define AC_VERB_GET_COEF_INDEX 0x0d00 +#define AC_VERB_PARAMETERS 0x0f00 +#define AC_VERB_GET_CONNECT_SEL 0x0f01 +#define AC_VERB_GET_CONNECT_LIST 0x0f02 +#define AC_VERB_GET_PROC_STATE 0x0f03 +#define AC_VERB_GET_SDI_SELECT 0x0f04 +#define AC_VERB_GET_POWER_STATE 0x0f05 +#define AC_VERB_GET_CONV 0x0f06 +#define AC_VERB_GET_PIN_WIDGET_CONTROL 0x0f07 +#define AC_VERB_GET_UNSOLICITED_RESPONSE 0x0f08 +#define AC_VERB_GET_PIN_SENSE 0x0f09 +#define AC_VERB_GET_BEEP_CONTROL 0x0f0a +#define AC_VERB_GET_EAPD_BTLENABLE 0x0f0c +#define AC_VERB_GET_DIGI_CONVERT_1 0x0f0d +#define AC_VERB_GET_DIGI_CONVERT_2 0x0f0e +#define AC_VERB_GET_VOLUME_KNOB_CONTROL 0x0f0f +#define AC_VERB_GET_GPIO_DATA 0x0f15 +#define AC_VERB_GET_GPIO_MASK 0x0f16 +#define AC_VERB_GET_GPIO_DIRECTION 0x0f17 +#define AC_VERB_GET_GPIO_WAKE_MASK 0x0f18 +#define AC_VERB_GET_GPIO_UNSOLICITED_RSP_MASK 0x0f19 +#define AC_VERB_GET_GPIO_STICKY_MASK 0x0f1a +#define AC_VERB_GET_CONFIG_DEFAULT 0x0f1c +#define AC_VERB_GET_SUBSYSTEM_ID 0x0f20 + +#define AC_VERB_SET_STREAM_FORMAT 0x200 +#define AC_VERB_SET_AMP_GAIN_MUTE 0x300 +#define AC_VERB_SET_PROC_COEF 0x400 +#define AC_VERB_SET_COEF_INDEX 0x500 +#define AC_VERB_SET_CONNECT_SEL 0x701 +#define AC_VERB_SET_PROC_STATE 0x703 +#define AC_VERB_SET_SDI_SELECT 0x704 +#define AC_VERB_SET_POWER_STATE 0x705 +#define AC_VERB_SET_CHANNEL_STREAMID 0x706 +#define AC_VERB_SET_PIN_WIDGET_CONTROL 0x707 +#define AC_VERB_SET_UNSOLICITED_ENABLE 0x708 +#define AC_VERB_SET_PIN_SENSE 0x709 +#define AC_VERB_SET_BEEP_CONTROL 0x70a +#define AC_VERB_SET_EAPD_BTLENABLE 0x70c +#define AC_VERB_SET_DIGI_CONVERT_1 0x70d +#define AC_VERB_SET_DIGI_CONVERT_2 0x70e +#define AC_VERB_SET_VOLUME_KNOB_CONTROL 0x70f +#define AC_VERB_SET_GPIO_DATA 0x715 +#define AC_VERB_SET_GPIO_MASK 0x716 +#define AC_VERB_SET_GPIO_DIRECTION 0x717 +#define AC_VERB_SET_GPIO_WAKE_MASK 0x718 +#define AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK 0x719 +#define AC_VERB_SET_GPIO_STICKY_MASK 0x71a +#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 0x71c +#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1 0x71d +#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2 0x71e +#define AC_VERB_SET_CONFIG_DEFAULT_BYTES_3 0x71f +#define AC_VERB_SET_CODEC_RESET 0x7ff + +#define AC_PAR_VENDOR_ID 0x00 +#define AC_PAR_SUBSYSTEM_ID 0x01 +#define AC_PAR_REV_ID 0x02 +#define AC_PAR_NODE_COUNT 0x04 +#define AC_PAR_FUNCTION_TYPE 0x05 +#define AC_PAR_AUDIO_FG_CAP 0x08 +#define AC_PAR_AUDIO_WIDGET_CAP 0x09 +#define AC_PAR_PCM 0x0a +#define AC_PAR_STREAM 0x0b +#define AC_PAR_PIN_CAP 0x0c +#define AC_PAR_AMP_IN_CAP 0x0d +#define AC_PAR_CONNLIST_LEN 0x0e +#define AC_PAR_POWER_STATE 0x0f +#define AC_PAR_PROC_CAP 0x10 +#define AC_PAR_GPIO_CAP 0x11 +#define AC_PAR_AMP_OUT_CAP 0x12 +#define AC_PAR_VOL_KNB_CAP 0x13 + +/* + */ +#define VERBSTR(x) { .val = AC_VERB_##x, .str = #x } +#define PARMSTR(x) { .val = AC_PAR_##x, .str = #x } + +struct strtbl { + int val; + const char *str; +}; + +static struct strtbl hda_verbs[] = { + VERBSTR(GET_STREAM_FORMAT), + VERBSTR(GET_AMP_GAIN_MUTE), + VERBSTR(GET_PROC_COEF), + VERBSTR(GET_COEF_INDEX), + VERBSTR(PARAMETERS), + VERBSTR(GET_CONNECT_SEL), + VERBSTR(GET_CONNECT_LIST), + VERBSTR(GET_PROC_STATE), + VERBSTR(GET_SDI_SELECT), + VERBSTR(GET_POWER_STATE), + VERBSTR(GET_CONV), + VERBSTR(GET_PIN_WIDGET_CONTROL), + VERBSTR(GET_UNSOLICITED_RESPONSE), + VERBSTR(GET_PIN_SENSE), + VERBSTR(GET_BEEP_CONTROL), + VERBSTR(GET_EAPD_BTLENABLE), + VERBSTR(GET_DIGI_CONVERT_1), + VERBSTR(GET_DIGI_CONVERT_2), + VERBSTR(GET_VOLUME_KNOB_CONTROL), + VERBSTR(GET_GPIO_DATA), + VERBSTR(GET_GPIO_MASK), + VERBSTR(GET_GPIO_DIRECTION), + VERBSTR(GET_GPIO_WAKE_MASK), + VERBSTR(GET_GPIO_UNSOLICITED_RSP_MASK), + VERBSTR(GET_GPIO_STICKY_MASK), + VERBSTR(GET_CONFIG_DEFAULT), + VERBSTR(GET_SUBSYSTEM_ID), + + VERBSTR(SET_STREAM_FORMAT), + VERBSTR(SET_AMP_GAIN_MUTE), + VERBSTR(SET_PROC_COEF), + VERBSTR(SET_COEF_INDEX), + VERBSTR(SET_CONNECT_SEL), + VERBSTR(SET_PROC_STATE), + VERBSTR(SET_SDI_SELECT), + VERBSTR(SET_POWER_STATE), + VERBSTR(SET_CHANNEL_STREAMID), + VERBSTR(SET_PIN_WIDGET_CONTROL), + VERBSTR(SET_UNSOLICITED_ENABLE), + VERBSTR(SET_PIN_SENSE), + VERBSTR(SET_BEEP_CONTROL), + VERBSTR(SET_EAPD_BTLENABLE), + VERBSTR(SET_DIGI_CONVERT_1), + VERBSTR(SET_DIGI_CONVERT_2), + VERBSTR(SET_VOLUME_KNOB_CONTROL), + VERBSTR(SET_GPIO_DATA), + VERBSTR(SET_GPIO_MASK), + VERBSTR(SET_GPIO_DIRECTION), + VERBSTR(SET_GPIO_WAKE_MASK), + VERBSTR(SET_GPIO_UNSOLICITED_RSP_MASK), + VERBSTR(SET_GPIO_STICKY_MASK), + VERBSTR(SET_CONFIG_DEFAULT_BYTES_0), + VERBSTR(SET_CONFIG_DEFAULT_BYTES_1), + VERBSTR(SET_CONFIG_DEFAULT_BYTES_2), + VERBSTR(SET_CONFIG_DEFAULT_BYTES_3), + VERBSTR(SET_CODEC_RESET), + { }, /* end */ +}; + +static struct strtbl hda_params[] = { + PARMSTR(VENDOR_ID), + PARMSTR(SUBSYSTEM_ID), + PARMSTR(REV_ID), + PARMSTR(NODE_COUNT), + PARMSTR(FUNCTION_TYPE), + PARMSTR(AUDIO_FG_CAP), + PARMSTR(AUDIO_WIDGET_CAP), + PARMSTR(PCM), + PARMSTR(STREAM), + PARMSTR(PIN_CAP), + PARMSTR(AMP_IN_CAP), + PARMSTR(CONNLIST_LEN), + PARMSTR(POWER_STATE), + PARMSTR(PROC_CAP), + PARMSTR(GPIO_CAP), + PARMSTR(AMP_OUT_CAP), + PARMSTR(VOL_KNB_CAP), + { }, /* end */ +}; + +static void list_keys(struct strtbl *tbl, int one_per_line) +{ + int c = 0; + for (; tbl->str; tbl++) { + int len = strlen(tbl->str) + 2; + if (!one_per_line && c + len >= 80) { + fprintf(stderr, "\n"); + c = 0; + } + if (one_per_line) + fprintf(stderr, " %s\n", tbl->str); + else if (!c) + fprintf(stderr, " %s", tbl->str); + else + fprintf(stderr, ", %s", tbl->str); + c += 2 + len; + } + if (!one_per_line) + fprintf(stderr, "\n"); +} + +/* look up a value from the given string table */ +static int lookup_str(struct strtbl *tbl, const char *str) +{ + struct strtbl *p, *found; + int len = strlen(str); + + found = NULL; + for (p = tbl; p->str; p++) { + if (!strncmp(str, p->str, len)) { + if (found) { + fprintf(stderr, "No unique key '%s'\n", str); + return -1; + } + found = p; + } + } + if (!found) { + fprintf(stderr, "No key matching with '%s'\n", str); + return -1; + } + return found->val; +} + +/* convert a string to upper letters */ +static void strtoupper(char *str) +{ + for (; *str; str++) + *str = toupper(*str); +} + +static void usage(void) +{ + fprintf(stderr, "usage: hda-verb [option] hwdep-device nid verb param\n"); + fprintf(stderr, " -l List known verbs and parameters\n"); + fprintf(stderr, " -L List known verbs and parameters (one per line)\n"); +} + +static void list_verbs(int one_per_line) +{ + fprintf(stderr, "known verbs:\n"); + list_keys(hda_verbs, one_per_line); + fprintf(stderr, "known parameters:\n"); + list_keys(hda_params, one_per_line); +} + +int main(int argc, char **argv) +{ + int version; + int fd; + int nid, verb, param; + int c; + struct hda_verb_ioctl val; + char **p; + + while ((c = getopt(argc, argv, "lL")) >= 0) { + switch (c) { + case 'l': + list_verbs(0); + return 0; + case 'L': + list_verbs(1); + return 0; + default: + usage(); + return 1; + } + } + + if (argc - optind < 4) { + usage(); + return 1; + } + p = argv + optind; + fd = open(*p, O_RDWR); + if (fd < 0) { + perror("open"); + return 1; + } + version = 0; + if (ioctl(fd, HDA_IOCTL_PVERSION, &version) < 0) { + perror("ioctl(PVERSION)"); + fprintf(stderr, "Looks like an invalid hwdep device...\n"); + return 1; + } + if (version < HDA_HWDEP_VERSION) { + fprintf(stderr, "Invalid version number 0x%x\n", version); + fprintf(stderr, "Looks like an invalid hwdep device...\n"); + return 1; + } + + p++; + nid = strtol(*p, NULL, 0); + if (nid < 0 || nid > 0xff) { + fprintf(stderr, "invalid nid %s\n", *p); + return 1; + } + + p++; + if (!isdigit(**p)) { + strtoupper(*p); + verb = lookup_str(hda_verbs, *p); + if (verb < 0) + return 1; + } else { + verb = strtol(*p, NULL, 0); + if (verb < 0 || verb > 0xfff) { + fprintf(stderr, "invalid verb %s\n", *p); + return 1; + } + } + p++; + if (!isdigit(**p)) { + strtoupper(*p); + param = lookup_str(hda_params, *p); + if (param < 0) + return 1; + } else { + param = strtol(*p, NULL, 0); + if (param < 0 || param > 0xffff) { + fprintf(stderr, "invalid param %s\n", *p); + return 1; + } + } + fprintf(stderr, "nid = 0x%x, verb = 0x%x, param = 0x%x\n", + nid, verb, param); + + val.verb = HDA_VERB(nid, verb, param); + if (ioctl(fd, HDA_IOCTL_VERB_WRITE, &val) < 0) + perror("ioctl"); + printf("value = 0x%x\n", val.res); + close(fd); + return 0; +} diff --git a/hda-verb/hda_hwdep.h b/hda-verb/hda_hwdep.h new file mode 100644 index 0000000..1c0034e --- /dev/null +++ b/hda-verb/hda_hwdep.h @@ -0,0 +1,44 @@ +/* + * HWDEP Interface for HD-audio codec + * + * Copyright (c) 2007 Takashi Iwai <[email protected]> + * + * This driver is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This driver is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __SOUND_HDA_HWDEP_H +#define __SOUND_HDA_HWDEP_H + +#define HDA_HWDEP_VERSION ((1 << 16) | (0 << 8) | (0 << 0)) /* 1.0.0 */ + +/* verb */ +#define HDA_REG_NID_SHIFT 24 +#define HDA_REG_VERB_SHIFT 8 +#define HDA_REG_VAL_SHIFT 0 +#define HDA_VERB(nid,verb,param) ((nid)<<24 | (verb)<<8 | (param)) + +struct hda_verb_ioctl { + u32 verb; /* HDA_VERB() */ + u32 res; /* response */ +}; + +/* + * ioctls + */ +#define HDA_IOCTL_PVERSION _IOR('H', 0x10, int) +#define HDA_IOCTL_VERB_WRITE _IOWR('H', 0x11, struct hda_verb_ioctl) +#define HDA_IOCTL_GET_WCAP _IOWR('H', 0x12, struct hda_verb_ioctl) + +#endif -- 1.7.9.2 ++++++ 0005-Convert-hda-verb-to-use-automake.patch ++++++ >From 2996581ce2c2131804a5766a8bb6995e674965b8 Mon Sep 17 00:00:00 2001 From: Takashi Iwai <[email protected]> Date: Fri, 20 Apr 2012 15:54:49 +0200 Subject: [PATCH] Convert hda-verb to use automake Signed-off-by: Takashi Iwai <[email protected]> --- hda-verb/Makefile | 15 --------------- hda-verb/Makefile.am | 12 ++++++++++++ hda-verb/configure.ac | 7 +++++++ hda-verb/gitcompile | 13 +++++++++++++ 4 files changed, 32 insertions(+), 15 deletions(-) delete mode 100644 hda-verb/Makefile create mode 100644 hda-verb/Makefile.am create mode 100644 hda-verb/configure.ac create mode 100755 hda-verb/gitcompile diff --git a/hda-verb/Makefile b/hda-verb/Makefile deleted file mode 100644 index 260831a..0000000 --- a/hda-verb/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -VERSION = 0.4 - -CC = gcc -CFLAGS = -Wall -O2 -g - -hda-verb: hda-verb.o - $(CC) -o $@ hda-verb.o - -clean: - rm -f hda-verb *.o - -dist: - cd ..; mv hda-verb hda-verb-$(VERSION); \ - tar cfz hda-verb-$(VERSION).tar.gz --exclude='.git*' hda-verb-$(VERSION); \ - mv hda-verb-$(VERSION) hda-verb diff --git a/hda-verb/Makefile.am b/hda-verb/Makefile.am new file mode 100644 index 0000000..7dab1d9 --- /dev/null +++ b/hda-verb/Makefile.am @@ -0,0 +1,12 @@ +AUTOMAKE_OPTIONS = 1.3 foreign +bin_PROGRAMS = hda-verb +hda_verb_SOURCES = hda-verb.c +noinst_HEADERS = hda_hwdep.h + +EXTRA_DIST = gitcompile README ChangeLog + +alsa-dist: distdir + @rm -rf ../distdir/$(MYNAME) + @mkdir -p ../distdir/$(MYNAME) + @cp -RLpv $(distdir)/* ../distdir/$(MYNAME) + @rm -rf $(distdir) diff --git a/hda-verb/configure.ac b/hda-verb/configure.ac new file mode 100644 index 0000000..94ca73b --- /dev/null +++ b/hda-verb/configure.ac @@ -0,0 +1,7 @@ +AC_INIT(hda-verb.c) +AM_INIT_AUTOMAKE(hda-verb, 0.4) +AC_PROG_CC +AC_PROG_INSTALL +AC_HEADER_STDC + +AC_OUTPUT(Makefile) diff --git a/hda-verb/gitcompile b/hda-verb/gitcompile new file mode 100755 index 0000000..58328bd --- /dev/null +++ b/hda-verb/gitcompile @@ -0,0 +1,13 @@ +#!/bin/bash + +aclocal $ACLOCAL_FLAGS || exit 1 +automake --foreign --add-missing || exit 1 +autoconf || exit 1 +export CFLAGS='-O2 -Wall -pipe -g' +echo "CFLAGS=$CFLAGS" +echo "./configure $@" +./configure $@ || exit 1 +unset CFLAGS +if [ -z "$GITCOMPILE_NO_MAKE" ]; then + make || exit 1 +fi -- 1.7.9.2 -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
