Skip to content

Commit

Permalink
Merge pull request #352 from taartspi/linuxfs_i2c_first_op_fail
Browse files Browse the repository at this point in the history
Depending upon i2c method called the device may not be selected on th…
  • Loading branch information
eitch authored Apr 19, 2024
2 parents c4ea33e + b2c8e3a commit 849775b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ protected void selectBusSlave(I2C i2c) throws IOException {
*/
public int executeIOCTL(final I2C i2c, long command, ByteBuffer data, IntBuffer offsets){
int rc = -1;
if (this.lastAddress != i2c.device()) {
this.lastAddress = i2c.device();
}
try {
if (this.lock.tryLock() || this.lock.tryLock(this.lockAquireTimeout, this.lockAquireTimeoutUnit)) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ public synchronized I2C create(I2CConfig config) {
LinuxFsI2CBus i2CBus = this.i2CBusMap.computeIfAbsent(config.getBus(), busNr -> new LinuxFsI2CBus(config));
// create new I/O instance based on I/O config
LinuxFsI2C i2C = new LinuxFsI2C(i2CBus, this, config);
// Workaround, needed if first LinuxFsI2C usage is ioctl (readRegister or writeRegister)
i2C.read();
this.context.registry().add(i2C);
return i2C;
}
Expand Down

0 comments on commit 849775b

Please sign in to comment.