]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/usb_packet/pd.py
usb_power_delivery: Drop non-existing max_w for now.
[libsigrokdecode.git] / decoders / usb_packet / pd.py
index 8d1de65bc33460a5605e77036a492134047a23c3..489e58eb81419b10b548de0d12865413acfc5ad4 100644 (file)
@@ -15,8 +15,7 @@
 ## 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
 ##
 
 import sigrokdecode as srd
@@ -174,7 +173,7 @@ def calc_crc16(bitstr):
     return reverse_number(crc16, 16)
 
 class Decoder(srd.Decoder):
-    api_version = 2
+    api_version = 3
     id = 'usb_packet'
     name = 'USB packet'
     longname = 'Universal Serial Bus (LS/FS) packet'
@@ -223,6 +222,9 @@ class Decoder(srd.Decoder):
     )
 
     def __init__(self):
+        self.reset()
+
+    def reset(self):
         self.bits = []
         self.packet = []
         self.packet_summary = ''
@@ -358,7 +360,7 @@ class Decoder(srd.Decoder):
         elif pidname in ('ACK', 'NAK', 'STALL', 'NYET', 'ERR'):
             pass # Nothing to do, these only have SYNC+PID+EOP fields.
         elif pidname in ('PRE'):
-            pass # Nothing to do, PRE  only has SYNC+PID fields.
+            pass # Nothing to do, PRE only has SYNC+PID fields.
         else:
             pass # TODO: Handle 'SPLIT' and possibly 'Reserved' packets.