File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -151,16 +151,11 @@ def __probe_for_device(self):
151
151
while not self .i2c .try_lock ():
152
152
pass
153
153
try :
154
- self .i2c .writeto (self .device_address , b"" )
154
+ result = bytearray (1 )
155
+ self .i2c .readfrom_into (self .device_address , result )
155
156
except OSError :
156
- # some OS's dont like writing an empty bytesting...
157
- # Retry by reading a byte
158
- try :
159
- result = bytearray (1 )
160
- self .i2c .readfrom_into (self .device_address , result )
161
- except OSError :
162
- # pylint: disable=raise-missing-from
163
- raise ValueError ("No I2C device at address: 0x%x" % self .device_address )
164
- # pylint: enable=raise-missing-from
157
+ # pylint: disable=raise-missing-from
158
+ raise ValueError ("No I2C device at address: 0x%x" % self .device_address )
159
+ # pylint: enable=raise-missing-from
165
160
finally :
166
161
self .i2c .unlock ()
You can’t perform that action at this time.
0 commit comments