             }
             let status = ioctl(i2c, UInt(I2C_SLAVE), CInt(newAddress))
             guard status == 0 else {
-                throw I2CError.slaveAddressSetError(status)
+                throw I2CError.slaveAddressSetError(status, errno)
             }
             self.currentAddress = newAddress
         }

                
                let response = i2c_smbus_write_quick(i2c, UInt8(I2C_SMBUS_WRITE))
                if response < 0 {
                    throw I2CError.noAckError(response)
                }
                return []
            }

    public final class I2CBusDevice: I2CDevice {
        
        public enum I2CError: Error {
            case deviceOpenError(portNumber: UInt8, returns: Int32, errno: Int32)
            case slaveAddressSetError(Int32, Int32)
            case readOrWriteError(Int32, Int32)
            case noAckError(Int32, Int32)
        }
        
        private var currentAddress: UInt8 = 0
