Hello,
I have a problem with an Usb Ioctl over Jna on Linux Mint 19. On Android Platform the Ioctl can be submitted, but on Linux I get a bad address error. The programcode is shown below.
There are more ioctls called on the usb device. The first 2 works without an error msg:
rc = libc.ioctl(fileDescriptor, USBDEVFS_SETINTERFACE, p.getPointer());
and
int rc = libc.ioctl(fileDescriptor, USBDEVFS_SUBMITURB, urbAddr);
The led of the usb camera device begins to light.
The next ioctl is failing now on my linux pc. It should send the ReapUrbNDelay command to the camera to collect the camera frames.
rc = libc.ioctl(fileDescriptor, func, urbPointer);
The C header code for the ioctl looks as follows: (usbdevice_fs.h)
#define USBDEVFS_REAPURBNDELAY _IOW('U', 13, void *)
If you need more infos from the linux mint 19 header files please tell.
The question is, from which of the 3 variables does the bad address error come from?
Could it be the PointerByReference Variable, but why is it working on an android device with the same parameters and code to send the ioctl?
Thanks,
Peter
What I have tried:
Here is the code for the failing ioctl.
private static final int USBDEVFS_REAPURBNDELAY = (1 << 30) | (Pointer.SIZE << 16) | (0x55 << 8) | 13;
--> the reapRequest method is called with a true parameter
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);
} printf (LastErrorException e) {
if (e.getErrorCode() == EAGAIN && !wait) {
return null;
}
throw e;
}}
If you need more details, please tell...