Project Home

Trackers

Source Code

File Releases

Documents

Wiki

Discussions

Reports

Project Info
Artifact artf4173 : Java I2C class incorrectly reports aborted transaction in transaction method. Print Preview
Tracker:Bugs
Title:Java I2C class incorrectly reports aborted transaction in transaction method.
Description:
The I2C.transaction() method assumes that any non-zero return from I2CJNI.i2CTransaction() indicates the transaction has
 been aborted. This appears to be incorrect. Testing has shown that successful transactions can return the value 2 while
 unsuccessful transactions tend to return -1. I suspect that the comparison of "!= 0" should be changed to "< 0".
Submitted By:John Koehring
Submitted On:07/28/2015 11:11 PM GMT
Last Modified:05/11/2016 8:12 AM GMT
Closed:05/11/2016 8:12 AM GMT

Active Tab Status / Comments Inactive Tab - left sideChange Log Inactive Tab - left sideAssociations Inactive Tab - left sideDependencies Inactive Tab - left sideAttachmentsInactive Tab - right side  
Java WPILib
Status
Planning Folder:*Java
4
Closed
None
Comments
#4Tyler Veness (3512): 05/11/2016 8:12 AM GMT
 Comment:
A patch clarifying the return values via comments and fixing checks against them has been merged upstream.
 Action:Update
Closed set to 05/11/2016
Status changed from Open to Closed
#3Dustin Spicuzza: 01/31/2016 12:56 AM GMT
 Comment:
I'm curious as to why i2clib_read et al has no documentation associated with it...

However, Digital.cpp (hal) claims:

@return Transfer Aborted... false for success, true for aborted.

So the question becomes: what is the real return value of i2clib_readwrite? I ran it through a disassembler, and it 
looks like the i2clib routines just call ioctl(), which could return anything, but that "Usually, on success zero is 
returned.  A few ioctl() requests use the return value as an output parameter and return a nonnegative value on success.
  On error, -1 is returned, and errno is set appropriately."
 Action:Update
#2Dustin Spicuzza: 01/31/2016 12:18 AM GMT
 Comment:
It appears that the C++ WPILib checks for `status < 0`, so this is probably a bug.
 Action:Update
#1John Koehring: 07/28/2015 11:11 PM GMT
 Action:Create