“Access is denied” in interrupt Write in JNA implementation of USB HID communication

我们两清 提交于 2019-12-12 02:54:58

问题


Using the library in this link http://www.blog.kslemb.com/doku.php/en/projects/globx/java_hid

I have been modfied this code to send data on a HID device using interrupt transfer.

public byte SetInReport(byte[] buffer, int buffersize) {
            if (HIDHandle.equals(WinBase.INVALID_HANDLE_VALUE)) {
            return HID_DEVICE_NOT_OPENED;
        }
        IntByReference bWritten = new IntByReference();

        boolean Status = Kernel32.INSTANCE.WriteFile(HIDHandle, buffer, buffersize, bWritten, null);
        if (Status == false) {
            debug("Write File: " + getSystemError(Kernel32.INSTANCE.GetLastError()));
            //System.out.println("Fail");
            return HID_DEVICE_TRANSFER_FAILED;

        }
        else {
            System.out.println("Successful!!!");
            //System.out.println("buffer in communication.java = "+buffer[1]);
            return HID_DEVICE_SUCCESS;
        }

        }

Debugging shows a "Access is denied" Message. Just wondering what can be the source of this problem. Any kind of help would be greatly appreciated. Thanks!

来源:https://stackoverflow.com/questions/9906119/access-is-denied-in-interrupt-write-in-jna-implementation-of-usb-hid-communica

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!