How to use the usb.LIBUSB_REQUEST_GET_DESCRIPTOR function in usb

To help you get started, we’ve selected a few usb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / usb / usb-tests.ts View on Github external
const CHECK_LIBUSB_CLASS_COMM: number = usb.LIBUSB_CLASS_COMM;
const CHECK_LIBUSB_CLASS_HID: number = usb.LIBUSB_CLASS_HID;
const CHECK_LIBUSB_CLASS_PRINTER: number = usb.LIBUSB_CLASS_PRINTER;
const CHECK_LIBUSB_CLASS_PTP: number = usb.LIBUSB_CLASS_PTP;
const CHECK_LIBUSB_CLASS_MASS_STORAGE: number = usb.LIBUSB_CLASS_MASS_STORAGE;
const CHECK_LIBUSB_CLASS_HUB: number = usb.LIBUSB_CLASS_HUB;
const CHECK_LIBUSB_CLASS_DATA: number = usb.LIBUSB_CLASS_DATA;
const CHECK_LIBUSB_CLASS_WIRELESS: number = usb.LIBUSB_CLASS_WIRELESS;
const CHECK_LIBUSB_CLASS_APPLICATION: number = usb.LIBUSB_CLASS_APPLICATION;
const CHECK_LIBUSB_CLASS_VENDOR_SPEC: number = usb.LIBUSB_CLASS_VENDOR_SPEC;
// libusb_standard_request
const CHECK_LIBUSB_REQUEST_GET_STATUS: number = usb.LIBUSB_REQUEST_GET_STATUS;
const CHECK_LIBUSB_REQUEST_CLEAR_FEATURE: number = usb.LIBUSB_REQUEST_CLEAR_FEATURE;
const CHECK_LIBUSB_REQUEST_SET_FEATURE: number = usb.LIBUSB_REQUEST_SET_FEATURE;
const CHECK_LIBUSB_REQUEST_SET_ADDRESS: number = usb.LIBUSB_REQUEST_SET_ADDRESS;
const CHECK_LIBUSB_REQUEST_GET_DESCRIPTOR: number = usb.LIBUSB_REQUEST_GET_DESCRIPTOR;
const CHECK_LIBUSB_REQUEST_SET_DESCRIPTOR: number = usb.LIBUSB_REQUEST_SET_DESCRIPTOR;
const CHECK_LIBUSB_REQUEST_GET_CONFIGURATION: number = usb.LIBUSB_REQUEST_GET_CONFIGURATION;
const CHECK_LIBUSB_REQUEST_SET_CONFIGURATION: number = usb.LIBUSB_REQUEST_SET_CONFIGURATION;
const CHECK_LIBUSB_REQUEST_GET_INTERFACE: number = usb.LIBUSB_REQUEST_GET_INTERFACE;
const CHECK_LIBUSB_REQUEST_SET_INTERFACE: number = usb.LIBUSB_REQUEST_SET_INTERFACE;
const CHECK_LIBUSB_REQUEST_SYNCH_FRAME: number = usb.LIBUSB_REQUEST_SYNCH_FRAME;
// libusb_descriptor_type
const CHECK_LIBUSB_DT_DEVICE: number = usb.LIBUSB_DT_DEVICE;
const CHECK_LIBUSB_DT_CONFIG: number = usb.LIBUSB_DT_CONFIG;
const CHECK_LIBUSB_DT_STRING: number = usb.LIBUSB_DT_STRING;
const CHECK_LIBUSB_DT_INTERFACE: number = usb.LIBUSB_DT_INTERFACE;
const CHECK_LIBUSB_DT_ENDPOINT: number = usb.LIBUSB_DT_ENDPOINT;
const CHECK_LIBUSB_DT_HID: number = usb.LIBUSB_DT_HID;
const CHECK_LIBUSB_DT_REPORT: number = usb.LIBUSB_DT_REPORT;
const CHECK_LIBUSB_DT_PHYSICAL: number = usb.LIBUSB_DT_PHYSICAL;
const CHECK_LIBUSB_DT_HUB: number = usb.LIBUSB_DT_HUB;
github appium / node-adb-client / adb.js View on Github external
static async getSerialNumber (device) {
    let langId = 0x0409;
    let length = 255;
    let deviceDescriptor = device.deviceDescriptor;
    let controlTransferAsync = Promise.promisify(device.controlTransfer, device);
    let serialNumber = await controlTransferAsync(usb.LIBUSB_ENDPOINT_IN
                                                 , usb.LIBUSB_REQUEST_GET_DESCRIPTOR
                                                 , (usb.LIBUSB_DT_STRING << 8) | deviceDescriptor.iSerialNumber
                                                 , langId
                                                 , length);
    console.log("serialNumber: ", serialNumber.toString());
    return serialNumber.toString('utf16le', 2);
  }