JavaでUSBカメラにデータを書き込みたい。そのために、私はLibUSBJavaを使用しています。output endpoint
USBカメラを開いてデータを正常に読み取ることができますが、データを書き込もうとすると、開いたデバイスに何も見つかりません。を見つけるためoutput endpoint
に、この機能を実装しました。この関数を呼び出すと、 が返されますnull
。このメソッドをデバッグしたところ、dev
4 つのインターフェイスがあることがわかりました。それらのすべてにがありますが、これらのインターフェイスinput endpoint
にはありません。output endpoint
private static Integer getActiveOutputEndPoint(Device dev) {
try {
Configuration cd = dev.getConfiguration();
if (cd == null)
System.out.println("Configuration Descriptor: null!");
else {
for (int i = 0; i < cd.getNumInterfaces(); i++) {
Interface ifc = cd.getInterface(i, 0);
if (ifc == null)
System.out.println("Interface Descriptor: null!");
else {
for (int k = 0; k < ifc.getNumEndpoints(); k++) {
Endpoint ep = ifc.getEndpoint(k);
if (ep == null)
System.out.println("Endpoint Descriptor: null!");
else {
if (ep.isInput()) {
continue;
} else {
return ep.getEndpointAddress();
}
}
}
}
}
}
} catch (IOException e) {
System.out.println("ERROR ! Configuration Descriptor: null! or Interface Descriptor: null!");
}
return null;
}
私を助けてくれる人はいますか?