@types/usb
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -32,3 +32,3 @@ // Type definitions for node-usb 1.5 | ||
/** Object with properties for the fields of the configuration descriptor. */ | ||
/** Object with properties for the fields of the active configuration descriptor. */ | ||
configDescriptor: ConfigDescriptor; | ||
@@ -46,3 +46,7 @@ | ||
__open(): void; | ||
__getConfigDescriptor(): ConfigDescriptor; | ||
__claimInterface(addr: number): void; | ||
__detachKernelDriver(addr: number): void; | ||
__attachKernelDriver(addr: number): void; | ||
__isKernelDriverActive(addr: number): boolean; | ||
@@ -73,3 +77,3 @@ /** | ||
* | ||
* Parameter `data_or_length` can be a integer length for an IN transfer, or a Buffer for an out transfer. The type must match the direction specified in the MSB of bmRequestType. | ||
* Parameter `data_or_length` can be an integer length for an IN transfer, or a `Buffer` for an OUT transfer. The type must match the direction specified in the MSB of bmRequestType. | ||
* | ||
@@ -86,3 +90,4 @@ * The `data` parameter of the callback is always undefined for OUT transfers, or will be passed a Buffer for IN transfers. | ||
*/ | ||
controlTransfer(bmRequestType: number, bRequest: number, wValue: number, wIndex: number, data_or_length: any, callback: (error?: LibUSBException, buf?: Buffer) => void): Device; | ||
controlTransfer(bmRequestType: number, bRequest: number, wValue: number, wIndex: number, data_or_length: number | Buffer, | ||
callback: (error: undefined | LibUSBException, buffer?: Buffer) => void): Device; | ||
@@ -96,3 +101,3 @@ /** | ||
*/ | ||
getStringDescriptor(desc_index: number, callback: (error?: string, buf?: Buffer) => void): void; | ||
getStringDescriptor(desc_index: number, callback: (error: undefined | LibUSBException, data?: string) => void): void; | ||
@@ -105,3 +110,3 @@ /** | ||
*/ | ||
getBosDescriptor(callback: (error?: string, descriptor?: BosDescriptor) => void): void; | ||
getBosDescriptor(callback: (error: undefined | LibUSBException, descriptor?: BosDescriptor) => void): void; | ||
@@ -114,3 +119,3 @@ /** | ||
*/ | ||
getCapabilities(callback: (error?: string, capabilities?: Capability[]) => void): void; | ||
getCapabilities(callback: (error: undefined | LibUSBException, capabilities?: Capability[]) => void): void; | ||
@@ -123,5 +128,5 @@ /** | ||
* @param desired | ||
* @param cb | ||
* @param callback | ||
*/ | ||
setConfiguration(desired: number, cb: (err?: string) => void): void; | ||
setConfiguration(desired: number, callback: (error: undefined | LibUSBException) => void): void; | ||
@@ -134,3 +139,3 @@ /** | ||
*/ | ||
reset(callback: (err?: string) => void): void; | ||
reset(callback: (error: undefined | LibUSBException) => void): void; | ||
} | ||
@@ -288,5 +293,5 @@ | ||
* The device must be open to use this method. | ||
* @param cb | ||
* @param callback | ||
*/ | ||
release(cb?: (err?: string) => void): void; | ||
release(callback?: (error: undefined | LibUSBException) => void): void; | ||
@@ -303,5 +308,5 @@ /** | ||
* @param closeEndpoints | ||
* @param cb | ||
* @param callback | ||
*/ | ||
release(closeEndpoints?: boolean, cb?: (err?: string) => void): void; | ||
release(closeEndpoints?: boolean, callback?: (error: undefined | LibUSBException) => void): void; | ||
@@ -320,3 +325,3 @@ /** | ||
*/ | ||
detachKernelDriver(): number; | ||
detachKernelDriver(): void; | ||
@@ -328,3 +333,3 @@ /** | ||
*/ | ||
attachKernelDriver(): number; | ||
attachKernelDriver(): void; | ||
@@ -336,5 +341,5 @@ /** | ||
* @param altSetting | ||
* @param cb | ||
* @param callback | ||
*/ | ||
setAltSetting(altSetting: number, cb: (err?: string) => void): void; | ||
setAltSetting(altSetting: number, callback: (error: undefined | LibUSBException) => void): void; | ||
@@ -399,2 +404,16 @@ /** | ||
descriptor: EndpointDescriptor; | ||
/** Clear the halt/stall condition for this endpoint. */ | ||
clearHalt(callback: (error: undefined | LibUSBException) => void): void; | ||
/** | ||
* Create a new `Transfer` object for this endpoint. | ||
* | ||
* The passed callback will be called when the transfer is submitted and finishes. Its arguments are the error (if any), the submitted buffer, and the amount of data actually written (for | ||
* OUT transfers) or read (for IN transfers). | ||
* | ||
* @param timeout Timeout for the transfer (0 means unlimited). | ||
* @param callback Transfer completion callback. | ||
*/ | ||
makeTransfer(timeout: number, callback: (error: undefined | LibUSBException, buffer?: Buffer, actualLength?: number) => void): Transfer; | ||
} | ||
@@ -408,2 +427,4 @@ | ||
descriptor: EndpointDescriptor; | ||
clearHalt(callback: (error: undefined | LibUSBException) => void): void; | ||
makeTransfer(timeout: number, callback: (error: undefined | LibUSBException, buffer?: Buffer, actualLength?: number) => void): Transfer; | ||
@@ -423,3 +444,3 @@ constructor(device: Device, descriptor: EndpointDescriptor); | ||
*/ | ||
transfer(length: number, callback: (error: LibUSBException, data: Buffer) => void): InEndpoint; | ||
transfer(length: number, callback: (error: undefined | LibUSBException, data?: Buffer) => void): InEndpoint; | ||
@@ -444,5 +465,5 @@ /** | ||
* The device must be open to use this method. | ||
* @param cb | ||
* @param callback | ||
*/ | ||
stopPoll(cb?: () => void): void; | ||
stopPoll(callback?: () => void): void; | ||
} | ||
@@ -456,2 +477,4 @@ | ||
descriptor: EndpointDescriptor; | ||
clearHalt(callback: (error: undefined | LibUSBException) => void): void; | ||
makeTransfer(timeout: number, callback: (error: undefined | LibUSBException, buffer?: Buffer, actualLength?: number) => void): Transfer; | ||
@@ -469,6 +492,6 @@ constructor(device: Device, descriptor: EndpointDescriptor); | ||
* @param buffer | ||
* @param cb | ||
* @param callback | ||
*/ | ||
transfer(buffer: Buffer, cb: (err?: LibUSBException) => void): OutEndpoint; | ||
transferWithZLP(buf: Buffer, cb: (err?: LibUSBException) => void): void; | ||
transfer(buffer: Buffer, callback: (error: undefined | LibUSBException) => void): OutEndpoint; | ||
transferWithZLP(buffer: Buffer, callback: (error: undefined | LibUSBException) => void): void; | ||
} | ||
@@ -510,2 +533,19 @@ | ||
/** Represents a USB transfer */ | ||
export class Transfer { | ||
/** | ||
* (Re-)submit the transfer. | ||
* | ||
* @param buffer Buffer where data will be written (for IN transfers) or read from (for OUT transfers). | ||
*/ | ||
submit(buffer: Buffer): Transfer; | ||
/** | ||
* Cancel the transfer. | ||
* | ||
* Returns `true` if the transfer was canceled, `false` if it wasn't in pending state. | ||
*/ | ||
cancel(): boolean; | ||
} | ||
/** | ||
@@ -512,0 +552,0 @@ * Convenience method to get the first device with the specified VID and PID, or `undefined` if no such device is present. |
{ | ||
"name": "@types/usb", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"description": "TypeScript definitions for node-usb", | ||
@@ -19,6 +19,7 @@ "license": "MIT", | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" | ||
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", | ||
"directory": "types/usb" | ||
}, | ||
@@ -29,4 +30,4 @@ "scripts": {}, | ||
}, | ||
"typesPublisherContentHash": "f19f18f084533b481faa677a18323726ca9a4cf589ad4f4813d27c1f4a0c3d83", | ||
"typeScriptVersion": "2.0" | ||
"typesPublisherContentHash": "c7247b3d299d0deffc76c393144fa65c34be6b8aa51db2c264202540866c285b", | ||
"typeScriptVersion": "3.1" | ||
} |
@@ -5,13 +5,13 @@ # Installation | ||
# Summary | ||
This package contains type definitions for node-usb ( https://github.com/tessel/node-usb ). | ||
This package contains type definitions for node-usb (https://github.com/tessel/node-usb). | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/usb | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/usb. | ||
Additional Details | ||
* Last updated: Mon, 04 Feb 2019 22:53:51 GMT | ||
* Dependencies: @types/node | ||
### Additional Details | ||
* Last updated: Thu, 03 Sep 2020 09:27:55 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Eric Brody <https://github.com/underscorebrody>, Rob Moran <https://github.com/thegecko>. | ||
These definitions were written by [Eric Brody](https://github.com/underscorebrody), and [Rob Moran](https://github.com/thegecko). |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27725
632