本文整理汇总了Java中android.hardware.usb.UsbConstants.USB_TYPE_VENDOR属性的典型用法代码示例。如果您正苦于以下问题:Java UsbConstants.USB_TYPE_VENDOR属性的具体用法?Java UsbConstants.USB_TYPE_VENDOR怎么用?Java UsbConstants.USB_TYPE_VENDOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.hardware.usb.UsbConstants
的用法示例。
在下文中一共展示了UsbConstants.USB_TYPE_VENDOR属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: controlRequestTypeFromName
private static int controlRequestTypeFromName(String requestType) throws UsbError{
requestType = requestType.toLowerCase();
if ("standard".equals(requestType)) {
return UsbConstants.USB_TYPE_STANDARD; /* 0x00 */
} else if ("class".equals(requestType)) {
return UsbConstants.USB_TYPE_CLASS; /* 0x20 */
} else if ("vendor".equals(requestType)) {
return UsbConstants.USB_TYPE_VENDOR; /* 0x40 */
} else if ("reserved".equals(requestType)) {
return UsbConstants.USB_TYPE_RESERVED; /* 0x60 */
} else {
throw new UsbError("Unknown transfer requestType: " + requestType);
}
}
示例2: pl2303Init
private boolean pl2303Init() {
byte buf[] = new byte[4];
final int read = UsbConstants.USB_DIR_IN | UsbConstants.USB_TYPE_VENDOR;
final int write = UsbConstants.USB_DIR_OUT | UsbConstants.USB_TYPE_VENDOR;
final int tmout = PL2303_INIT_TIMEOUT_MS;
if ((mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
|| (mUsbConnection.controlTransfer(write, 0x01, 0x0404, 0, null, 0, tmout) < 0)
|| (mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
|| (mUsbConnection.controlTransfer(read, 0x01, 0x8383, 0, buf, 1, tmout) < 0)
|| (mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
|| (mUsbConnection.controlTransfer(write, 0x01, 0x0404, 1, null, 0, tmout) < 0)
|| (mUsbConnection.controlTransfer(read, 0x01, 0x8484, 0, buf, 1, tmout) < 0)
|| (mUsbConnection.controlTransfer(read, 0x01, 0x8383, 0, buf, 1, tmout) < 0)
|| (mUsbConnection.controlTransfer(write, 0x01, 0, 1, null, 0, tmout) < 0)
|| (mUsbConnection.controlTransfer(write, 0x01, 1, 0, null, 0, tmout) < 0)
) return false;
if (isPl2303Hx) {
if (mUsbConnection.controlTransfer(write, 0x01, 2, 0x44, null, 0, tmout) < 0) return false;
}else {
if (mUsbConnection.controlTransfer(write, 0x01, 2, 0x24, null, 0, tmout) < 0) return false;
}
if ((mUsbConnection.controlTransfer(write, 0x01, 8, 0, null, 0, tmout) < 0)
|| (mUsbConnection.controlTransfer(write, 0x01, 9, 0, null, 0, tmout) < 0)
) return false;
return true;
}
示例3: controlIn
private int controlIn(int request, int value, int index, byte[] buffer) {
final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request,
value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
}
示例4: controlIn
private int controlIn(int request, int value, int index, byte[] buffer) {
final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request,
value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
}
示例5: controlIn
private int controlIn(int request, int value, int index, byte[] buffer) {
final int REQTYPE_HOST_TO_DEVICE = UsbConstants.USB_TYPE_VENDOR | UsbConstants.USB_DIR_IN;
return mConnection.controlTransfer(REQTYPE_HOST_TO_DEVICE, request, value, index, buffer, buffer.length, USB_TIMEOUT_MILLIS);
}