Skip to content

Commit

Permalink
Fixed file descriptor for ioctl
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Altrenburg committed Dec 7, 2021
1 parent 1df0b5f commit 08c3cbb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/I2C.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public final class SysFSI2C: I2CInterface {
public func readRaw(_ address: Int, length: Int) -> [UInt8] {
var buf: [UInt8] = [UInt8](repeating:0, count: length)

let i2cStatus = ioctl( Int32( i2cId ), 0x0703, CInt( address ) )
let i2cStatus = ioctl( fd, 0x0703, CInt( address ) )

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

setSlaveAddress(address)

let i2cStatus = ioctl( Int32( i2cId ), 0x0703, CInt( address ) )
let i2cStatus = ioctl( fd, 0x0703, CInt( address ) )

guard i2cStatus == 0 else { return nil }

Expand Down

0 comments on commit 08c3cbb

Please sign in to comment.