static private UsbInterface findAdbInterface(UsbDevice device) {
Log.d(TAG, "findAdbInterface " + device);
int count = device.getInterfaceCount();
for (int i = 0; i < count; i++) {
UsbInterface intf = device.getInterface(i);
if (intf.getInterfaceClass() == 255 && intf.getInterfaceSubclass() == 66 &&
intf.getInterfaceProtocol() == 1) {
return intf;
}
}
return null;
}
java类android.hardware.usb.UsbInterface的实例源码
AdbTestActivity.java 文件源码
项目:buildAPKsSamples
阅读 20
收藏 0
点赞 0
评论 0
UsbSerialDevice.java 文件源码
项目:can4eve
阅读 25
收藏 0
点赞 0
评论 0
public static boolean isCdcDevice(UsbDevice device)
{
int iIndex = device.getInterfaceCount();
for(int i=0;i<=iIndex-1;i++)
{
UsbInterface iface = device.getInterface(i);
if(iface.getInterfaceClass() == UsbConstants.USB_CLASS_CDC_DATA)
return true;
}
return false;
}
SmartCardChannel.java 文件源码
项目:mi-firma-android
阅读 17
收藏 0
点赞 0
评论 0
/** Constructor. Inicia los EndPoints del Interfaz del dispositivo
* @param usbDevCon
* @param usbInterface */
protected SmartCardChannel(final UsbDeviceConnection usbDevCon, final UsbInterface usbInterface) {
this.usbDeviceConnection = usbDevCon;
for (int i = 0; i < usbInterface.getEndpointCount(); i++) {
final UsbEndpoint usbEndPoint = usbInterface.getEndpoint(i);
if (usbEndPoint.getType() == UsbConstants.USB_ENDPOINT_XFER_BULK) {
if (usbEndPoint.getDirection() == UsbConstants.USB_DIR_IN) {
this.endPointIn = usbEndPoint;
}
else if (usbEndPoint.getDirection() == UsbConstants.USB_DIR_OUT) {
this.endPointOut = usbEndPoint;
}
}
}
}
DeviceFilter.java 文件源码
项目:UVCCameraZxing
阅读 18
收藏 0
点赞 0
评论 0
public boolean matches(final UsbDevice device) {
if (mVendorId != -1 && device.getVendorId() != mVendorId)
return false;
if (mProductId != -1 && device.getProductId() != mProductId)
return false;
/* if (mManufacturerName != null && device.getManufacturerName() == null)
return false;
if (mProductName != null && device.getProductName() == null)
return false;
if (mSerialNumber != null && device.getSerialNumber() == null)
return false;
if (mManufacturerName != null && device.getManufacturerName() != null
&& !mManufacturerName.equals(device.getManufacturerName()))
return false;
if (mProductName != null && device.getProductName() != null
&& !mProductName.equals(device.getProductName()))
return false;
if (mSerialNumber != null && device.getSerialNumber() != null
&& !mSerialNumber.equals(device.getSerialNumber()))
return false; */
// check device class/subclass/protocol
if (matches(device.getDeviceClass(), device.getDeviceSubclass(),
device.getDeviceProtocol()))
return true;
// if device doesn't match, check the interfaces
final int count = device.getInterfaceCount();
for (int i = 0; i < count; i++) {
final UsbInterface intf = device.getInterface(i);
if (matches(intf.getInterfaceClass(), intf.getInterfaceSubclass(),
intf.getInterfaceProtocol()))
return true;
}
return false;
}
USBMonitor.java 文件源码
项目:UVCCameraZxing
阅读 19
收藏 0
点赞 0
评论 0
/**
* close specified interface. USB device itself still keep open.
* @param interfaceIndex
*/
public void close(final int interfaceIndex) {
UsbInterface intf = null;
synchronized (mInterfaces) {
intf = mInterfaces.get(interfaceIndex);
if (intf != null) {
mInterfaces.delete(interfaceIndex);
mConnection.releaseInterface(intf);
}
}
}
USBMonitor.java 文件源码
项目:AndroidUvcCameras
阅读 21
收藏 0
点赞 0
评论 0
/**
* close specified interface. USB device itself still keep open.
* @param interfaceIndex
*/
public void close(final int interfaceIndex) {
UsbInterface intf = null;
synchronized (mInterfaces) {
intf = mInterfaces.get(interfaceIndex);
if (intf != null) {
mInterfaces.delete(interfaceIndex);
mConnection.releaseInterface(intf);
}
}
}
UsbSerialDevice.java 文件源码
项目:UsbExtension
阅读 24
收藏 0
点赞 0
评论 0
public static boolean isCdcDevice(UsbDevice device)
{
int iIndex = device.getInterfaceCount();
for(int i=0;i<=iIndex-1;i++)
{
UsbInterface iface = device.getInterface(i);
if(iface.getInterfaceClass() == UsbConstants.USB_CLASS_CDC_DATA)
return true;
}
return false;
}
UsbInterfaceSubject.java 文件源码
项目:truth-android
阅读 15
收藏 0
点赞 0
评论 0
public static SubjectFactory<UsbInterfaceSubject, UsbInterface> type() {
return new SubjectFactory<UsbInterfaceSubject, UsbInterface>() {
@Override
public UsbInterfaceSubject getSubject(FailureStrategy fs, UsbInterface that) {
return new UsbInterfaceSubject(fs, that);
}
};
}
BootloaderConnection.java 文件源码
项目:walt
阅读 16
收藏 0
点赞 0
评论 0
@Override
public void onConnect() {
int ifIdx = 0;
UsbInterface iface = usbDevice.getInterface(ifIdx);
if (usbConnection.claimInterface(iface, true)) {
logger.log("Interface claimed successfully\n");
} else {
logger.log("ERROR - can't claim interface\n");
}
super.onConnect();
}
U2FTransportAndroidHID.java 文件源码
项目:android-u2f-bridge
阅读 17
收藏 0
点赞 0
评论 0
public U2FTransportAndroidHID(UsbDeviceConnection connection, UsbInterface dongleInterface, UsbEndpoint in, UsbEndpoint out, int timeout) {
this.connection = connection;
this.dongleInterface = dongleInterface;
this.in = in;
this.out = out;
this.timeout = timeout;
transferBuffer = new byte[HID_BUFFER_SIZE];
helper = new U2FHelper();
random = new Random();
}