Skip to content

Commit b20fc6e

Browse files
committed
Fix Linux scan
1 parent c584303 commit b20fc6e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

qwiic_i2c/linux_i2c.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,12 @@ def ping(self, devAddress):
279279
#
280280
def scan(self):
281281
""" Returns a list of addresses for the devices connected to the I2C bus."""
282-
return self.i2cbus.scan()
282+
foundDevices = []
283+
# Loop over the list of legal addresses (0x08 - 0x77)
284+
for currAddress in range(0x08, 0x78):
285+
if self.ping(currAddress) == True:
286+
foundDevices.append(currAddress)
287+
return foundDevices
283288

284289
#-----------------------------------------------------------------------
285290
# Custom method for reading +8-bit register using `i2c_msg` from `smbus2`

0 commit comments

Comments
 (0)