Skip to contentSkip to conversation

hda_analyzer: don't fail to display audio selector if caps variables aren't available

PATCH In review Anisse Astier 2 participants 3 messages May 30, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hda_analyzer: don't fail to display audio selector if caps variables aren't available

In particular, when an audio selector node has Amp-In caps: N/A, it allows to still interact with the selector, and not have TypeError traceback throwns because of NoneType variables.

---
Hi Jared,

I'm not sure if this is the proper way to fix this, so please consider this a formal report for the error thrown while parsing this node:

Node 0x22 [Audio Selector] wcaps 0x30010b: Stereo Amp-In
Amp-In caps: N/A
Amp-In vals: [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00] [0x00 0x00]
Connection: 7

     0x18* 0x19 0x1a 0x1b 0x1d 0x0b 0x12

Regards,

Anisse

--

 hda-analyzer/hda_guilib.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
hda-analyzer/hda_guilib.py +3 -3
index 93c85e1..62eddab 100644
@@ -285,9 +285,9 @@ class NodeGui(gtk.ScrolledWindow):
       frame.set_border_width(4)
       vbox = gtk.VBox(False, 0)
       if caps:
-        str =  'Offset:          %d\n' % caps.ofs
-        str += 'Number of steps: %d\n' % caps.nsteps
-        str += 'Step size:       %d\n' % caps.stepsize
+        str =  'Offset:          %s\n' % (caps.ofs if caps.ofs else "N/A")
+        str += 'Number of steps: %s\n' % (caps.nsteps if caps.nsteps else "N/A")
+        str += 'Step size:       %s\n' % (caps.stepsize if caps.stepsize else "N/A")
         str += 'Mute:            %s\n' % (caps.mute and "True" or "False")
         vbox.pack_start(self.__new_text_view(text=str), True, True, 0)
         idx = 0
Signature · 1 line
1.8.3.rc1
#1 lore raw
Quoted 3 lines · Anisse Astier

In particular, when an audio selector node has Amp-In caps: N/A, it allows to still interact with the selector, and not have TypeError traceback throwns because of NoneType variables.

When ofs is None, the steps are not defined, too. I fixed it in:

http://git.alsa-project.org/?p=alsa.git;a=commitdiff;h=5bcf62d6947fe348a2b055bce633df1d12ff4370

Thank you for this report.

Jaroslav

Signature · 3 lines
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project; Red Hat, Inc.