codec_proc might specify multiple codec files per card:
codec_proc_file1+codec_proc_file2
- or codec_proc file might be a dump from alsa-info.sh
+ or codec_proc might be a dump from alsa-info.sh
+ or codec_proc might be a hash for codec database at www.alsa-project.org
+ or codec_proc might be a URL for codec dump or alsa-info.sh dump
"""
+import os
import sys
import gobject
import gtk
CODEC_TREE = {}
DIFF_TREE = {}
+def gethttpfile(url, size=1024*1024):
+ from urllib import splithost
+ from httplib import HTTP
+ if not url.startswith('http:'):
+ raise ValueError, "URL %s" % url
+ host, selector = splithost(url[5:])
+ h = HTTP(host)
+ h.putrequest('GET', url)
+ h.endheaders()
+ h.getreply()
+ res = h.getfile().read(size)
+ h.close()
+ return res
+
def read_nodes2(card, codec):
try:
c = HDACodec(card, codec)
a = f.split('+')
idx = 0
if len(a) == 1:
- proc_file = DecodeProcFile(a[0])
+ if a[0].startswith('http://'):
+ proc_file = gethttpfile(a[0])
+ elif len(a[0]) == 40 and not os.path.exists(a[0]):
+ proc_file = gethttpfile('http://www.alsa-project.org/db/?f=' + a[0])
+ else:
+ proc_file = DecodeProcFile(a[0])
if proc_file.find("ALSA Information Script") > 0:
a = []
pos = proc_file.find('HDA-Intel Codec information')
def add_connection(self, line, conn):
line, count = self.decodeintw(line)
- conn = conn.strip()
+ res = 0
+ if conn.startswith(' '):
+ conn = conn.strip()
+ res = 1
+ else:
+ conn = ''
conns = []
sel = -1
while len(conn):
self.wrongfile('connections %s != %s' % (count, len(conns)))
self.connections = conns
self.add_verb(VERBS['GET_CONNECT_SEL'], sel)
+ return res
def add_unsolicited(self, line):
line, tag = self.decodeintw(line, 'tag=')
elif line.startswith(' Amp-Out vals: '):
node.add_ampvals(line[17:], HDA_OUTPUT)
elif line.startswith(' Connection: '):
- node.add_connection(line[13:], lines[idx+1])
- idx += 1
+ idx += node.add_connection(line[13:], lines[idx+1])
elif line == ' PCM:':
node.add_pcm(lines[idx+1], lines[idx+2], lines[idx+3])
idx += 3
pass
elif line.startswith(' Misc = '):
pass
+ elif line.startswith(' Delay: '):
+ pass
elif line.startswith(' Pin-ctls: '):
node.add_pinctls(line[12:])
elif line.startswith(' EAPD '):