Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
LPC1347 USB4Java_Java_Lpc_Usb4java - Fatal编程技术网

LPC1347 USB4Java

LPC1347 USB4Java,java,lpc,usb4java,Java,Lpc,Usb4java,如何使用Java和USB4Java库从具有HID配置的LPC1347发送和读取数据字节 我可以识别具有以下属性的设备: private static short VENDORID = 0x1fc9;// 8137 private static short PRODUCTID = 0x2000;// 8192 LPC1347上的端点为: private static short HID_ENDPOINT_OUT = 0x01; private static short HID_ENDPOINT_

如何使用Java和USB4Java库从具有HID配置的LPC1347发送和读取数据字节

我可以识别具有以下属性的设备:

private static short VENDORID = 0x1fc9;// 8137
private static short PRODUCTID = 0x2000;// 8192
LPC1347上的端点为:

private static short HID_ENDPOINT_OUT = 0x01;
private static short HID_ENDPOINT_IN = 0x81;
在我的代码中,我使用了以下内容:

UsbEndpoint endpoint = iface.getUsbEndpoint((byte) 0x55);
UsbPipe pipe = endpoint.getUsbPipe();
pipe.open();
try {
// read
byte[] data = new byte[8];
int received = pipe.syncSubmit(data);
System.out.println(received + " bytes received");
} finally {
pipe.close();
}   
我收到以下错误:

USB错误1:中断端点传输错误:输入/输出错误

LPC1347中还设置了以下内容: 外部审计报告[23]; 外部审计报告[23]


对于我用来读取报告(输入报告)0x55和写入报告(输出报告)0xAA的第一个字节。

我看不出您在发送数据之前已经声明了接口。试试这个:

iface.claim(new UsbInterfacePolicy()
    {            
        @Override
        public boolean forceClaim(UsbInterface usbInterface)
        {
            return true;
        }
    });
然后你可以插入你的代码。最后,您应该释放接口(我会在finally子句中这样做):

iface.release();