mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #32268 from thegecko/master
[usb] Add getBosDescriptor() and getCapabilities() added in 1.5.0
This commit is contained in:
Vendored
+24
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for node-usb 1.1
|
||||
// Type definitions for node-usb 1.5
|
||||
// Project: https://github.com/tessel/node-usb
|
||||
// Definitions by: Eric Brody <https://github.com/underscorebrody>
|
||||
// Rob Moran <https://github.com/thegecko>
|
||||
@@ -31,6 +31,8 @@ export class Device {
|
||||
interface(addr: number): Interface;
|
||||
controlTransfer(bmRequestType: number, bRequest: number, wValue: number, wIndex: number, data_or_length: any, callback: (error?: LibUSBException, buf?: Buffer) => void): Device;
|
||||
getStringDescriptor(desc_index: number, callback: (error?: string, buf?: Buffer) => void): void;
|
||||
getBosDescriptor(callback: (error?: string, descriptor?: BosDescriptor) => void): void;
|
||||
getCapabilities(callback: (error?: string, capabilities?: Capability[]) => void): void;
|
||||
setConfiguration(desired: number, cb: (err?: string) => void): void;
|
||||
reset(callback: (err?: string) => void): void;
|
||||
}
|
||||
@@ -65,6 +67,27 @@ export class ConfigDescriptor {
|
||||
interfaces: InterfaceDescriptor[][];
|
||||
}
|
||||
|
||||
export class BosDescriptor {
|
||||
bLength: number;
|
||||
bDescriptorType: number;
|
||||
wTotalLength: number;
|
||||
bNumDeviceCaps: number;
|
||||
capabilities: CapabilityDescriptor[];
|
||||
}
|
||||
|
||||
export class CapabilityDescriptor {
|
||||
bLength: number;
|
||||
bDescriptorType: number;
|
||||
bDevCapabilityType: number;
|
||||
dev_capability_data: Buffer;
|
||||
}
|
||||
|
||||
export class Capability {
|
||||
descriptor: CapabilityDescriptor;
|
||||
type: number;
|
||||
data: Buffer;
|
||||
}
|
||||
|
||||
export class Interface {
|
||||
interfaceNumber: number;
|
||||
altSetting: number;
|
||||
|
||||
@@ -14,6 +14,8 @@ 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.getBosDescriptor((error: string, descriptor: usb.BosDescriptor) => null);
|
||||
device.getCapabilities((error: string, capabilities: usb.Capability[]) => null);
|
||||
device.setConfiguration(1, (error: string) => null);
|
||||
device.reset((error: string) => null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user