From: Bert Vermeulen Date: Sun, 8 Jan 2012 19:01:53 +0000 (+0100) Subject: i2c: fix address handling X-Git-Tag: libsigrokdecode-0.1.0~190 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=84b81f1df5a51285e55d808fdfb7968cd70711e9;p=libsigrokdecode.git i2c: fix address handling --- diff --git a/decoders/i2c.py b/decoders/i2c.py index 2a10ab7..abe4d7e 100644 --- a/decoders/i2c.py +++ b/decoders/i2c.py @@ -242,9 +242,12 @@ class Decoder(sigrokdecode.Decoder): self.databyte >>= 1 # Shift out unwanted ACK/NACK bit here. if self.state == FIND_ADDRESS: - d = self.databyte & 0xfe # The READ/WRITE bit is only in address bytes, not data bytes. - self.wr = 1 if (self.databyte & 1) else 0 + if self.databyte & 1: + self.wr = 0 + else: + self.wr = 1 + d = self.databyte >> 1 elif self.state == FIND_DATA: d = self.databyte else: