Comment 324 for bug 1958019

Revision history for this message
In , sycxyc+kernel (sycxyc+kernel-linux-kernel-bugs) wrote :

(In reply to Cameron Berkenpas from comment #297)
> (In reply to sycxyc from comment #295)
> > (In reply to Cameron Berkenpas from comment #292)
> I forgot about the debug mode of applyverbs.py.
>
> I was thinking of making the same modifications to applyverbs.py... Can you
> attach your version to this bug? It might also be worth sharing your changes
> with the original author too.
>
> Again, great work!

diff --git a/applyverbs.py b/applyverbs.py
index 5296d8d..a372736 100755
--- a/applyverbs.py
+++ b/applyverbs.py
@@ -4,6 +4,8 @@ import sys
 import time
 def validate(verbstring):
     try:
+ if verbstring[:1] in '#/;':
+ return False
         verbsegments = verbstring.split(' ')
         int(verbsegments[0], 16) and int(verbsegments[1], 16) and int(verbsegments[2], 16)
         return verbsegments
@@ -29,6 +31,8 @@ f.close()
 print('Applying verbs...')
 for i in range(0, len(verbsegments)):
     segment = verbsegments[i]
+ if not segment:
+ continue
     args = ['hda-verb', '/dev/snd/hwC0D0', *segment]
     result = subprocess.run(args, stderr=subprocess.DEVNULL, stdout=subprocess.PIPE).stdout.decode('utf-8')
     response = result[8:len(result)-1]

(In reply to TT from comment #298)
> (In reply to sycxyc from comment #295)
>
> Very good work!
> That does not look so trivial though. The verbs-working.txt has more than
> 500 lines and finding those 5 lines looks not so easy. The debug mode makes
> it easier to find when to stop but not when the sequence starts.
> Y

It only takes 5 backtraces to find the starting line, but the line-by-line test is not safe and may result in the need for a forced reboot