changeset 104:56c334d1408c

8073142: [I2C] read with subadress are not atomic Summary: Create I2CCombinedMessage for read-with-subaddress operation Reviewed-by: alkonsta
author snazarki
date Fri, 13 Feb 2015 18:19:38 +0300
parents a4ed486f64cc
children a21b352d2f53 47c1eb709fd4
files src/share/classes/com/oracle/dio/i2cbus/impl/I2CSlaveImpl.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/oracle/dio/i2cbus/impl/I2CSlaveImpl.java	Wed Feb 11 13:44:37 2015 +0300
+++ b/src/share/classes/com/oracle/dio/i2cbus/impl/I2CSlaveImpl.java	Fri Feb 13 18:19:38 2015 +0300
@@ -153,8 +153,10 @@
         tmp.order(ByteOrder.BIG_ENDIAN);
         tmp.putInt(subaddress);
         tmp.position(4-subaddressSize);
-        write(tmp);
-        return read(skip, dst);
+        I2CCombinedMessage msg = new I2CCombinedMessage();
+        msg.appendWrite(this, tmp);
+        msg.appendRead(this, skip, dst);
+        return msg.transfer()[0];
     }
 
     @Override