本文整理匯總了Java中android.hardware.usb.UsbDevice.getDeviceSubclass方法的典型用法代碼示例。如果您正苦於以下問題:Java UsbDevice.getDeviceSubclass方法的具體用法?Java UsbDevice.getDeviceSubclass怎麽用?Java UsbDevice.getDeviceSubclass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.hardware.usb.UsbDevice
的用法示例。
在下文中一共展示了UsbDevice.getDeviceSubclass方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: refreshDevice
import android.hardware.usb.UsbDevice; //導入方法依賴的package包/類
private final void refreshDevice() {
if (mUsbMonitor == null) {
return;
}
camList = null;
List<UsbDevice> allDev = mUsbMonitor.getDeviceList();
if (allDev.size() <= 0) {
return;
}
for (UsbDevice d : allDev) {
boolean isVideoDev = false;
if (d.getInterfaceCount() <= 0) {
if (d.getDeviceClass() == 239 && d.getDeviceSubclass() == 2) {
isVideoDev = true;
}
} else {
for (int i = 0; i < d.getInterfaceCount(); i++) {
UsbInterface in = d.getInterface(0);
if (in == null) {
continue;
}
if (in.getInterfaceClass() == 14) {
isVideoDev = true;
break;
}
}
}
if (isVideoDev) {
if (camList == null) {
camList = new ArrayList<UsbDevice>();
}
camList.add(d);
}
}
if (camList == null) {
System.out.println("v4l no device");
} else {
Collections.sort(camList, new Comparator<UsbDevice>(){
@Override
public int compare(UsbDevice left, UsbDevice right) {
return (left.getDeviceName().compareTo(right.getDeviceName()));
}
});
}
}