mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-14 04:54:49 +00:00
Merge b35c7cf4cae35fc39046036174e7c58681d3a0aa into 3687972db7564359b727160cf3d3cf743c226c38
This commit is contained in:
commit
3af0de5235
@ -7,7 +7,7 @@
|
||||
#
|
||||
#
|
||||
RPMS=git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel
|
||||
DEBS=git build-essential automake autoconf 'libtool-bin|libtool' wget python uuid-dev zlib1g-dev 'libjpeg8-dev|libjpeg62-turbo-dev' libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison libvlc-dev pkg-config
|
||||
DEBS=git build-essential automake autoconf 'libtool-bin|libtool' wget python uuid-dev zlib1g-dev 'libjpeg8-dev|libjpeg62-turbo-dev' libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libspeexdsp-dev libsqlite3-dev perl libdb-dev bison libvlc-dev pkg-config
|
||||
|
||||
freeswitch: deps has-git freeswitch.git/Makefile
|
||||
cd freeswitch.git && make
|
||||
|
2
debian/bootstrap.sh
vendored
2
debian/bootstrap.sh
vendored
@ -335,7 +335,7 @@ Build-Depends:
|
||||
# documentation
|
||||
doxygen,
|
||||
# for APR (not essential for build)
|
||||
uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev,
|
||||
uuid-dev, libexpat1-dev, libdb-dev,
|
||||
# used by many modules
|
||||
libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev,
|
||||
bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.17),
|
||||
|
12
debian/control-modules
vendored
12
debian/control-modules
vendored
@ -484,9 +484,9 @@ Module: endpoints/mod_verto
|
||||
Description: Adds mod_verto.
|
||||
Adds mod_verto.
|
||||
Build-Depends: libperl-dev
|
||||
Build-Depends-Buster: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bookworm: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Buster: libperl-dev
|
||||
Build-Depends-Bullseye: libperl-dev
|
||||
Build-Depends-Bookworm: libperl-dev
|
||||
|
||||
## mod/event_handlers
|
||||
|
||||
@ -654,9 +654,9 @@ Module: languages/mod_perl
|
||||
Description: mod_perl
|
||||
Adds mod_perl.
|
||||
Build-Depends: libperl-dev
|
||||
Build-Depends-Buster: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bullseye: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Bookworm: libperl-dev, libgdbm-compat-dev
|
||||
Build-Depends-Buster: libperl-dev
|
||||
Build-Depends-Bullseye: libperl-dev
|
||||
Build-Depends-Bookworm: libperl-dev
|
||||
|
||||
Module: languages/mod_python
|
||||
Description: mod_python
|
||||
|
2099
debian/copyright
vendored
2099
debian/copyright
vendored
File diff suppressed because it is too large
Load Diff
23
debian/license-reconcile.yml
vendored
23
debian/license-reconcile.yml
vendored
@ -64,18 +64,6 @@ Rules:
|
||||
Glob: libs/win32/sqlite/parse.c
|
||||
Matches: The\sauthor\sdisclaims\scopyright\sto\sthis\ssource\scode.
|
||||
License: public-domain
|
||||
-
|
||||
Glob: libs/apr-util/crypto/apr_md5.c
|
||||
Matches: Licensed\sunder\sthe\sApache\sLicense,\sVersion\s2.0
|
||||
Matches: THE\sBEER-WARE\sLICENSE
|
||||
License: RSA and Apache-2.0 and Beerware
|
||||
Copyright: 1991-1992, RSA Data Security, Inc.
|
||||
Copyright: 2000-2005 The Apache Software Foundation or its licensors
|
||||
Copyright: phk@login.dknet.dk
|
||||
-
|
||||
Glob: libs/apr-util/*/apr_md[45].[ch]
|
||||
Matches: Copyright\s\(C\)\s1991-2,\sRSA\sData\sSecurity,\sInc.
|
||||
Copyright: 1991-1992, RSA Data Security, Inc.
|
||||
-
|
||||
Glob: libs/apr/file_io/unix/mktemp.c
|
||||
Matches: The\sASF\slicenses\sthis\sfile\sto\sYou\sunder\sthe\sApache\sLicense,\sVersion\s2.0
|
||||
@ -104,17 +92,6 @@ Rules:
|
||||
Matches: Copyright\s\(c\)\s1992,\s1993
|
||||
Matches: The\sRegents\sof\sthe\sUniversity\sof\sCalifornia.
|
||||
Copyright: 1992, 1993 The Regents of the University of California.
|
||||
-
|
||||
Glob: libs/apr-util/ldap/apr_ldap_url.c
|
||||
Matches: Copyright\s2000-2005\sThe\sApache\sSoftware\sFoundation\sor\sits\slicensors
|
||||
Copyright: 2000-2005 The Apache Software Foundation or its licensors
|
||||
Matches: Copyright\s1998-2002\sThe\sOpenLDAP\sFoundation
|
||||
Copyright: 1998-2002 The OpenLDAP Foundation
|
||||
Matches: Copyright\s\(c\)\s1992-1996\sRegents\sof\sthe\sUniversity\sof\sMichigan.
|
||||
Copyright: 1992-1996 Regents of the University of Michigan.
|
||||
Matches: http://www.OpenLDAP.org/license.html\sor\sin\sfile\sLICENSE\sin\sthe
|
||||
License: Apache-2.0 and OpenLDAP and BSD-like
|
||||
Justification: silly hack to shut up the 'by' problem
|
||||
-
|
||||
Glob: libs/js/*
|
||||
Matches: Version:\sMPL\s1.1/GPL\s2.0/LGPL\s2.1
|
||||
|
@ -13,7 +13,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install \
|
||||
# build
|
||||
build-essential cmake automake autoconf 'libtool-bin|libtool' pkg-config \
|
||||
# general
|
||||
libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev libexpat1-dev libgdbm-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \
|
||||
libssl-dev zlib1g-dev libdb-dev unixodbc-dev libncurses5-dev libexpat1-dev bison erlang-dev libtpl-dev libtiff5-dev uuid-dev \
|
||||
# core
|
||||
libpcre3-dev libedit-dev libsqlite3-dev libcurl4-openssl-dev nasm \
|
||||
# core codecs
|
||||
|
@ -248,7 +248,7 @@ freeswitch_debian_source() {
|
||||
|
||||
freeswitch_raspbian_source() {
|
||||
apt-get install -o Dpkg::Progress=1 -y autoconf automake devscripts gawk libjpeg-dev libncurses5-dev libtool-bin python-dev \
|
||||
libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev \
|
||||
libtiff5-dev libperl-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev \
|
||||
libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev libsndfile-dev libopus-dev liblua5.1-0-dev 2>&1 | \
|
||||
awk -W interactive '/Progress/ { print }'| sed -u 's/[^0-9]//g' | dialog --gauge "Please wait.\n Installing Build Requirements..." 10 70 0
|
||||
build_fs
|
||||
|
@ -8,7 +8,7 @@ wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub
|
||||
|
||||
echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main" > /etc/apt/sources.list.d/freeswitch.list
|
||||
|
||||
apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfreetype6-dev git-buildpackage doxygen yasm gdb git build-essential automake autoconf wget uuid-dev zlib1g-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libsqlite3-dev perl libgdbm-dev libdb-dev bison pkg-config ccache libpng16-dev libpng12-dev libopenal-dev libbroadvoice-dev libcodec2-dev libflite-dev libg7221-dev libilbc-dev libsilk-dev liblua5.2-dev libopus-dev libsndfile-dev libavformat-dev libavcodec-extra libswscale-dev libx264-dev libperl-dev unixodbc-dev libpq-dev libsctp-dev
|
||||
apt-get update && apt-get install -y libtool libjpeg62-turbo-dev ntpdate libfreetype6-dev git-buildpackage doxygen yasm gdb git build-essential automake autoconf wget uuid-dev zlib1g-dev libncurses5-dev libssl-dev libpcre3-dev libcurl4-openssl-dev libldns-dev libedit-dev libspeexdsp-dev libsqlite3-dev perl libdb-dev bison pkg-config ccache libpng16-dev libpng12-dev libopenal-dev libbroadvoice-dev libcodec2-dev libflite-dev libg7221-dev libilbc-dev libsilk-dev liblua5.2-dev libopus-dev libsndfile-dev libavformat-dev libavcodec-extra libswscale-dev libx264-dev libperl-dev unixodbc-dev libpq-dev libsctp-dev
|
||||
|
||||
cd /usr/src
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: win32/getopt.cpp
|
||||
// Purpose:
|
||||
// Author: unknown, I found it in the internet
|
||||
// Author: Henry Spencer
|
||||
// Id: $Id: getopt.cpp,v 1.1.1.1 2004/11/24 10:30:11 jb Exp $
|
||||
// Copyright: (c) 2001 ?
|
||||
// Licence: (I think Open Source)
|
||||
// Copyright: (c) 1984 Henry Spencer
|
||||
// Licence: public domain
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -1,93 +0,0 @@
|
||||
#
|
||||
# Asterisk -- A telephony toolkit for Linux.
|
||||
#
|
||||
# Makefile for channel drivers
|
||||
#
|
||||
# Copyright (C) 1999-2005, Mark Spencer
|
||||
#
|
||||
# Mark Spencer <markster@digium.com>
|
||||
#
|
||||
# Edited By Belgarath <> Aug 28 2004
|
||||
# Added bare bones ultrasparc-linux support.
|
||||
#
|
||||
# This program is free software, distributed under the terms of
|
||||
# the GNU General Public License
|
||||
#
|
||||
|
||||
#ASTERISK INCLUDE FILES
|
||||
#The directory that contains the Asterisk include files (eg: /usr/include or /usr/include/asterisk or /usr/src/asterisk/include or ...)
|
||||
#AST_INCLUDE_DIR=/usr/src/asterisk/include
|
||||
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_trunk/include
|
||||
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_160/include
|
||||
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_12/include
|
||||
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_asterisk_branches_14/include
|
||||
#AST_INCLUDE_DIR=/home/maruzz/devel/svn_celliax_trunk/asterisk-1.2.rev137401/include
|
||||
AST_INCLUDE_DIR=/home/user/devel/asterisk-1.4.23.1/include
|
||||
|
||||
#ASTERISK
|
||||
CFLAGS+=-DASTERISK
|
||||
|
||||
#ASTERISK VERSION
|
||||
#Uncomment one of the following lines to match your Asterisk series
|
||||
CFLAGS+=-DASTERISK_VERSION_1_4
|
||||
#CFLAGS+=-DASTERISK_VERSION_1_6
|
||||
#CFLAGS+=-DASTERISK_VERSION_1_2
|
||||
|
||||
#LINUX SKYPE SUPPORT (Celliax for Cygwin always supports Skype)
|
||||
SKYPE_LIB=-L/usr/X11R6/lib -lX11
|
||||
|
||||
CFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
|
||||
CFLAGS+=-g3
|
||||
|
||||
|
||||
|
||||
CFLAGS+=-I$(AST_INCLUDE_DIR) -I.
|
||||
CFLAGS+=-D_REENTRANT -D_GNU_SOURCE
|
||||
#CFLAGS+=-O6
|
||||
CFLAGS+=-march=i686
|
||||
CFLAGS+=-fomit-frame-pointer
|
||||
ifeq ($(shell uname -m),x86_64)
|
||||
CFLAGS+=-fPIC
|
||||
endif
|
||||
|
||||
SVNDEF := -D'SKYPIAX_SVN_VERSION="$(shell svnversion -n ..)"'
|
||||
CFLAGS += $(SVNDEF)
|
||||
|
||||
|
||||
SOLINK=-shared -Xlinker -x
|
||||
CHANNEL_LIBS=chan_skypiax.so
|
||||
CC=gcc
|
||||
|
||||
OSARCH=$(shell uname -s)
|
||||
|
||||
ifeq ($(findstring CYGWIN,$(OSARCH)),CYGWIN)
|
||||
# definition of pthread_kill as a printf (or as a noop) is required for Asterisk (and skypiax) to run on Cygwin
|
||||
# without it, each time (often) pthread_kill is called (by any thread, with any signal, URG included), bad things happen
|
||||
CC=gcc -D pthread_kill=cyg_no_pthreadkill
|
||||
AST_DLL_DIR=/home/maruzz/devel/svn_asterisk_branches_12
|
||||
CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols cyg_no_pthread_kill.o
|
||||
CYGSOLIB=-L/usr/lib/w32api -lrpcrt4 -L/lib/mingw -lwinmm -L$(AST_DLL_DIR) -lasterisk.dll -L$(AST_DLL_DIR)/res -lres_features.so
|
||||
SKYPE_LIB=
|
||||
CHANNEL_LIBS=cyg_no_pthread_kill.o chan_skypiax.so
|
||||
endif
|
||||
|
||||
all: $(CHANNEL_LIBS)
|
||||
|
||||
clean:
|
||||
rm -f *.so *.o *.so.a
|
||||
|
||||
|
||||
#chan_skypiax section begins
|
||||
|
||||
#to debug threads and lock on 1.4 uncomment the following
|
||||
#CFLAGS+=-include /usr/src/asterisk/include/asterisk/autoconfig.h
|
||||
|
||||
|
||||
cyg_no_pthread_kill.o: cyg_no_pthread_kill.c
|
||||
$(CC) $(CFLAGS) -c -o cyg_no_pthread_kill.o cyg_no_pthread_kill.c
|
||||
chan_skypiax.o: chan_skypiax.c
|
||||
$(CC) $(CFLAGS) -c -o chan_skypiax.o chan_skypiax.c
|
||||
chan_skypiax.so: chan_skypiax.o skypiax_protocol.o
|
||||
$(CC) $(SOLINK) -o $@ ${CYGSOLINK} chan_skypiax.o skypiax_protocol.o -lm -ldl $(SKYPE_LIB) ${CYGSOLIB}
|
||||
#chan_skypiax section ends
|
||||
|
@ -1 +0,0 @@
|
||||
Skypopen for asterisk does not work yet.
|
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#define PRINTMSGCYG
|
||||
|
||||
extern int option_debug;
|
||||
int cyg_no_pthreadkill(int thread, int sig);
|
||||
|
||||
int cyg_no_pthreadkill(int thread, int sig)
|
||||
{
|
||||
#ifdef PRINTMSGCYG
|
||||
if (option_debug) {
|
||||
printf
|
||||
("\n\nHere there would have been a pthread_kill() on thread [%-7lx], with sig=%d, but it has been substituted by this printf in file cyg_no_pthread_kill.c because CYGWIN does not support sending a signal to a one only thread :-(\n\n",
|
||||
(unsigned long int) thread, sig);
|
||||
}
|
||||
#endif // PRINTMSGCYG
|
||||
return 0;
|
||||
}
|
@ -1,207 +0,0 @@
|
||||
;;;;;;;;
|
||||
;;;;;;;;
|
||||
;;;;;;; Skypiax Asterisk Driver
|
||||
;;;;;;;
|
||||
;;;;;;; Configuration file
|
||||
;;;;;;; lines beginning with semicolon (" are ignored (commented out)
|
||||
;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;
|
||||
;;;;;;; The first interface (named skypeclient)
|
||||
;;;;;;[skypeclient]
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;; general settings, valid on all platforms
|
||||
;;;;;;;
|
||||
;;;;;;;
|
||||
;;;;;;; Default language
|
||||
;;;;;;;
|
||||
;;;;;;language=en
|
||||
;;;;;;;
|
||||
;;;;;;; Default context (in extensions.conf, can be overridden with @context syntax)
|
||||
;;;;;;;
|
||||
;;;;;;context=default
|
||||
;;;;;;;
|
||||
;;;;;;; Default extension (in extensions.conf) where incoming calls land
|
||||
;;;;;;;
|
||||
;;;;;;extension=s
|
||||
;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;; Debugging settings, valid globally for all interfaces on all platforms
|
||||
;;;;;;;
|
||||
;;;;;;; the debug values are global for all the interfaces.
|
||||
;;;;;;;
|
||||
;;;;;;; default is no skypiax debugging output, you **have** to activate debugging here to obtain debugging from skypiax
|
||||
;;;;;;;
|
||||
;;;;;;; To see the debugging output you have to "set debug 100" from the Asterisk CLI or launch
|
||||
;;;;;;; Asterisk with -ddddddddddd option, and have the logger.conf file activating debug info for console and messages
|
||||
;;;;;;;
|
||||
;;;;;;; You can activate each of the following separately, but you can't disactivate. Eg: debug_at=no does not subtract debug_at from debug_all
|
||||
;;;;;;; debug_all activate all possible debugging info
|
||||
;;;;;;;
|
||||
;;;;;;;debug_all=yes
|
||||
;;;;;;debug_skype=yes
|
||||
;;;;;;debug_pbx=yes
|
||||
;;;;;;;debug_sound=yes
|
||||
;;;;;;;debug_locks=yes
|
||||
;;;;;;;debug_monitorlocks=yes
|
||||
;;;;;;
|
||||
;;;;;;skype=yes ; legacy setting, leave it to yes
|
||||
;;;;;;X11_display=:101
|
||||
;;;;;;tcp_cli_port=11234
|
||||
;;;;;;tcp_srv_port=11235
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;;;;;; audio boost settings, valid for all platforms, to compensate for different input/output audio signal levels
|
||||
;;;;;;; tweak it if you get horrible (or not hearable) sound
|
||||
;;;;;;;
|
||||
;;;;;;;boost can be positive or negative (-40 to +40) in db
|
||||
;;;;;;;experiment to find which values are best for your computer
|
||||
;;;;;;playback_boost=0 ;
|
||||
;;;;;;capture_boost=0 ;
|
||||
;;;;;;
|
||||
;;; [skypiax1]
|
||||
;;; language=en
|
||||
;;; context=default
|
||||
;;; extension=s
|
||||
;;; debug_skype=yes
|
||||
;;; debug_pbx=yes
|
||||
;;; skype=yes ; legacy setting, leave it to yes
|
||||
;;; playback_boost=0 ;
|
||||
;;; capture_boost=0 ;
|
||||
;;; X11_display=:101
|
||||
;;; tcp_cli_port=15576
|
||||
;;; tcp_srv_port=15577
|
||||
;;; skype_user=skypiax1
|
||||
;;;
|
||||
;;; [skypiax2]
|
||||
;;; language=en
|
||||
;;; context=default
|
||||
;;; extension=s
|
||||
;;; debug_skype=yes
|
||||
;;; debug_pbx=yes
|
||||
;;; skype=yes ; legacy setting, leave it to yes
|
||||
;;; playback_boost=0 ;
|
||||
;;; capture_boost=0 ;
|
||||
;;; X11_display=:102
|
||||
;;; tcp_cli_port=15578
|
||||
;;; tcp_srv_port=15579
|
||||
;;; skype_user=skypiax2
|
||||
;;;
|
||||
;;; [skypiax3]
|
||||
;;; language=en
|
||||
;;; context=default
|
||||
;;; extension=s
|
||||
;;; debug_skype=yes
|
||||
;;; debug_pbx=yes
|
||||
;;; skype=yes ; legacy setting, leave it to yes
|
||||
;;; playback_boost=0 ;
|
||||
;;; capture_boost=0 ;
|
||||
;;; X11_display=:103
|
||||
;;; tcp_cli_port=15580
|
||||
;;; tcp_srv_port=15581
|
||||
;;; skype_user=skypiax3
|
||||
;;;
|
||||
[skypiax4]
|
||||
language=en
|
||||
context=default
|
||||
extension=s
|
||||
debug_skype=yes
|
||||
debug_pbx=yes
|
||||
skype=yes ; legacy setting, leave it to yes
|
||||
playback_boost=0 ;
|
||||
capture_boost=0 ;
|
||||
X11_display=:104
|
||||
tcp_cli_port=15582
|
||||
tcp_srv_port=15583
|
||||
skype_user=skypiax4
|
||||
|
||||
[skypiax5]
|
||||
language=en
|
||||
context=default
|
||||
extension=s
|
||||
debug_skype=yes
|
||||
debug_pbx=yes
|
||||
skype=yes ; legacy setting, leave it to yes
|
||||
playback_boost=0 ;
|
||||
capture_boost=0 ;
|
||||
X11_display=:105
|
||||
tcp_cli_port=15584
|
||||
tcp_srv_port=15585
|
||||
skype_user=skypiax5
|
||||
|
||||
[skypiax6]
|
||||
language=en
|
||||
context=default
|
||||
extension=s
|
||||
debug_skype=yes
|
||||
debug_pbx=yes
|
||||
skype=yes ; legacy setting, leave it to yes
|
||||
playback_boost=0 ;
|
||||
capture_boost=0 ;
|
||||
X11_display=:106
|
||||
tcp_cli_port=15586
|
||||
tcp_srv_port=16586
|
||||
skype_user=skypiax6
|
||||
|
||||
;;; [skypiax17]
|
||||
;;; language=en
|
||||
;;; context=default
|
||||
;;; extension=s
|
||||
;;; debug_skype=yes
|
||||
;;; debug_pbx=yes
|
||||
;;; skype=yes ; legacy setting, leave it to yes
|
||||
;;; playback_boost=0 ;
|
||||
;;; capture_boost=0 ;
|
||||
;;; X11_display=:117
|
||||
;;; tcp_cli_port=15587
|
||||
;;; tcp_srv_port=15588
|
||||
;;; skype_user=skypiax17
|
||||
;;;
|
||||
;;; [skypiax18]
|
||||
;;; language=en
|
||||
;;; context=default
|
||||
;;; extension=s
|
||||
;;; debug_skype=yes
|
||||
;;; debug_pbx=yes
|
||||
;;; skype=yes ; legacy setting, leave it to yes
|
||||
;;; playback_boost=0 ;
|
||||
;;; capture_boost=0 ;
|
||||
;;; X11_display=:118
|
||||
;;; tcp_cli_port=15589
|
||||
;;; tcp_srv_port=15590
|
||||
;;; skype_user=skypiax18
|
||||
;;;
|
||||
;;; [skypiax19]
|
||||
;;; language=en
|
||||
;;; context=default
|
||||
;;; extension=s
|
||||
;;; debug_skype=yes
|
||||
;;; debug_pbx=yes
|
||||
;;; skype=yes ; legacy setting, leave it to yes
|
||||
;;; playback_boost=0 ;
|
||||
;;; capture_boost=0 ;
|
||||
;;; X11_display=:119
|
||||
;;; tcp_cli_port=15591
|
||||
;;; tcp_srv_port=15592
|
||||
;;; skype_user=skypiax19
|
||||
;;;
|
||||
;;; [skypiax20]
|
||||
;;; language=en
|
||||
;;; context=default
|
||||
;;; extension=s
|
||||
;;; debug_skype=yes
|
||||
;;; debug_pbx=yes
|
||||
;;; skype=yes ; legacy setting, leave it to yes
|
||||
;;; playback_boost=0 ;
|
||||
;;; capture_boost=0 ;
|
||||
;;; X11_display=:120
|
||||
;;; tcp_cli_port=15593
|
||||
;;; tcp_srv_port=15594
|
||||
;;; skype_user=skypiax20
|
||||
;;;
|
||||
;;;
|
||||
;;;
|
@ -1,427 +0,0 @@
|
||||
//indent -gnu -ts4 -br -brs -cdw -lp -ce -nbfda -npcs -nprs -npsl -nbbo -saf -sai -saw -cs -bbo -nhnl -nut -sob -l90
|
||||
#ifndef _SKYPIAX_H_
|
||||
#define _SKYPIAX_H_
|
||||
|
||||
#ifndef SKYPIAX_SVN_VERSION
|
||||
#define SKYPIAX_SVN_VERSION "????NO_REVISION???"
|
||||
#endif
|
||||
|
||||
#include <asterisk/version.h> /* needed here for conditional compilation on version.h */
|
||||
/* the following #defs are for LINUX */
|
||||
#ifndef __CYGWIN__
|
||||
#ifndef ASTERISK_VERSION_1_6
|
||||
#ifndef ASTERISK_VERSION_1_4
|
||||
#ifndef ASTERISK_VERSION_1_2
|
||||
#define ASTERISK_VERSION_1_4
|
||||
#if(ASTERISK_VERSION_NUM == 999999)
|
||||
#undef ASTERISK_VERSION_1_4
|
||||
#elif(ASTERISK_VERSION_NUM < 10400)
|
||||
#undef ASTERISK_VERSION_1_4
|
||||
#endif /* ASTERISK_VERSION_NUM == 999999 || ASTERISK_VERSION_NUM < 10400 */
|
||||
#endif /* ASTERISK_VERSION_1_2 */
|
||||
#endif /* ASTERISK_VERSION_1_4 */
|
||||
#endif /* ASTERISK_VERSION_1_6 */
|
||||
#ifdef ASTERISK_VERSION_1_2
|
||||
#undef ASTERISK_VERSION_1_4
|
||||
#endif /* ASTERISK_VERSION_1_2 */
|
||||
#ifdef ASTERISK_VERSION_1_6
|
||||
#define ASTERISK_VERSION_1_4
|
||||
#endif /* ASTERISK_VERSION_1_6 */
|
||||
#define SKYPIAX_SKYPE
|
||||
#define WANT_SKYPE_X11
|
||||
#endif /* NOT __CYGWIN__ */
|
||||
/* the following #defs are for WINDOWS */
|
||||
#ifdef __CYGWIN__
|
||||
#undef ASTERISK_VERSION_1_4
|
||||
#undef ASTERISK_VERSION_1_6
|
||||
#define SKYPIAX_SKYPE
|
||||
#undef WANT_SKYPE_X11
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
/* INCLUDES */
|
||||
#ifdef ASTERISK_VERSION_1_6
|
||||
#include <asterisk.h> /* some asterisk-devel package do not contains asterisk.h, but seems that is needed for the 1.6 series, at least from trunk */
|
||||
#endif /* ASTERISK_VERSION_1_6 */
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/time.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <ctype.h>
|
||||
#ifndef ASTERISK_VERSION_1_4
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#endif /* ASTERISK_VERSION_1_4 */
|
||||
#include <asterisk/frame.h>
|
||||
#include <asterisk/channel.h>
|
||||
#include <asterisk/module.h>
|
||||
#include <asterisk/options.h>
|
||||
#include <asterisk/pbx.h>
|
||||
#include <asterisk/config.h>
|
||||
#include <asterisk/cli.h>
|
||||
#include <asterisk/causes.h>
|
||||
#include <asterisk/endian.h>
|
||||
#include <asterisk/lock.h>
|
||||
#include <asterisk/devicestate.h>
|
||||
#include <asterisk/file.h>
|
||||
#include <asterisk/say.h>
|
||||
#ifdef ASTERISK_VERSION_1_6
|
||||
#include <asterisk/astobj2.h>
|
||||
#include <asterisk/paths.h>
|
||||
#endif /* ASTERISK_VERSION_1_6 */
|
||||
#ifdef ASTERISK_VERSION_1_4
|
||||
#include <asterisk/stringfields.h>
|
||||
#include <asterisk/abstract_jb.h>
|
||||
#include <asterisk/logger.h>
|
||||
#include <asterisk/utils.h>
|
||||
#endif /* ASTERISK_VERSION_1_4 */
|
||||
#ifdef ASTERISK_VERSION_1_2
|
||||
#include <asterisk/utils.h>
|
||||
#include <asterisk/logger.h>
|
||||
#endif /* ASTERISK_VERSION_1_2 */
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
//#include "skypiax_spandsp.h"
|
||||
#ifdef __CYGWIN__
|
||||
#include <windows.h>
|
||||
#endif /* __CYGWIN__ */
|
||||
#ifdef WANT_SKYPE_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xlibint.h>
|
||||
#include <X11/Xatom.h>
|
||||
#endif /* WANT_SKYPE_X11 */
|
||||
#ifndef AST_DIGIT_ANYDIG
|
||||
#define AST_DIGIT_ANYDIG "0123456789*#"
|
||||
#else
|
||||
#warning Please review Skypiax AST_DIGIT_ANYDIG
|
||||
#endif
|
||||
#ifndef _ASTERISK_H
|
||||
#define AST_CONFIG_MAX_PATH 255 /* defined in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
|
||||
extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
|
||||
int ast_register_atexit(void (*func) (void)); /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
|
||||
void ast_unregister_atexit(void (*func) (void)); /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
|
||||
#endif
|
||||
|
||||
/* DEFINITIONS */
|
||||
#define SAMPLERATE_SKYPIAX 8000
|
||||
#define SAMPLES_PER_FRAME SAMPLERATE_SKYPIAX/50
|
||||
#define SKYPIAX_DIR_CONFIG "directoriax.conf"
|
||||
|
||||
/* LUIGI RIZZO's magic */
|
||||
/* boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must
|
||||
* be representable in 16 bits to avoid overflows.
|
||||
*/
|
||||
#define BOOST_SCALE (1<<9)
|
||||
#define BOOST_MAX 40 /* slightly less than 7 bits */
|
||||
/* call flow from the device */
|
||||
#define CALLFLOW_CALL_IDLE AST_STATE_DOWN
|
||||
#define CALLFLOW_INCOMING_RING AST_STATE_RING
|
||||
#define CALLFLOW_CALL_DIALING AST_STATE_DIALING
|
||||
#define CALLFLOW_CALL_LINEBUSY AST_STATE_BUSY
|
||||
#define CALLFLOW_CALL_ACTIVE 300
|
||||
#define CALLFLOW_INCOMING_HANGUP 100
|
||||
#define CALLFLOW_CALL_RELEASED 101
|
||||
#define CALLFLOW_CALL_NOCARRIER 102
|
||||
#define CALLFLOW_CALL_INFLUX 103
|
||||
#define CALLFLOW_CALL_INCOMING 104
|
||||
#define CALLFLOW_CALL_FAILED 105
|
||||
#define CALLFLOW_CALL_NOSERVICE 106
|
||||
#define CALLFLOW_CALL_OUTGOINGRESTRICTED 107
|
||||
#define CALLFLOW_CALL_SECURITYFAIL 108
|
||||
#define CALLFLOW_CALL_NOANSWER 109
|
||||
#define CALLFLOW_STATUS_FINISHED 110
|
||||
#define CALLFLOW_STATUS_CANCELLED 111
|
||||
#define CALLFLOW_STATUS_FAILED 112
|
||||
#define CALLFLOW_STATUS_REFUSED 113
|
||||
#define CALLFLOW_STATUS_RINGING 114
|
||||
#define CALLFLOW_STATUS_INPROGRESS 115
|
||||
#define CALLFLOW_STATUS_UNPLACED 116
|
||||
#define CALLFLOW_STATUS_ROUTING 117
|
||||
#define CALLFLOW_STATUS_EARLYMEDIA 118
|
||||
#define AST_STATE_HANGUP_REQUESTED 200
|
||||
//FIXME CALLFLOW_INCOMING_CALLID to be removed
|
||||
#define CALLFLOW_INCOMING_CALLID 1019
|
||||
/* debugging bitmask */
|
||||
#define DEBUG_SOUND 1
|
||||
#define DEBUG_SERIAL 2
|
||||
#define DEBUG_SKYPE 4
|
||||
#define DEBUG_AT 8
|
||||
#define DEBUG_FBUS2 16
|
||||
#define DEBUG_CALL 32
|
||||
#define DEBUG_LOCKS 64
|
||||
#define DEBUG_PBX 128
|
||||
#define DEBUG_MONITORLOCKS 256
|
||||
#define DEBUG_ALL DEBUG_SOUND|DEBUG_SERIAL|DEBUG_SKYPE|DEBUG_AT|DEBUG_FBUS2|DEBUG_CALL|DEBUG_PBX|DEBUG_LOCKS|DEBUG_MONITORLOCKS
|
||||
/* wrappers for ast_log */
|
||||
#define DEBUGA_SOUND(...) if (skypiax_debug & DEBUG_SOUND) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SOUND %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define DEBUGA_SERIAL(...) if (skypiax_debug & DEBUG_SERIAL) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SERIAL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define DEBUGA_SKYPE(...) if (skypiax_debug & DEBUG_SKYPE) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define DEBUGA_AT(...) if (skypiax_debug & DEBUG_AT) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_AT %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define DEBUGA_FBUS2(...) if (skypiax_debug & DEBUG_FBUS2) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_FBUS2 %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define DEBUGA_CALL(...) if (skypiax_debug & DEBUG_CALL) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_CALL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define DEBUGA_PBX(...) if (skypiax_debug & DEBUG_PBX) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_PBX %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define ERRORA(...) ast_log(LOG_ERROR, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][ERROR %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define NOTICA(...) ast_log(LOG_NOTICE, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][NOTICE %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
#define WARNINGA(...) ast_log(LOG_WARNING, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][WARNING %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ );
|
||||
/* macros for logging */
|
||||
#define SKYPIAX_P_LOG p ? p->owner : NULL, (unsigned long)pthread_self(), __LINE__, p ? p->name ? p->name : "none" : "none", p ? p->owner ? p->owner->_state : -1 : -1, p ? p->interface_state : -1, p ? p->skype_callflow : -1
|
||||
#define SKYPIAX_TMP_LOG tmp ? tmp->owner : NULL, (unsigned long)pthread_self(), __LINE__, tmp ? tmp->name ? tmp->name : "none" : "none", tmp ? tmp->owner ? tmp->owner->_state : -1 : -1, tmp ? tmp->interface_state : -1, tmp ? tmp->skype_callflow : -1
|
||||
/* logging wrappers for ast_mutex_lock and ast_mutex_unlock */
|
||||
#define LOKKA(x) if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] going to lock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_lock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] locked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
|
||||
#define UNLOCKA(x) if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] going to unlock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_unlock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_LOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_LOCKS %-5d][%-10s][%2d,%2d,%2d] unlocked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
|
||||
#define PUSHA_UNLOCKA(x) pthread_cleanup_push(skypiax_unlocka_log, (void *) x);
|
||||
#define POPPA_UNLOCKA(x) pthread_cleanup_pop(0);
|
||||
#define MONITORLOKKA(x) if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] going to lock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_lock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] locked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
|
||||
#define MONITORUNLOCKA(x) if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] going to unlock %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????"); if (ast_mutex_unlock(x)) ast_log(LOG_ERROR, "ast_mutex_lock failed, BAD\n"); if (skypiax_debug & DEBUG_MONITORLOCKS) ast_log(LOG_DEBUG, "rev "SKYPIAX_SVN_VERSION "[%p|%-7lx][DEBUG_MONITORLOCKS %-5d][%-10s][%2d,%2d,%2d] unlocked %p (%s)\n", SKYPIAX_P_LOG, x, x == &skypiax_monlock ? "MONLOCK" : x == &skypiax_iflock ? "IFLOCK" : x == &skypiax_usecnt_lock ? "USECNT_LOCK" : "?????");
|
||||
/* macros used for config file parsing (luigi rizzo)*/
|
||||
#define M_BOOL(tag, dst) M_F(tag, (dst) = ast_true(__val) )
|
||||
#define M_END(x) x;
|
||||
#define M_F(tag, f) if (!strcasecmp((__s), tag)) { f; } else
|
||||
#ifdef ASTERISK_VERSION_1_6
|
||||
#define M_START(var, val) const char *__s = var; const char *__val = val;
|
||||
#else
|
||||
#define M_START(var, val) char *__s = var; char *__val = val;
|
||||
#endif /* ASTERISK_VERSION_1_6 */
|
||||
#define M_STR(tag, dst) M_F(tag, ast_copy_string(dst, __val, sizeof(dst)))
|
||||
#define M_UINT(tag, dst) M_F(tag, (dst) = strtoul(__val, NULL, 0) )
|
||||
|
||||
#define SKYPIAX_FRAME_SIZE 160
|
||||
|
||||
/* SKYPIAX INTERNAL STRUCTS */
|
||||
/*!
|
||||
* \brief structure for exchanging messages with the skype client
|
||||
*/
|
||||
#ifdef WANT_SKYPE_X11
|
||||
struct AsteriskHandles {
|
||||
Window skype_win;
|
||||
Display *disp;
|
||||
Window win;
|
||||
int fdesc[2];
|
||||
};
|
||||
#else /* WANT_SKYPE_X11 */
|
||||
struct AsteriskHandles {
|
||||
HWND win32_hInit_MainWindowHandle;
|
||||
HWND win32_hGlobal_SkypeAPIWindowHandle;
|
||||
int fdesc[2];
|
||||
};
|
||||
#endif /* WANT_SKYPE_X11 */
|
||||
|
||||
#ifndef WIN32
|
||||
struct SkypiaxHandles {
|
||||
Window skype_win;
|
||||
Display *disp;
|
||||
Window win;
|
||||
int api_connected;
|
||||
int fdesc[2];
|
||||
};
|
||||
#else //WIN32
|
||||
|
||||
struct SkypiaxHandles {
|
||||
HWND win32_hInit_MainWindowHandle;
|
||||
HWND win32_hGlobal_SkypeAPIWindowHandle;
|
||||
HINSTANCE win32_hInit_ProcessHandle;
|
||||
char win32_acInit_WindowClassName[128];
|
||||
UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach;
|
||||
UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover;
|
||||
int api_connected;
|
||||
int fdesc[2];
|
||||
};
|
||||
|
||||
#endif //WIN32
|
||||
|
||||
/*!
|
||||
* \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
|
||||
*/
|
||||
struct skypiax_pvt {
|
||||
char *name; /*!< \brief 'name' of the interface (channel) */
|
||||
int interface_state; /*!< \brief 'state' of the interface (channel) */
|
||||
struct ast_channel *owner; /*!< \brief channel we belong to, possibly NULL */
|
||||
struct skypiax_pvt *next; /*!< \brief Next interface (channel) in list */
|
||||
char context[AST_MAX_EXTENSION]; /*!< \brief default Asterisk dialplan context for this interface */
|
||||
char language[MAX_LANGUAGE]; /*!< \brief default Asterisk dialplan language for this interface */
|
||||
char exten[AST_MAX_EXTENSION]; /*!< \brief default Asterisk dialplan extension for this interface */
|
||||
int skypiax_sound_rate; /*!< \brief rate of the sound device, in Hz, eg: 8000 */
|
||||
int skypiax_sound_capt_fd; /*!< \brief file descriptor for sound capture dev */
|
||||
char callid_name[50];
|
||||
char callid_number[50];
|
||||
pthread_t controldev_thread; /*!< \brief serial control thread for this interface, running during the call */
|
||||
double playback_boost;
|
||||
double capture_boost;
|
||||
int stripmsd;
|
||||
pthread_t skype_thread;
|
||||
struct AsteriskHandles AsteriskHandlesAst;
|
||||
struct SkypiaxHandles SkypiaxHandles;
|
||||
char skype_call_id[512];
|
||||
int skype_call_ongoing;
|
||||
char skype_friends[4096];
|
||||
char skype_fullname[512];
|
||||
char skype_displayname[512];
|
||||
int skype_callflow; /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
|
||||
int skype; /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
|
||||
int control_to_send;
|
||||
int audiopipe[2];
|
||||
int audioskypepipe[2];
|
||||
pthread_t tcp_srv_thread;
|
||||
pthread_t tcp_cli_thread;
|
||||
short audiobuf[160];
|
||||
int audiobuf_is_loaded;
|
||||
|
||||
//int phonebook_listing;
|
||||
//int phonebook_querying;
|
||||
//int phonebook_listing_received_calls;
|
||||
|
||||
//int phonebook_first_entry;
|
||||
//int phonebook_last_entry;
|
||||
//int phonebook_number_lenght;
|
||||
//int phonebook_text_lenght;
|
||||
FILE *phonebook_writing_fp;
|
||||
int skypiax_dir_entry_extension_prefix;
|
||||
#ifdef WIN32
|
||||
unsigned short tcp_cli_port;
|
||||
unsigned short tcp_srv_port;
|
||||
#else
|
||||
int tcp_cli_port;
|
||||
int tcp_srv_port;
|
||||
#endif
|
||||
char X11_display[256];
|
||||
|
||||
struct ast_frame read_frame;
|
||||
|
||||
char skype_user[256];
|
||||
char skype_password[256];
|
||||
char destination[256];
|
||||
char session_uuid_str[512 + 1];
|
||||
pthread_t signaling_thread;
|
||||
};
|
||||
|
||||
typedef struct skypiax_pvt private_t;
|
||||
/* FUNCTIONS */
|
||||
|
||||
/* module helpers functions */
|
||||
int load_module(void);
|
||||
int unload_module(void);
|
||||
int usecount(void);
|
||||
char *description(void);
|
||||
char *key(void);
|
||||
|
||||
/* chan_skypiax internal functions */
|
||||
void skypiax_unlocka_log(void *x);
|
||||
|
||||
void *do_skypeapi_thread(void *data);
|
||||
//int skypiax2skype(struct ast_channel *c, void *data);
|
||||
//int skype2skypiax(struct ast_channel *c, void *data);
|
||||
//void skypiax_disconnect(void);
|
||||
int skypiax_signaling_write(struct skypiax_pvt *p, char *msg_to_skype);
|
||||
int skypiax_signaling_read(struct skypiax_pvt *p);
|
||||
int skypiax_console_skype(int fd, int argc, char *argv[]);
|
||||
#ifdef WANT_SKYPE_X11
|
||||
int X11_errors_handler(Display * dpy, XErrorEvent * err);
|
||||
int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P);
|
||||
int skypiax_present(struct SkypiaxHandles *SkypiaxHandles);
|
||||
void skypiax_clean_disp(void *data);
|
||||
#endif /* WANT_SKYPE_X11 */
|
||||
#ifdef __CYGWIN__
|
||||
|
||||
int win32_Initialize_CreateWindowClass(private_t * tech_pvt);
|
||||
void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt);
|
||||
int win32_Initialize_CreateMainWindow(private_t * tech_pvt);
|
||||
void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt);
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
/* CHAN_SKYPIAX.C */
|
||||
int skypiax_queue_control(struct ast_channel *chan, int control);
|
||||
struct skypiax_pvt *skypiax_console_find_desc(char *dev);
|
||||
int skypiax_serial_call(struct skypiax_pvt *p, char *dstr);
|
||||
|
||||
/* FUNCTIONS */
|
||||
/* PBX interface functions */
|
||||
struct ast_channel *skypiax_request(const char *type, int format, void *data, int *cause);
|
||||
int skypiax_answer(struct ast_channel *c);
|
||||
int skypiax_hangup(struct ast_channel *c);
|
||||
int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout);
|
||||
struct ast_frame *skypiax_read(struct ast_channel *chan);
|
||||
int skypiax_write(struct ast_channel *c, struct ast_frame *f);
|
||||
int skypiax_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
|
||||
#ifndef ASTERISK_VERSION_1_4
|
||||
int skypiax_indicate(struct ast_channel *c, int cond);
|
||||
#else
|
||||
int skypiax_indicate(struct ast_channel *c, int cond, const void *data, size_t datalen);
|
||||
#endif
|
||||
int skypiax_devicestate(void *data);
|
||||
#ifdef ASTERISK_VERSION_1_4
|
||||
int skypiax_digitsend_begin(struct ast_channel *ast, char digit);
|
||||
int skypiax_digitsend_end(struct ast_channel *ast, char digit, unsigned int duration);
|
||||
#else /* ASTERISK_VERSION_1_4 */
|
||||
int skypiax_digitsend(struct ast_channel *ast, char digit);
|
||||
#endif /* ASTERISK_VERSION_1_4 */
|
||||
|
||||
/* chan_skypiax internal functions */
|
||||
|
||||
struct skypiax_pvt *skypiax_mkif(struct ast_config *cfg, char *ctg, int is_first_category);
|
||||
struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context);
|
||||
int skypiax_restart_monitor(void);
|
||||
void *skypiax_do_monitor(void *data);
|
||||
int skypiax_sound_boost(struct ast_frame *f, double boost);
|
||||
int skypiax_sound_init(struct skypiax_pvt *p);
|
||||
int skypiax_sound_shutdown(struct skypiax_pvt *p);
|
||||
struct ast_frame *skypiax_sound_read(struct skypiax_pvt *p);
|
||||
int skypiax_sound_write(struct skypiax_pvt *p, struct ast_frame *f);
|
||||
void *skypiax_do_controldev_thread(void *data);
|
||||
#ifdef ASTERISK_VERSION_1_6
|
||||
void skypiax_store_boost(const char *s, double *boost);
|
||||
#else
|
||||
void skypiax_store_boost(char *s, double *boost);
|
||||
#endif /* ASTERISK_VERSION_1_6 */
|
||||
int skypiax_console_set_active(int fd, int argc, char *argv[]);
|
||||
int skypiax_console_hangup(int fd, int argc, char *argv[]);
|
||||
int skypiax_console_playback_boost(int fd, int argc, char *argv[]);
|
||||
int skypiax_console_capture_boost(int fd, int argc, char *argv[]);
|
||||
int skypiax_console_skypiax(int fd, int argc, char *argv[]);
|
||||
int skypiax_console_dial(int fd, int argc, char *argv[]);
|
||||
int skypiax_audio_init(struct skypiax_pvt *p);
|
||||
//struct ast_frame *skypiax_audio_read(struct skypiax_pvt *p);
|
||||
int skypiax_audio_read(struct skypiax_pvt *p);
|
||||
void *skypiax_do_tcp_srv_thread(void *data);
|
||||
int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f);
|
||||
void *skypiax_do_tcp_cli_thread(void *data);
|
||||
int skypiax_call(struct skypiax_pvt *p, char *idest, int timeout);
|
||||
int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[]);
|
||||
|
||||
void *skypiax_do_tcp_srv_thread_func(void *obj);
|
||||
void *skypiax_do_tcp_cli_thread_func(void *obj);
|
||||
void *skypiax_do_skypeapi_thread_func(void *obj);
|
||||
int dtmf_received(private_t * tech_pvt, char *value);
|
||||
int start_audio_threads(private_t * tech_pvt);
|
||||
int new_inbound_channel(private_t * tech_pvt);
|
||||
int outbound_channel_answered(private_t * tech_pvt);
|
||||
int skypiax_senddigit(struct skypiax_pvt *p, char digit);
|
||||
int skypiax_signaling_write(private_t * tech_pvt, char *msg_to_skype);
|
||||
#if defined(WIN32) && !defined(__CYGWIN__)
|
||||
int skypiax_pipe_read(switch_file_t * pipe, short *buf, int howmany);
|
||||
int skypiax_pipe_write(switch_file_t * pipe, short *buf, int howmany);
|
||||
/* Visual C do not have strsep ? */
|
||||
char *strsep(char **stringp, const char *delim);
|
||||
#else
|
||||
int skypiax_pipe_read(int pipe, short *buf, int howmany);
|
||||
int skypiax_pipe_write(int pipe, short *buf, int howmany);
|
||||
#endif /* WIN32 */
|
||||
int skypiax_close_socket(unsigned int fd);
|
||||
private_t *find_available_skypiax_interface(void);
|
||||
int remote_party_is_ringing(private_t * tech_pvt);
|
||||
int remote_party_is_early_media(private_t * tech_pvt);
|
||||
#define SKYPIAX_STATE_DOWN AST_STATE_DOWN
|
||||
#define SKYPIAX_STATE_RING AST_STATE_RING
|
||||
#define SKYPIAX_STATE_DIALING AST_STATE_DIALING
|
||||
#define SKYPIAX_STATE_BUSY AST_STATE_BUSY
|
||||
#define SKYPIAX_STATE_UP AST_STATE_UP
|
||||
#define SKYPIAX_STATE_RINGING AST_STATE_RINGING
|
||||
#define SKYPIAX_STATE_PRERING AST_STATE_PRERING
|
||||
#define SKYPIAX_STATE_RESERVED AST_STATE_RESERVED
|
||||
#define SKYPIAX_STATE_HANGUP_REQUESTED 200
|
||||
#endif /* _SKYPIAX_H_ */
|
@ -1,821 +0,0 @@
|
||||
/*
|
||||
* Dummy soundcard
|
||||
* Copyright (c) by Jaroslav Kysela <perex@perex.cz>
|
||||
*
|
||||
* This program 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 program 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/control.h>
|
||||
#include <sound/tlv.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/rawmidi.h>
|
||||
#include <sound/initval.h>
|
||||
|
||||
|
||||
MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
|
||||
MODULE_DESCRIPTION("Dummy soundcard (/dev/null)");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}");
|
||||
|
||||
#define MAX_PCM_DEVICES 4
|
||||
#define MAX_PCM_SUBSTREAMS 128
|
||||
#define MAX_MIDI_DEVICES 2
|
||||
|
||||
|
||||
/* defaults */
|
||||
#ifndef MAX_BUFFER_SIZE
|
||||
#define MAX_BUFFER_SIZE (64*1024)
|
||||
#endif
|
||||
#ifndef MAX_PERIOD_SIZE
|
||||
#define MAX_PERIOD_SIZE MAX_BUFFER_SIZE
|
||||
#endif
|
||||
#ifndef USE_FORMATS
|
||||
#define USE_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE)
|
||||
#endif
|
||||
#ifndef USE_RATE
|
||||
#define USE_RATE SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000
|
||||
#define USE_RATE_MIN 5500
|
||||
#define USE_RATE_MAX 48000
|
||||
#endif
|
||||
#ifndef USE_CHANNELS_MIN
|
||||
#define USE_CHANNELS_MIN 1
|
||||
#endif
|
||||
#ifndef USE_CHANNELS_MAX
|
||||
#define USE_CHANNELS_MAX 2
|
||||
#endif
|
||||
#ifndef USE_PERIODS_MIN
|
||||
#define USE_PERIODS_MIN 10
|
||||
#endif
|
||||
#ifndef USE_PERIODS_MAX
|
||||
#define USE_PERIODS_MAX 1024
|
||||
#endif
|
||||
#ifndef add_playback_constraints
|
||||
#define add_playback_constraints(x) 0
|
||||
#endif
|
||||
#ifndef add_capture_constraints
|
||||
#define add_capture_constraints(x) 0
|
||||
#endif
|
||||
|
||||
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
||||
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
||||
static int enable[SNDRV_CARDS] = { 1,[1 ... (SNDRV_CARDS - 1)] = 0 };
|
||||
static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 };
|
||||
static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128 };
|
||||
|
||||
|
||||
module_param_array(index, int, NULL, 0444);
|
||||
MODULE_PARM_DESC(index, "Index value for dummy soundcard.");
|
||||
module_param_array(id, charp, NULL, 0444);
|
||||
MODULE_PARM_DESC(id, "ID string for dummy soundcard.");
|
||||
module_param_array(enable, bool, NULL, 0444);
|
||||
MODULE_PARM_DESC(enable, "Enable this dummy soundcard.");
|
||||
module_param_array(pcm_devs, int, NULL, 0444);
|
||||
MODULE_PARM_DESC(pcm_devs, "PCM devices # (0-4) for dummy driver.");
|
||||
module_param_array(pcm_substreams, int, NULL, 0444);
|
||||
MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-64) for dummy driver.");
|
||||
|
||||
static struct platform_device *devices[SNDRV_CARDS];
|
||||
static struct timer_list dummytimer;
|
||||
static int dummystarted = 0;
|
||||
static int dummyindex = 0;
|
||||
static spinlock_t dummylock;
|
||||
struct dummydpcm {
|
||||
struct snd_pcm_substream *substream;
|
||||
struct snd_dummy_pcm *dpcm;
|
||||
int started;
|
||||
int elapsed;
|
||||
};
|
||||
static struct dummydpcm dummydpcms[MAX_PCM_SUBSTREAMS];
|
||||
|
||||
#define MIXER_ADDR_MASTER 0
|
||||
#define MIXER_ADDR_LINE 1
|
||||
#define MIXER_ADDR_MIC 2
|
||||
#define MIXER_ADDR_SYNTH 3
|
||||
#define MIXER_ADDR_CD 4
|
||||
#define MIXER_ADDR_LAST 4
|
||||
|
||||
static void snd_card_dummy_pcm_timer_function(unsigned long data);
|
||||
struct snd_dummy {
|
||||
struct snd_card *card;
|
||||
struct snd_pcm *pcm;
|
||||
spinlock_t mixer_lock;
|
||||
int mixer_volume[MIXER_ADDR_LAST + 1][2];
|
||||
int capture_source[MIXER_ADDR_LAST + 1][2];
|
||||
};
|
||||
|
||||
struct snd_dummy_pcm {
|
||||
struct snd_dummy *dummy;
|
||||
//spinlock_t lock;
|
||||
//struct timer_list timer;
|
||||
unsigned int pcm_buffer_size;
|
||||
unsigned int pcm_period_size;
|
||||
unsigned int pcm_bps; /* bytes per second */
|
||||
unsigned int pcm_hz; /* HZ */
|
||||
unsigned int pcm_irq_pos; /* IRQ position */
|
||||
unsigned int pcm_buf_pos; /* position in buffer */
|
||||
struct snd_pcm_substream *substream;
|
||||
};
|
||||
|
||||
|
||||
static inline void snd_card_dummy_pcm_timer_start(struct snd_dummy_pcm *dpcm)
|
||||
{
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
for (i = 0; i < dummyindex + 1; i++) {
|
||||
//if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
//printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm);
|
||||
//}
|
||||
|
||||
if (dummydpcms[i].dpcm == dpcm) {
|
||||
dummydpcms[i].started = 1;
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
//if (!found) {
|
||||
//printk("skypopen: start, NOT found?\n");
|
||||
//}
|
||||
}
|
||||
|
||||
static inline void snd_card_dummy_pcm_timer_stop(struct snd_dummy_pcm *dpcm)
|
||||
{
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
for (i = 0; i < dummyindex + 1; i++) {
|
||||
|
||||
//if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
//printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm);
|
||||
//}
|
||||
if (dummydpcms[i].dpcm == dpcm) {
|
||||
dummydpcms[i].started = 0;
|
||||
dummydpcms[i].elapsed = 0;
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
static int snd_card_dummy_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_dummy_pcm *dpcm = runtime->private_data;
|
||||
int err = 0;
|
||||
|
||||
spin_lock_bh(&dummylock);
|
||||
switch (cmd) {
|
||||
case SNDRV_PCM_TRIGGER_START:
|
||||
case SNDRV_PCM_TRIGGER_RESUME:
|
||||
snd_card_dummy_pcm_timer_start(dpcm);
|
||||
break;
|
||||
case SNDRV_PCM_TRIGGER_STOP:
|
||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
snd_card_dummy_pcm_timer_stop(dpcm);
|
||||
break;
|
||||
default:
|
||||
err = -EINVAL;
|
||||
break;
|
||||
}
|
||||
spin_unlock_bh(&dummylock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_dummy_pcm *dpcm = runtime->private_data;
|
||||
int bps;
|
||||
|
||||
bps = snd_pcm_format_width(runtime->format) * runtime->rate * runtime->channels / 8;
|
||||
|
||||
if (bps <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
dpcm->pcm_bps = bps;
|
||||
dpcm->pcm_hz = HZ;
|
||||
dpcm->pcm_buffer_size = snd_pcm_lib_buffer_bytes(substream);
|
||||
dpcm->pcm_period_size = snd_pcm_lib_period_bytes(substream);
|
||||
dpcm->pcm_irq_pos = 0;
|
||||
dpcm->pcm_buf_pos = 0;
|
||||
snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void snd_card_dummy_pcm_timer_function(unsigned long data)
|
||||
{
|
||||
struct snd_dummy_pcm *dpcm = NULL;
|
||||
int i;
|
||||
|
||||
|
||||
dummytimer.expires = 1 + jiffies;
|
||||
add_timer(&dummytimer);
|
||||
|
||||
//spin_lock_bh(&dummylock);
|
||||
for (i = 0; i < dummyindex + 1; i++) {
|
||||
|
||||
#if 0
|
||||
if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm);
|
||||
}
|
||||
#endif
|
||||
if (dummydpcms[i].started != 1)
|
||||
continue;
|
||||
dpcm = dummydpcms[i].dpcm;
|
||||
#if 0
|
||||
if (dpcm == NULL) {
|
||||
printk("dummy: timer_func %d %d NULL: continue\n", __LINE__, i);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
//spin_lock_bh(&dpcm->lock);
|
||||
dpcm->pcm_irq_pos += dpcm->pcm_bps * 1;
|
||||
dpcm->pcm_buf_pos += dpcm->pcm_bps * 1;
|
||||
dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz;
|
||||
if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
|
||||
dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
|
||||
//spin_unlock_bh(&dpcm->lock);
|
||||
//snd_pcm_period_elapsed(dpcm->substream);
|
||||
dummydpcms[i].elapsed = 1;
|
||||
} else {
|
||||
//spin_unlock_bh(&dpcm->lock);
|
||||
}
|
||||
}
|
||||
//spin_unlock_bh(&dummylock);
|
||||
for (i = 0; i < dummyindex + 1; i++) {
|
||||
|
||||
#if 0
|
||||
if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm);
|
||||
}
|
||||
#endif
|
||||
if (dummydpcms[i].started != 1)
|
||||
continue;
|
||||
dpcm = dummydpcms[i].dpcm;
|
||||
#if 0
|
||||
if (dpcm == NULL) {
|
||||
printk("dummy: timer_func %d %d NULL: continue\n", __LINE__, i);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (dummydpcms[i].elapsed){
|
||||
snd_pcm_period_elapsed(dpcm->substream);
|
||||
dummydpcms[i].elapsed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_dummy_pcm *dpcm = runtime->private_data;
|
||||
|
||||
//return bytes_to_frames(runtime, dpcm->pcm_buf_pos / dpcm->pcm_hz);
|
||||
return (dpcm->pcm_buf_pos / dpcm->pcm_hz) / 2;
|
||||
}
|
||||
|
||||
static struct snd_pcm_hardware snd_card_dummy_playback = {
|
||||
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
|
||||
//.info = (SNDRV_PCM_INFO_INTERLEAVED),
|
||||
.formats = USE_FORMATS,
|
||||
.rates = USE_RATE,
|
||||
.rate_min = USE_RATE_MIN,
|
||||
.rate_max = USE_RATE_MAX,
|
||||
.channels_min = USE_CHANNELS_MIN,
|
||||
.channels_max = USE_CHANNELS_MAX,
|
||||
.buffer_bytes_max = MAX_BUFFER_SIZE,
|
||||
//.period_bytes_min = 256,
|
||||
.period_bytes_min = 2048,
|
||||
.period_bytes_max = MAX_PERIOD_SIZE,
|
||||
.periods_min = USE_PERIODS_MIN,
|
||||
.periods_max = USE_PERIODS_MAX,
|
||||
.fifo_size = 0,
|
||||
};
|
||||
|
||||
static struct snd_pcm_hardware snd_card_dummy_capture = {
|
||||
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
|
||||
//.info = (SNDRV_PCM_INFO_INTERLEAVED),
|
||||
.formats = USE_FORMATS,
|
||||
.rates = USE_RATE,
|
||||
.rate_min = USE_RATE_MIN,
|
||||
.rate_max = USE_RATE_MAX,
|
||||
.channels_min = USE_CHANNELS_MIN,
|
||||
.channels_max = USE_CHANNELS_MAX,
|
||||
.buffer_bytes_max = MAX_BUFFER_SIZE,
|
||||
//.period_bytes_min = 256,
|
||||
.period_bytes_min = 2048,
|
||||
.period_bytes_max = MAX_PERIOD_SIZE,
|
||||
.periods_min = USE_PERIODS_MIN,
|
||||
.periods_max = USE_PERIODS_MAX,
|
||||
.fifo_size = 0,
|
||||
};
|
||||
|
||||
static void snd_card_dummy_runtime_free(struct snd_pcm_runtime *runtime)
|
||||
{
|
||||
int i;
|
||||
|
||||
spin_lock_bh(&dummylock);
|
||||
|
||||
for (i = 0; i < dummyindex; i++) {
|
||||
|
||||
if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
printk("dummy, %s:%d, i=%d, dummyindex=%d \n", __FILE__, __LINE__, i, dummyindex);
|
||||
}
|
||||
if ((dummydpcms[i].dpcm == runtime->private_data)) {
|
||||
dummydpcms[i].started = 0;
|
||||
dummydpcms[i].elapsed = 0;
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_bh(&dummylock);
|
||||
kfree(runtime->private_data);
|
||||
}
|
||||
|
||||
static int snd_card_dummy_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params)
|
||||
{
|
||||
return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
|
||||
}
|
||||
|
||||
static int snd_card_dummy_hw_free(struct snd_pcm_substream *substream)
|
||||
{
|
||||
return snd_pcm_lib_free_pages(substream);
|
||||
}
|
||||
|
||||
static struct snd_dummy_pcm *new_pcm_stream(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_dummy_pcm *dpcm;
|
||||
int i;
|
||||
int found = 0;
|
||||
|
||||
dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
|
||||
if (!dpcm) {
|
||||
printk("dummy, %s:%d, dummyindex=%d NO MEMORY!!!!\n", __FILE__, __LINE__, dummyindex);
|
||||
return dpcm;
|
||||
}
|
||||
//init_timer(&dpcm->timer);
|
||||
//spin_lock_init(&dpcm->lock);
|
||||
dpcm->substream = substream;
|
||||
|
||||
spin_lock_bh(&dummylock);
|
||||
for (i = 0; i < dummyindex; i++) {
|
||||
|
||||
//if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
//printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm);
|
||||
//}
|
||||
if ((dummydpcms[i].substream == substream)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
|
||||
dummydpcms[dummyindex].substream = substream;
|
||||
dummyindex++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
found = 0;
|
||||
for (i = 0; i < dummyindex; i++) {
|
||||
|
||||
//if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
//printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm);
|
||||
//}
|
||||
if (dummydpcms[i].substream == substream) {
|
||||
dummydpcms[i].dpcm = dpcm;
|
||||
dummydpcms[i].started = 0;
|
||||
dummydpcms[i].elapsed = 0;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
spin_unlock_bh(&dummylock);
|
||||
//if (!found) {
|
||||
//printk("skypopen dummyindex=%d NOT found????\n", dummyindex);
|
||||
//}
|
||||
return dpcm;
|
||||
}
|
||||
|
||||
static int snd_card_dummy_playback_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_dummy_pcm *dpcm;
|
||||
int err;
|
||||
|
||||
if ((dpcm = new_pcm_stream(substream)) == NULL)
|
||||
return -ENOMEM;
|
||||
runtime->private_data = dpcm;
|
||||
/* makes the infrastructure responsible for freeing dpcm */
|
||||
runtime->private_free = snd_card_dummy_runtime_free;
|
||||
runtime->hw = snd_card_dummy_playback;
|
||||
if (substream->pcm->device & 1) {
|
||||
runtime->hw.info &= ~SNDRV_PCM_INFO_INTERLEAVED;
|
||||
runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED;
|
||||
}
|
||||
if (substream->pcm->device & 2)
|
||||
runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID);
|
||||
err = add_playback_constraints(runtime);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_card_dummy_capture_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_dummy_pcm *dpcm;
|
||||
int err;
|
||||
|
||||
if ((dpcm = new_pcm_stream(substream)) == NULL)
|
||||
return -ENOMEM;
|
||||
runtime->private_data = dpcm;
|
||||
/* makes the infrastructure responsible for freeing dpcm */
|
||||
runtime->private_free = snd_card_dummy_runtime_free;
|
||||
runtime->hw = snd_card_dummy_capture;
|
||||
if (substream->pcm->device == 1) {
|
||||
runtime->hw.info &= ~SNDRV_PCM_INFO_INTERLEAVED;
|
||||
runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED;
|
||||
}
|
||||
if (substream->pcm->device & 2)
|
||||
runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID);
|
||||
err = add_capture_constraints(runtime);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_card_dummy_playback_close(struct snd_pcm_substream *substream)
|
||||
{
|
||||
snd_card_dummy_pcm_timer_stop(substream->private_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_card_dummy_capture_close(struct snd_pcm_substream *substream)
|
||||
{
|
||||
snd_card_dummy_pcm_timer_stop(substream->private_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_pcm_ops snd_card_dummy_playback_ops = {
|
||||
.open = snd_card_dummy_playback_open,
|
||||
.close = snd_card_dummy_playback_close,
|
||||
.ioctl = snd_pcm_lib_ioctl,
|
||||
.hw_params = snd_card_dummy_hw_params,
|
||||
.hw_free = snd_card_dummy_hw_free,
|
||||
.prepare = snd_card_dummy_pcm_prepare,
|
||||
.trigger = snd_card_dummy_pcm_trigger,
|
||||
.pointer = snd_card_dummy_pcm_pointer,
|
||||
};
|
||||
|
||||
static struct snd_pcm_ops snd_card_dummy_capture_ops = {
|
||||
.open = snd_card_dummy_capture_open,
|
||||
.close = snd_card_dummy_capture_close,
|
||||
.ioctl = snd_pcm_lib_ioctl,
|
||||
.hw_params = snd_card_dummy_hw_params,
|
||||
.hw_free = snd_card_dummy_hw_free,
|
||||
.prepare = snd_card_dummy_pcm_prepare,
|
||||
.trigger = snd_card_dummy_pcm_trigger,
|
||||
.pointer = snd_card_dummy_pcm_pointer,
|
||||
};
|
||||
|
||||
static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device, int substreams)
|
||||
{
|
||||
struct snd_pcm *pcm;
|
||||
int err;
|
||||
|
||||
err = snd_pcm_new(dummy->card, "Dummy PCM", device, substreams, substreams, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
dummy->pcm = pcm;
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_dummy_playback_ops);
|
||||
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_dummy_capture_ops);
|
||||
pcm->private_data = dummy;
|
||||
pcm->info_flags = 0;
|
||||
strcpy(pcm->name, "Dummy PCM");
|
||||
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 128 * 1024, 1024 * 1024);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define DUMMY_VOLUME(xname, xindex, addr) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
|
||||
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
|
||||
.name = xname, .index = xindex, \
|
||||
.info = snd_dummy_volume_info, \
|
||||
.get = snd_dummy_volume_get, .put = snd_dummy_volume_put, \
|
||||
.private_value = addr, \
|
||||
.tlv = { .p = db_scale_dummy } }
|
||||
|
||||
static int snd_dummy_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
||||
{
|
||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
||||
uinfo->count = 2;
|
||||
uinfo->value.integer.min = -50;
|
||||
uinfo->value.integer.max = 100;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_dummy_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
|
||||
int addr = kcontrol->private_value;
|
||||
|
||||
if (in_irq())
|
||||
printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__);
|
||||
spin_lock_bh(&dummy->mixer_lock);
|
||||
ucontrol->value.integer.value[0] = dummy->mixer_volume[addr][0];
|
||||
ucontrol->value.integer.value[1] = dummy->mixer_volume[addr][1];
|
||||
spin_unlock_bh(&dummy->mixer_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_dummy_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
|
||||
int change, addr = kcontrol->private_value;
|
||||
int left, right;
|
||||
|
||||
if (in_irq())
|
||||
printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__);
|
||||
left = ucontrol->value.integer.value[0];
|
||||
if (left < -50)
|
||||
left = -50;
|
||||
if (left > 100)
|
||||
left = 100;
|
||||
right = ucontrol->value.integer.value[1];
|
||||
if (right < -50)
|
||||
right = -50;
|
||||
if (right > 100)
|
||||
right = 100;
|
||||
spin_lock_bh(&dummy->mixer_lock);
|
||||
change = dummy->mixer_volume[addr][0] != left || dummy->mixer_volume[addr][1] != right;
|
||||
dummy->mixer_volume[addr][0] = left;
|
||||
dummy->mixer_volume[addr][1] = right;
|
||||
spin_unlock_bh(&dummy->mixer_lock);
|
||||
return change;
|
||||
}
|
||||
|
||||
static const DECLARE_TLV_DB_SCALE(db_scale_dummy, -4500, 30, 0);
|
||||
|
||||
#define DUMMY_CAPSRC(xname, xindex, addr) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
|
||||
.info = snd_dummy_capsrc_info, \
|
||||
.get = snd_dummy_capsrc_get, .put = snd_dummy_capsrc_put, \
|
||||
.private_value = addr }
|
||||
|
||||
#define snd_dummy_capsrc_info snd_ctl_boolean_stereo_info
|
||||
|
||||
static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
|
||||
int addr = kcontrol->private_value;
|
||||
|
||||
if (in_irq())
|
||||
printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__);
|
||||
spin_lock_bh(&dummy->mixer_lock);
|
||||
ucontrol->value.integer.value[0] = dummy->capture_source[addr][0];
|
||||
ucontrol->value.integer.value[1] = dummy->capture_source[addr][1];
|
||||
spin_unlock_bh(&dummy->mixer_lock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
|
||||
int change, addr = kcontrol->private_value;
|
||||
int left, right;
|
||||
|
||||
if (in_irq())
|
||||
printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__);
|
||||
left = ucontrol->value.integer.value[0] & 1;
|
||||
right = ucontrol->value.integer.value[1] & 1;
|
||||
spin_lock_bh(&dummy->mixer_lock);
|
||||
change = dummy->capture_source[addr][0] != left && dummy->capture_source[addr][1] != right;
|
||||
dummy->capture_source[addr][0] = left;
|
||||
dummy->capture_source[addr][1] = right;
|
||||
spin_unlock_bh(&dummy->mixer_lock);
|
||||
return change;
|
||||
}
|
||||
|
||||
static struct snd_kcontrol_new snd_dummy_controls[] = {
|
||||
DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
|
||||
DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
|
||||
DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH),
|
||||
DUMMY_CAPSRC("Synth Capture Switch", 0, MIXER_ADDR_SYNTH),
|
||||
DUMMY_VOLUME("Line Volume", 0, MIXER_ADDR_LINE),
|
||||
DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
|
||||
DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
|
||||
DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
|
||||
DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
|
||||
DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD)
|
||||
};
|
||||
|
||||
static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy)
|
||||
{
|
||||
struct snd_card *card = dummy->card;
|
||||
unsigned int idx;
|
||||
int err;
|
||||
|
||||
return 0; //XXX no mixer
|
||||
spin_lock_init(&dummy->mixer_lock);
|
||||
strcpy(card->mixername, "Dummy Mixer");
|
||||
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __devinit snd_dummy_probe(struct platform_device *devptr)
|
||||
{
|
||||
struct snd_card *card;
|
||||
struct snd_dummy *dummy;
|
||||
int idx, err;
|
||||
int dev = devptr->id;
|
||||
|
||||
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
|
||||
sizeof(struct snd_dummy), &card);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
dummy = card->private_data;
|
||||
dummy->card = card;
|
||||
for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {
|
||||
if (pcm_substreams[dev] < 1)
|
||||
pcm_substreams[dev] = 1;
|
||||
if (pcm_substreams[dev] > MAX_PCM_SUBSTREAMS)
|
||||
pcm_substreams[dev] = MAX_PCM_SUBSTREAMS;
|
||||
err = snd_card_dummy_pcm(dummy, idx, pcm_substreams[dev]);
|
||||
if (err < 0)
|
||||
goto __nodev;
|
||||
}
|
||||
//err = snd_card_dummy_new_mixer(dummy);
|
||||
//if (err < 0)
|
||||
//goto __nodev;
|
||||
strcpy(card->driver, "Dummy");
|
||||
strcpy(card->shortname, "Dummy");
|
||||
sprintf(card->longname, "Dummy %i", dev + 1);
|
||||
|
||||
snd_card_set_dev(card, &devptr->dev);
|
||||
|
||||
err = snd_card_register(card);
|
||||
if (err == 0) {
|
||||
platform_set_drvdata(devptr, card);
|
||||
return 0;
|
||||
}
|
||||
__nodev:
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int __devexit snd_dummy_remove(struct platform_device *devptr)
|
||||
{
|
||||
|
||||
del_timer(&dummytimer);
|
||||
snd_card_free(platform_get_drvdata(devptr));
|
||||
platform_set_drvdata(devptr, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int snd_dummy_suspend(struct platform_device *pdev, pm_message_t state)
|
||||
{
|
||||
struct snd_card *card = platform_get_drvdata(pdev);
|
||||
struct snd_dummy *dummy = card->private_data;
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
||||
snd_pcm_suspend_all(dummy->pcm);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_dummy_resume(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_card *card = platform_get_drvdata(pdev);
|
||||
|
||||
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define SND_DUMMY_DRIVER "snd_dummy"
|
||||
|
||||
static struct platform_driver snd_dummy_driver = {
|
||||
.probe = snd_dummy_probe,
|
||||
.remove = __devexit_p(snd_dummy_remove),
|
||||
#ifdef CONFIG_PM
|
||||
.suspend = snd_dummy_suspend,
|
||||
.resume = snd_dummy_resume,
|
||||
#endif
|
||||
.driver = {
|
||||
.name = SND_DUMMY_DRIVER},
|
||||
};
|
||||
|
||||
static void snd_dummy_unregister_all(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(devices); ++i)
|
||||
platform_device_unregister(devices[i]);
|
||||
platform_driver_unregister(&snd_dummy_driver);
|
||||
}
|
||||
|
||||
static int __init alsa_card_dummy_init(void)
|
||||
{
|
||||
int i, cards, err;
|
||||
|
||||
err = platform_driver_register(&snd_dummy_driver);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (!dummystarted) {
|
||||
dummystarted = 1;
|
||||
spin_lock_init(&dummylock);
|
||||
|
||||
spin_lock_bh(&dummylock);
|
||||
for (i = 0; i < MAX_PCM_SUBSTREAMS; i++) {
|
||||
|
||||
//if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) {
|
||||
//printk("dummy, %s:%d, i=%d, dummyindex=%d \n", __FILE__, __LINE__, i, dummyindex);
|
||||
//}
|
||||
dummydpcms[i].substream = NULL;
|
||||
dummydpcms[i].dpcm = NULL;
|
||||
dummydpcms[i].started = 0;
|
||||
dummydpcms[i].elapsed = 0;
|
||||
}
|
||||
init_timer(&dummytimer);
|
||||
dummytimer.data = (unsigned long) &dummydpcms;
|
||||
dummytimer.function = snd_card_dummy_pcm_timer_function;
|
||||
dummytimer.expires = 1 + jiffies;
|
||||
add_timer(&dummytimer);
|
||||
printk("snd-dummy skypopen driver version: 9, %s:%d working on a machine with %dHZ kernel\n", __FILE__, __LINE__, HZ);
|
||||
spin_unlock_bh(&dummylock);
|
||||
}
|
||||
|
||||
|
||||
cards = 0;
|
||||
for (i = 0; i < SNDRV_CARDS; i++) {
|
||||
struct platform_device *device;
|
||||
if (!enable[i])
|
||||
continue;
|
||||
device = platform_device_register_simple(SND_DUMMY_DRIVER, i, NULL, 0);
|
||||
if (IS_ERR(device))
|
||||
continue;
|
||||
if (!platform_get_drvdata(device)) {
|
||||
platform_device_unregister(device);
|
||||
continue;
|
||||
}
|
||||
devices[i] = device;
|
||||
cards++;
|
||||
}
|
||||
if (!cards) {
|
||||
#ifdef MODULE
|
||||
printk(KERN_ERR "Dummy soundcard not found or device busy\n");
|
||||
#endif
|
||||
snd_dummy_unregister_all();
|
||||
return -ENODEV;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit alsa_card_dummy_exit(void)
|
||||
{
|
||||
del_timer(&dummytimer);
|
||||
snd_dummy_unregister_all();
|
||||
}
|
||||
|
||||
module_init(alsa_card_dummy_init)
|
||||
module_exit(alsa_card_dummy_exit)
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user