本文整理汇总了TypeScript中usb.Device.controlTransfer方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Device.controlTransfer方法的具体用法?TypeScript Device.controlTransfer怎么用?TypeScript Device.controlTransfer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类usb.Device
的用法示例。
在下文中一共展示了Device.controlTransfer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
import * as usb from "usb";
const device = new usb.Device();
device.timeout = 1;
device.busNumber = 1;
device.deviceAddress = 1;
device.portNumbers = [1, 2, 3];
device.__open();
device.__claimInterface(0);
device.open(true);
device.close();
const xferDevice: usb.Device = device.controlTransfer(1, 1, 1, 1, 1, (error: string, buf: Buffer): usb.Device => new usb.Device());
device.getStringDescriptor(1, (error: string, buf: Buffer) => null);
device.setConfiguration(1, (error: string) => null);
device.reset((error: string) => null);
const deviceDesc: usb.DeviceDescriptor = new usb.DeviceDescriptor();
deviceDesc.bLength = 1;
deviceDesc.bDescriptorType = 1;
deviceDesc.bcdUSB = 1;
deviceDesc.bDeviceClass = 1;
deviceDesc.bDeviceSubClass = 1;
deviceDesc.bDeviceProtocol = 1;
deviceDesc.bMaxPacketSize = 1;
deviceDesc.idVendor = 1;
deviceDesc.idProduct = 1;
deviceDesc.bcdDevice = 1;
示例2:
import * as usb from "usb";
const device = new usb.Device();
device.timeout = 1;
device.busNumber = 1;
device.deviceAddress = 1;
device.portNumbers = [1, 2, 3];
device.__open();
device.__claimInterface(0);
device.open(true);
device.close();
const xferDevice: usb.Device = device.controlTransfer(1, 1, 1, 1, 1, (error: usb.LibUSBException, buf: Buffer): usb.Device => new usb.Device());
device.getStringDescriptor(1, (error: string, buf: Buffer) => null);
device.setConfiguration(1, (error: string) => null);
device.reset((error: string) => null);
const deviceDesc: usb.DeviceDescriptor = new usb.DeviceDescriptor();
deviceDesc.bLength = 1;
deviceDesc.bDescriptorType = 1;
deviceDesc.bcdUSB = 1;
deviceDesc.bDeviceClass = 1;
deviceDesc.bDeviceSubClass = 1;
deviceDesc.bDeviceProtocol = 1;
deviceDesc.bMaxPacketSize0 = 1;
deviceDesc.idVendor = 1;
deviceDesc.idProduct = 1;
deviceDesc.bcdDevice = 1;