Skip to content

Commit 08c3cbb

Browse files
author
Craig Altrenburg
committed
Fixed file descriptor for ioctl
1 parent 1df0b5f commit 08c3cbb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Sources/I2C.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public final class SysFSI2C: I2CInterface {
257257
public func readRaw(_ address: Int, length: Int) -> [UInt8] {
258258
var buf: [UInt8] = [UInt8](repeating:0, count: length)
259259

260-
let i2cStatus = ioctl( Int32( i2cId ), 0x0703, CInt( address ) )
260+
let i2cStatus = ioctl( fd, 0x0703, CInt( address ) )
261261

262262
if i2cStatus != 0 {
263263
print( "ioctl failed" )
@@ -278,7 +278,7 @@ public final class SysFSI2C: I2CInterface {
278278

279279
setSlaveAddress(address)
280280

281-
let i2cStatus = ioctl( Int32( i2cId ), 0x0703, CInt( address ) )
281+
let i2cStatus = ioctl( fd, 0x0703, CInt( address ) )
282282

283283
guard i2cStatus == 0 else { return nil }
284284

0 commit comments

Comments
 (0)