rpms/system-config-soundcard/FC-4 system-config-soundcard-1.2.12-update.patch, NONE, 1.1 system-config-soundcard.spec, 1.15, 1.16
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Tue Jan 24 10:25:48 UTC 2006
Author: stransky
Update of /cvs/dist/rpms/system-config-soundcard/FC-4
In directory cvs.devel.redhat.com:/tmp/cvs-serv27892
Modified Files:
system-config-soundcard.spec
Added Files:
system-config-soundcard-1.2.12-update.patch
Log Message:
backported fixes from devel branch (1.2.14)
system-config-soundcard-1.2.12-update.patch:
soundcard.py | 124 +++++++++++++++++++------
soundcardBackend.py | 237 +++++++++++++++++++++++++++++++++++-------------
system-config-soundcard | 17 +++
3 files changed, 289 insertions(+), 89 deletions(-)
--- NEW FILE system-config-soundcard-1.2.12-update.patch ---
--- system-config-soundcard-1.2.12/src/soundcard.py.old 2006-01-24 09:54:41.000000000 +0100
+++ system-config-soundcard-1.2.12/src/soundcard.py 2006-01-17 15:10:55.000000000 +0100
@@ -24,6 +24,7 @@
import sys
import os
import time
+import commands
sys.path.append('/usr/share/system-config-soundcard/')
import soundcardBackend
@@ -56,7 +57,6 @@
def __init__(self, doDebug=None, backend=None):
self.doDebug = doDebug
- self.default_card = ""
if backend == None:
self.soundcardBackend = soundcardBackend.soundcardBackend()
else:
@@ -86,8 +86,6 @@
#Kudzu has found some cards
for card in self.cardList:
self.device, self.module, self.maker, self.model = self.soundcardBackend.getData(card)
- self.default_card = self.model
-
self.table = gtk.Table(2, 3)
self.table.set_border_width(6)
self.table.set_col_spacings(4)
@@ -123,7 +121,7 @@
self.test_button = gtk.Button(_("Play test sound"))
self.test_button.connect("clicked", self.testButtonClicked)
- align = gtk.Alignment(1.0, 0.5)
+ align = gtk.Alignment(0.0, 0.0, 1.0, 1.0)
align.add(self.test_button)
self.table.attach(self.maker_label, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
@@ -134,22 +132,23 @@
self.table.attach(self.module_label2, 1, 2, 2, 3, gtk.FILL, gtk.FILL)
self.table.attach(align, 1, 2, 3, 4)
+ deviceTopBox = gtk.VBox(False, 8)
if len(self.cardList) == 1:
#There is only one card, so hide the tab and border
self.notebook.set_show_tabs(False)
self.notebook.set_show_border(False)
self.label = gtk.Label(_("The following audio device was detected."))
- self.box.pack_start(self.notebook)
- self.soundcardBackend.setDefault(0)
+ self.soundcardBackend.setDefaultCard(0)
else:
#There is more than one card, so show the primary device option menu
self.label = gtk.Label(_("The following audio devices were detected."))
- #Create a menu
+ #Create a menu with primary card
deviceBox = gtk.HBox(False, 8)
+
self.primaryDeviceOptionMenu = gtk.OptionMenu()
self.primaryDeviceMenu = gtk.Menu()
@@ -158,17 +157,48 @@
item = gtk.MenuItem(self.model)
self.primaryDeviceMenu.append(item)
- self.primaryDeviceMenu.set_active(self.cardList.index(self.soundcardBackend.getDefaultCard()))
-
+ selected_card = self.cardList.index(self.soundcardBackend.getDefaultCard())
+ self.primaryDeviceMenu.set_active(selected_card)
self.primaryDeviceOptionMenu.set_menu(self.primaryDeviceMenu)
+
+ deviceBox.pack_start(gtk.Label(_("Default audio card:")), False)
+ deviceBox.pack_start(self.primaryDeviceOptionMenu, True)
+ self.primaryDeviceOptionMenu.connect("changed", self.changeDefaultCard)
- self.box.pack_start(self.notebook)
- deviceBox.pack_start(gtk.Label(_("Primary audio device:")), False)
- deviceBox.pack_start(self.primaryDeviceOptionMenu, True)
- self.box.pack_start(deviceBox)
+ deviceTopBox.pack_start(deviceBox)
+
+ #Create a menu with primary card
+ deviceBox = gtk.HBox(False, 8)
+
+ self.primarySubDeviceOptionMenu = gtk.OptionMenu()
+ self.refreshDeviceList()
+
+ deviceBox.pack_start(gtk.Label(_("Default PCM device:")), False)
+ deviceBox.pack_start(self.primarySubDeviceOptionMenu, True)
+
+ self.primarySubDeviceOptionMenu.connect("changed", self.changeDefaultDevice)
+
+ deviceTopBox.pack_start(deviceBox)
- self.primaryDeviceOptionMenu.connect("changed", self.changeDefault)
+ #Create a check-box for hw/sw config
+ button = gtk.CheckButton(_("Use only the hardware device"))
+ button.set_active(self.soundcardBackend.getHardwareDevice())
+ button.connect("toggled", self.changeHW)
+ button.show()
+
+ deviceTopBox.pack_start(button)
+
+ #Create a check-box for key config
+ button = gtk.CheckButton(_("Dynamic keys for dmix and dsnoop"))
+ button.set_active(self.soundcardBackend.getDynamicKeys())
+ button.connect("toggled", self.changeDynKeys)
+ button.show()
+
+ deviceTopBox.pack_start(button)
+
+ self.box.pack_start(self.notebook)
+ self.box.pack_start(deviceTopBox)
#Add icon to the top frame
p = None
@@ -183,14 +213,61 @@
if p:
self.icon = gtk.Image()
self.icon.set_from_pixbuf(p)
+
+ def refreshDeviceList(self):
+
+ selected_card = self.soundcardBackend.getDefaultCardNum()
+
+ self.primarySubDeviceMenu = gtk.Menu()
+ comp_string = string.join(['card ',`selected_card`,':'],"")
+ comp_string_len = len(comp_string)
+ devices = commands.getoutput('/usr/bin/aplay -l')
+ devices = string.split(devices,'\n')
+
+ self.subdevices = []
+ for line in devices:
+ if not cmp(line[:comp_string_len],comp_string):
+ dev = string.split((string.split(line,',')[1]),':')
+ self.subdevices.append([int(string.split(dev[0])[1]),(dev[1])[1:]]);
+
+ default = self.soundcardBackend.getDefaultDevice()
+ pos = 0
+ itm = 0
+ for sub in self.subdevices:
+ item = gtk.MenuItem(sub[1])
+ self.primarySubDeviceMenu.append(item)
+ item.show()
+ if sub[0] == default:
+ pos = itm
+ itm += 1
+
+ self.primarySubDeviceMenu.set_active(pos)
+ self.primarySubDeviceOptionMenu.set_menu(self.primarySubDeviceMenu)
+ self.primarySubDeviceOptionMenu.show()
+
def closeClicked(self, *args):
self.apply()
gtk.main_quit()
- def changeDefault(self, *args):
- i = self.primaryDeviceOptionMenu.get_history()
- self.soundcardBackend.setDefault(i)
+ def changeDefaultCard(self, *args):
+ self.soundcardBackend.setDefaultCard(self.primaryDeviceOptionMenu.get_history())
+ self.soundcardBackend.setDefaultDevice(0)
+ self.soundcardBackend.writeConfig()
+ self.refreshDeviceList()
+
+ def changeDefaultDevice(self, *args):
+ self.soundcardBackend.setDefaultDevice(self.subdevices[self.primarySubDeviceOptionMenu.get_history()][0])
+ self.soundcardBackend.writeConfig()
+
+ def changeHW(self, widget, data=None):
+ self.soundcardBackend.setHardwareDevice(widget.get_active())
+ self.soundcardBackend.writeConfig()
+
+ def changeDynKeys(self, widget, data=None):
+ self.soundcardBackend.setDynamicKeys(widget.get_active())
+ self.soundcardBackend.writeConfig()
+ self.soundcardBackend.reconfigureDynamicKeys()
def apply(self, *args):
if self.doDebug:
@@ -234,8 +311,10 @@
if rc == gtk.RESPONSE_NO:
#Oh well, they couldn't hear the sound. Notify the user and then quit. We did our best
self.showErrorDialog(_("Automatic detection of the sound card did not work. " \
- "Audio will not be available on the system. Please click " \
- "OK to continue."))
+ "Audio will not be available on the system.\n" \
+ "You can inspect %s and " \
+ "file a new bug\nat http://bugzilla.redhat.com.\n\nPlease click " \
+ "OK to continue.") % "/root/scsound.log")
try:
self.mainWindow.destroy()
except:
@@ -247,7 +326,6 @@
#There is one sound card present. This is the common case
selectedCard = self.soundcardBackend.getData(self.cardList[0])
device, module, maker, model = selectedCard
- self.default_card = model
return 0
elif len(self.cardList) > 1:
@@ -255,7 +333,6 @@
selectedItem = self.primaryDeviceOptionMenu.get_history()
selectedCard = self.soundcardBackend.getData(self.cardList[selectedItem])
device, module, maker, model = selectedCard
- self.default_card = model
return selectedItem
else:
@@ -315,11 +392,6 @@
self.mainWindow.show_all()
gtk.main()
- #The getData function can return the name of the setting being changed
- #This is useful for the hardware screen in firstboot
- def getData(self):
- return self.default_card
-
def showErrorDialog(self, text):
dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, text)
--- system-config-soundcard-1.2.12/src/system-config-soundcard.old 2003-11-20 08:05:02.000000000 +0100
+++ system-config-soundcard-1.2.12/src/system-config-soundcard 2006-01-17 15:10:55.000000000 +0100
@@ -1,4 +1,19 @@
#!/bin/sh
+LOG_FILE="/root/scsound.log"
+
+echo -e "------- System Config Soundcard --------\n`date`\n" > $LOG_FILE 2>&1
+echo -e "------- lspci --------\n`lspci`\n" >> $LOG_FILE 2>&1
+echo -e "------- lsmod --------\n`lsmod`\n" >> $LOG_FILE 2>&1
+echo -e "------- /etc/modprobe.conf --------\n`cat /etc/modprobe.conf`\n" >> $LOG_FILE 2>&1
+echo -e "------- /etc/asound.conf --------\n`cat /etc/asound.conf`\n" >> $LOG_FILE 2>&1
+echo -e "------- aplay -l --------\n`aplay -l 2>&1`\n" >> $LOG_FILE 2>&1
+echo -e "------- amixer --------\n`amixer`\n" >> $LOG_FILE 2>&1
+echo -e "------- /proc/asound/version --------\n`cat /proc/asound/version`\n" >> $LOG_FILE 2>&1
+echo -e "------- /proc/asound/modules --------\n`cat /proc/asound/modules`\n" >> $LOG_FILE 2>&1
+echo -e "------- /proc/asound/pcm --------\n`cat /proc/asound/pcm`\n" >> $LOG_FILE 2>&1
+
+echo -e "------- system-config-soundcard --------\n" >> $LOG_FILE 2>&1
+
export PYTHONPATH=/usr/share/system-config-soundcard
-/usr/bin/python2 /usr/share/system-config-soundcard/system-config-soundcard.py
+/usr/bin/python2 /usr/share/system-config-soundcard/system-config-soundcard.py >> $LOG_FILE 2>&1
--- system-config-soundcard-1.2.12/src/soundcardBackend.py.old 2006-01-24 09:54:41.000000000 +0100
+++ system-config-soundcard-1.2.12/src/soundcardBackend.py 2006-01-17 15:10:55.000000000 +0100
@@ -45,7 +45,11 @@
## Load list of drivers
##
def read_driver_list():
- fd = open('/proc/asound/modules', 'r')
+ try:
+ fd = open('/proc/asound/modules', 'r')
+ except:
+ return []
+
list = fd.readlines()
fd.close()
@@ -57,6 +61,12 @@
return drivers
##
+## Sort fnc for box
+##
+def card_sort(card1, card2):
+ return cmp(card1.position, card2.position)
+
+##
## Usage
##
def usage():
@@ -106,6 +116,11 @@
self.readFile()
self.cardList = []
self.dspList = []
+ self.hardware_device = 0
+ self.default_device = 0
+ self.default_card = 0
+ self.dynamic_keys = 0
+ self.readConfig()
def probeCards(self):
driverList = read_driver_list()
@@ -124,35 +139,38 @@
for card in list:
if card.driver != "unknown":
card.position = position(driverList,card.driver)
- self.cardList.append(card)
+ self.cardList.append(card)
# Only add USB audio devices that have snd-usb-audio as the driver
list = kudzu.probe(kudzu.CLASS_AUDIO, kudzu.BUS_USB, kudzu.PROBE_ALL)
for card in list:
- if card.driver == "snd-usb-audio":
+ if card.driver == "snd-usb-audio":
card.position = position(driverList,card.driver)
- self.cardList.append(card)
+ self.cardList.append(card)
# Same with Mac sound devices
list = kudzu.probe(kudzu.CLASS_AUDIO, kudzu.BUS_MACIO, kudzu.PROBE_ALL)
for card in list:
- if card.driver == "snd_powermac":
- card.position = position(driverList,card.driver)
- self.cardList.append(card)
+ if card.driver == "snd_powermac":
+ card.position = position(driverList,card.driver)
+ self.cardList.append(card)
- self.defaultModule = self.cardList[0].driver
+ self.cardList.sort(card_sort)
+
+ if self.cardList != []:
+ self.defaultModule = self.cardList[0].driver
return self.cardList
def getData(self, card):
device, module, description = card
- if (string.count(description,"|") == 1):
+ if (string.count(description,"|") == 1):
maker, model = string.split(description, "|")
- elif (string.count(description," ") > 0):
- maker, model = string.split(description, " ", 1)
- else:
- maker = description
- model = description
+ elif (string.count(description," ") > 0):
+ maker, model = string.split(description, " ", 1)
+ else:
+ maker = description
+ model = description
return device, module, maker, model
@@ -160,13 +178,13 @@
self.setVolume(index)
if kernel_type == '2.6':
- device = "plughw:%d,0"% index
+ device = "plughw:%d,0"% index
path = "/usr/bin/aplay"
- args = [path, "-D", device, "/usr/share/system-config-soundcard/sound-sample.wav"]
+ args = [path, "-D", device, "-N", "/usr/share/system-config-soundcard/sound-sample.wav"]
if kernel_type == "2.4":
- if self.dspList == []:
+ if self.dspList == []:
device = "/dev/dsp"
else:
device = "/dev/dsp%d" % self.dspList.index(module)
@@ -176,9 +194,9 @@
pid = os.fork()
if (not pid):
- os.execv(path, args)
- else:
- os.waitpid(pid,0)
+ os.execv(path, args)
+ else:
+ os.waitpid(pid,0)
def readFile(self):
if kernel_type == '2.6':
@@ -195,12 +213,6 @@
if (string.find(line, "sound-slot-") < 0 and string.find(line,"snd-card-") < 0) or string.strip(line)[0] == "#":
self.newFile.append(line)
- def getDefaultCard(self):
- try:
- return self.cardList[int(commands.getoutput('/usr/bin/alsacard'))]
- except:
- return self.cardList[0]
-
def writeFile(self, selectedCard):
self.selectedCard = selectedCard
aliasList = []
@@ -251,25 +263,6 @@
fd.close()
- def unloadModules(self):
- for card in self.cardList:
- device, module, maker, model = self.getData(card)
-
- retval = os.system("/sbin/modprobe -r %s" % module)
-
- def setVolumeTrack(self, track, device):
- amixer_path = "/usr/bin/amixer"
- amixer_pid = os.fork()
- amixer_args = [amixer_path, "-q", "-c", device, "sset", track, "75%", "on"]
-
- if (not amixer_pid):
- try:
- os.execv(amixer_path, amixer_args)
- except:
- sys.exit(0)
- else:
- os.waitpid(amixer_pid,0)
-
def setVolume(self, index):
if kernel_type == '2.4':
aumix_path = "/bin/aumix-minimal"
@@ -286,24 +279,145 @@
#alsa drivers load muted. we need to set the volume for them.
if kernel_type == '2.6':
- device = "%d"% index
- self.setVolumeTrack("Master", device)
- self.setVolumeTrack("PCM", device)
- self.setVolumeTrack("PCM-2", device)
- # For PowerMacs
- self.setVolumeTrack("DRC Range", device)
+ amixer_path = "/usr/bin/alsaunmute"
+ amixer_pid = os.fork()
+ amixer_args = [amixer_path, `index`, "-v"]
+
+ if (not amixer_pid):
+ try:
+ os.execv(amixer_path, amixer_args)
+ except:
+ sys.exit(0)
+ else:
+ os.waitpid(amixer_pid,0)
+
+ def setDefaultCard(self, index):
+ self.default_card = index
+
+ def getDefaultCard(self):
+ return self.cardList[self.default_card]
+
+ def getDefaultCardNum(self):
+ return self.default_card
+
+ def setDefaultDevice(self, index):
+ self.default_device = index
- def setDefault(self, index):
+ def getDefaultDevice(self):
+ return self.default_device
+
+ def setHardwareDevice(self, state):
+ self.hardware_device = state;
+
+ def getHardwareDevice(self):
+ return self.hardware_device
+
+ def setDynamicKeys(self, state):
+ self.dynamic_keys = state;
+
+ def getDynamicKeys(self):
+ return self.dynamic_keys
+
+ def reconfigureDynamicKeys(self):
+ if self.dynamic_keys :
+ if os.path.exists("/var/run/console/console.lock"):
+ os.system("/usr/bin/ainit `cat /var/run/console/console.lock` start")
+ else:
+ if os.path.exists("/var/run/console/console.lock"):
+ os.system("/usr/bin/ainit `cat /var/run/console/console.lock` stop")
+
+ def writeConfig(self):
+
+ # Writing to asound.conf
+ index = self.default_card
+ device = self.default_device
+
if kernel_type == '2.6':
- lines = []
- lines.append("# Generated by system-config-soundcard, do not edit by hand\n")
- lines.append("defaults.pcm.card %d \n" % index)
- lines.append("defaults.ctl.card %d \n" % index)
-
- fd = open('/etc/asound.conf', 'w')
- for line in lines:
- fd.write(line)
- fd.close()
+ lines = []
+
+ lines.append("#Generated by system-config-soundcard, do not edit by hand\n")
+ if self.hardware_device:
+ lines.append("#HWCONF\n")
+ lines.append("#DEV %d\n" % device)
+ lines.append("pcm.!default { type hw card %d device %d } \n" % (index, device))
+ lines.append("ctl.!default { type hw card %d }\n" % index)
+ else:
+ lines.append("#SWCONF\n")
+ lines.append("#DEV %d\n" % device)
+ lines.append("defaults.pcm.card %d \n" % index)
+ lines.append("defaults.pcm.device %d \n" % device)
+ lines.append("defaults.ctl.card %d \n" % index)
+
+ fd = open('/etc/asound.conf', 'w')
+ for line in lines:
+ fd.write(line)
+ fd.close()
+
+ # re-writing ainit.conf
+ fd = open('/etc/alsa/ainit.conf', 'r')
+ lines = fd.readlines()
+ fd.close()
+
+ lines_out = []
+ for line in lines:
+ line_tmp = string.split(string.strip(line))
+ if line_tmp != [] and cmp(string.lower(line_tmp[0]),"enable") == 0:
+ if self.dynamic_keys:
+ lines_out.append("enable = yes\n")
+ else:
+ lines_out.append("enable = no\n")
+ else:
+ lines_out.append(line)
+
+ fd = open('/etc/alsa/ainit.conf', 'w')
+ fd.writelines(lines_out)
+ fd.close()
+
+ def readConfig(self):
+ # Check alsa configuration
+ try:
+ fd = open('/etc/asound.conf', 'r')
+ line = fd.readline()
+ line = fd.readline()
+ self.hardware_device = (cmp(line[:7],'#HWCONF') != 1)
+
+ line = fd.readline()
+ if not cmp(line[:4],'#DEV'):
+ self.default_device = int(line[4:])
+
+ fd.close()
+ except:
+ self.hardware_device = 0
+ self.default_device = 0
+
+ # Check ainit configuration
+ try:
+ fd = open('/etc/alsa/ainit.conf', 'r')
+ lines = fd.readlines()
+ fd.close()
+
+ for line in lines:
+ line = string.split(string.strip(line))
+ if line != [] and cmp(string.lower(line[0]),"enable") == 0:
+ self.dynamic_keys = (cmp(string.lower(line[2]),'yes') == 0)
+ break;
+
+ except:
+ self.dynamic_keys = 0
+
+ try:
+ self.default_card = int(commands.getoutput('/usr/bin/alsacard'))
+ except:
+ self.default_card = 0
+
+ print "Read config:\ncard %d\ndevice %d\nHW %d" % (self.default_card, self.default_device, self.hardware_device)
+
+
+ def unloadModules(self):
+ for card in self.cardList:
+ device, module, maker, model = self.getData(card)
+
+ retval = os.system("/sbin/modprobe -r %s" % module)
def loadModules(self):
retval = os.system("/sbin/modprobe %s" % self.defaultModule)
@@ -331,4 +445,3 @@
return self.defaultModule
return 0
-
Index: system-config-soundcard.spec
===================================================================
RCS file: /cvs/dist/rpms/system-config-soundcard/FC-4/system-config-soundcard.spec,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- system-config-soundcard.spec 20 Jun 2005 10:48:17 -0000 1.15
+++ system-config-soundcard.spec 24 Jan 2006 10:25:46 -0000 1.16
@@ -1,7 +1,7 @@
Summary: A graphical interface for detecting and configuring soundcards
Name: system-config-soundcard
Version: 1.2.12
-Release: 2
+Release: 3
URL: http://fedora.redhat.com/projects/config-tools/redhat-config-soundcard.html
License: GPL
ExclusiveOS: Linux
@@ -10,6 +10,7 @@
BuildArch: noarch
Source0: %{name}-%{version}.tar.bz2
Patch0: system-config-soundcard-1.2.12-mod.patch
+Patch1: system-config-soundcard-1.2.12-update.patch
BuildRequires: desktop-file-utils
BuildRequires: gettext
ExcludeArch: s390 s390x
@@ -30,6 +31,7 @@
%prep
%setup -q
%patch -p1 -b .mod
+%patch1 -p1 -b .update
%build
make
@@ -77,6 +79,9 @@
%attr(0644,root,root) %config /etc/pam.d/system-config-soundcard
%changelog
+* Tue Jan 24 2006 Martin Stransky <stransky at redhat.com> 1.2.12-3
+- backported fixes from devel branch (1.2.14)
+
* Mon Jun 20 2005 Martin Stransky <stransky at redhat.com> 1.2.12-2
- read cards mumbers from /proc/asound/modules
More information about the fedora-cvs-commits
mailing list