In Android, I'm using a class (UsbIso.java) to transfer data in an isochronous way from a USB device attached. Since Android doesn't natively support isochronous transfers, I had to use the USBFS native Linux mechanism through the JNA library to make the proper ioctl calls.
In Android devices with 32-bit architecture (armeabi, armeabi-v7a) everything works properly. In Android devices with 64-bit architecture (arm64-v8a) the ioctl call to reap URB (USBDEVFS_REAPURB, inside the reapRequest method, see related code below) returns error 14, bad address. I guess that this is caused either by the USBDEVFS_REAPURB parameter or by the PointerByReference parameter, which points to a non-valid virtual address, but I have no clue about how to solve it.
The related code in the UsbIso.java class that causes this error is this:
public Request reapRequest (boolean wait) throws IOException {
PointerByReference urbPointer = new PointerByReference();
int func = wait ? USBDEVFS_REAPURB : USBDEVFS_REAPURBNDELAY;
int rc;
try {
rc = libc.ioctl(fileDescriptor, func, urbPointer); // <-- Error 14, bad address
} catch (LastErrorException e) {
if (e.getErrorCode() == EAGAIN && !wait) {
return null;
}
}
...
}