PURPOSE
• Starts listening to devices matching input criteria and registers
notification callbacks for these devices.
PROTOTYPE
DWORD WDU_Init(
WDU_DRIVER_HANDLE *phDriver,
WDU_MATCH_TABLE *pMatchTables,
DWORD dwNumMatchTables,
WDU_EVENT_TABLE *pEventTable,
const char *sLicense,
DWORD dwOptions);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
B.4.4 WDU_GetDeviceRegistryProperty
PURPOSE
• Gets the specified registry property of a given USB device.
PROTOTYPE
DWORD DLLCALLCONV WDU_GetDeviceRegistryProperty(
WDU_DEVICE_HANDLE hDevice,
PVOID pBuffer,
PDWORD pdwSize,
WD_DEVICE_REGISTRY_PROPERTY property);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
REMARKS
-
When the size of the provided user buffer (
pBuffer ) –
*pdwSize (input) – is not sufficient to hold the
requested registry property, the function returns
WD_INVALID_PARAMETER.
-
This function is supported only on Windows 2000 and higher.
PURPOSE
• Gets configuration information from a device, including all the
device descriptors.
NOTE: The caller to this function is responsible for calling
WDU_PutDeviceInfo [B.4.6] in
order to free the *ppDeviceInfo pointer returned by the
function.
PROTOTYPE
DWORD WDU_GetDeviceInfo(
WDU_DEVICE_HANDLE hDevice,
WDU_DEVICE **ppDeviceInfo);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
B.4.8 Single Blocking Transfer Functions
This section describes WinDriver's single blocking data transfer functions.
For more information, refer to 9.3.2 of
the manual.
PURPOSE
• Transfers data to or from a device.
PROTOTYPE
DWORD WDU_Transfer(
WDU_DEVICE_HANDLE hDevice,
DWORD dwPipeNum,
DWORD fRead,
DWORD dwOptions,
PVOID pBuffer,
DWORD dwBufferSize,
PDWORD pdwBytesTransferred,
PBYTE pSetupPacket,
DWORD dwTimeout);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
REMARKS
-
The resolution of the timeout (the
dwTimeout parameter) is
according to the operating system scheduler's time slot. For example, in
Windows the timeout's resolution is 10 milliseconds (ms).
PURPOSE
• Halts the transfer on the specified pipe (only one simultaneous
transfer per pipe is allowed by WinDriver).
PROTOTYPE
DWORD WDU_HaltTransfer(
WDU_DEVICE_HANDLE hDevice,
DWORD dwPipeNum);
PARAMETERS
DESCRIPTION
RETURN VALUE
status
B.4.8.3 WDU_TransferDefaultPipe
PURPOSE
• Transfers data to or from a device through the default pipe.
PROTOTYPE
DWORD WDU_TransferDefaultPipe(
WDU_DEVICE_HANDLE hDevice,
DWORD fRead,
DWORD dwOptions,
PVOID pBuffer,
DWORD dwBufferSize,
PDWORD pdwBytesTransferred,
PBYTE pSetupPacket,
DWORD dwTimeout);
PARAMETERS
See parameters of
WDU_Transfer [
B.4.8.1].
Note that
dwPipeNum is not a parameter of this function.
DESCRIPTION
See description of
WDU_Transfer [
B.4.8.1].
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
PURPOSE
• Performs bulk data transfer to or from a device.
PROTOTYPE
DWORD WDU_TransferBulk(
WDU_DEVICE_HANDLE hDevice,
DWORD dwPipeNum,
DWORD fRead,
DWORD dwOptions,
PVOID pBuffer,
DWORD dwBufferSize,
PDWORD pdwBytesTransferred,
DWORD dwTimeout);
PARAMETERS
See parameters of
WDU_Transfer [
B.4.8.1].
Note that
pSetupPacket is not a parameter of this function.
DESCRIPTION
See description of
WDU_Transfer [
B.4.8.1].
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
B.4.8.5 WDU_TransferIsoch
PURPOSE
• Performs isochronous data transfer to or from a device.
PROTOTYPE
DWORD WDU_TransferIsoch(
WDU_DEVICE_HANDLE hDevice,
DWORD dwPipeNum,
DWORD fRead,
DWORD dwOptions,
PVOID pBuffer,
DWORD dwBufferSize,
PDWORD pdwBytesTransferred,
DWORD dwTimeout);
PARAMETERS
See parameters of
WDU_Transfer [
B.4.8.1].
Note that
pSetupPacket is not a parameter of this function.
DESCRIPTION
See description of
WDU_Transfer [
B.4.8.1].
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
B.4.8.6 WDU_TransferInterrupt
PURPOSE
• Performs interrupt data transfer to or from a device.
PROTOTYPE
DWORD WDU_TransferInterrupt(
WDU_DEVICE_HANDLE hDevice,
DWORD dwPipeNum,
DWORD fRead,
DWORD dwOptions,
PVOID pBuffer,
DWORD dwBufferSize,
PDWORD pdwBytesTransferred,
DWORD dwTimeout);
PARAMETERS
See parameters of
WDU_Transfer [
B.4.8.1].
Note that
pSetupPacket is not a parameter of this function.
DESCRIPTION
See description of
WDU_Transfer [
B.4.8.1].
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
B.4.9 Streaming Data Transfer Functions
This section describes WinDriver's streaming data transfer functions.
For a detailed explanation regarding stream transfers and their implementation
with Windriver, refer to 9.3.3 of the manual.
![[Note]](scripts/images/info.png) | |
|---|
|
The streaming APIs are currently supported on Windows and Windows CE.
|
The streaming APIs are currently supported on Windows and Windows CE.
PURPOSE
• Opens a new stream for the specified pipe.
A stream can be associated with any pipe except for the control pipe
(Pipe 0).
The stream's data transfer direction – read/write – is derived
from the direction of its pipe.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamOpen(
WDU_DEVICE_HANDLE hDevice,
DWORD dwPipeNum,
DWORD dwBufferSize,
DWORD dwRxSize,
BOOL fBlocking,
DWORD dwOptions,
DWORD dwRxTxTimeout,
WDU_STREAM_HANDLE *phStream);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
PURPOSE
• Starts a stream, i.e. starts transfers between the stream and the
device.
Data will be transferred according to the stream's direction –
read/write.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamStart(
WDU_STREAM_HANDLE hStream);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
PURPOSE
• Reads data from a read stream to the application.
For a blocking stream (fBlocking=TRUE – see
WDU_StreamOpen), the call to this function is blocked until the
specified amount of data (bytes ) is read, or until the stream's
attempt to read from the device times out (i.e. the timeout period for
transfers between the stream and the device, as set in the
dwRxTxTimeout WDU_StreamOpen parameter [B.4.9.1], expires).
For a non-blocking stream (fBlocking=FALSE), the function
transfers to the application as much of the requested data as possible, subject
to the amount of data currently available in the stream's data buffer, and
returns immediately.
For both blocking and non-blocking transfers, the function returns the amount
of bytes that were actually read from the stream within the
pdwBytesRead parameter.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamRead(
HANDLE hStream,
PVOID pBuffer,
DWORD bytes,
DWORD *pdwBytesRead);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
PURPOSE
• Writes data from the applciation to a write stream.
For a blocking stream (fBlocking=TRUE – see
WDU_StreamOpen), the call to this function is blocked until the
entire data is written to the stream, or until the stream's attempt to write to
the device times out (i.e. the timeout period for transfers between the stream
and the device, as set in the dwRxTxTimeout
WDU_StreamOpen parameter [B.4.9.1],
expires).
For a non-blocking stream (fBlocking=FALSE), the function writes
as much data as currently possible to the stream's data buffer, and returns
immediately.
For both blocking and non-blocking transfers, the function returns the amount
of bytes that were actually written to the stream within the
pdwBytesWritten parameter.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamWrite(
HANDLE hStream,
const PVOID pBuffer,
DWORD bytes,
DWORD *pdwBytesWritten);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
PURPOSE
• Flushes a write stream, i.e. writes the entire contents of the
stream's data buffer to the device.
• Blocks until the completion of all pending I/O on the stream.
![[Note]](scripts/images/info.png) | |
|---|
|
This function can be called for both blocking and non-blocking streams.
|
This function can be called for both blocking and non-blocking streams.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamFlush(
WDU_STREAM_HANDLE hStream);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
B.4.9.6 WDU_StreamGetStatus
PURPOSE
• Returns a stream's current status.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamGetStatus(
WDU_STREAM_HANDLE hStream,
BOOL *pfIsRunning,
DWORD *pdwLastError,
DWORD *pdwBytesInBuffer);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
PURPOSE
• Stops an active stream, i.e. stops transfers between the stream
and the device.
In the case of a write stream, the function flushes the stream – i.e.
writes its contents to the device – before stopping it.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamStop(
WDU_STREAM_HANDLE hStream);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
PURPOSE
• Closes an open stream.
The function stops the stream, including flushing its data to the device (in
the case of a write stream), before closing it.
PROTOTYPE
DWORD DLLCALLCONV WDU_StreamClose(
WDU_STREAM_HANDLE hStream);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
B.4.12 WDU_SelectiveSuspend
PURPOSE
• Submits a request to suspend a given device (selective suspend),
or cancels a previous suspend request.
PROTOTYPE
DWORD DLLCALLCONV WDU_SelectiveSuspend(
WDU_DEVICE_HANDLE hDevice,
DWORD dwOptions);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
If the device is busy when a suspend request is
submitted (
dwOptions=WDU_SELECTIVE_SUSPEND_SUBMIT), the function returns
WD_OPERATION_FAILED.
REMARKS
WDU_SelectiveSuspend is supported on Windows XP and higher.
PURPOSE
• Reads a list of supported language IDs and/or the number of
supported language IDs from a device.
PROTOTYPE
DWORD DLLCALLCONV WDU_GetLangIDs(
WDU_DEVICE_HANDLE hDevice,
PBYTE pbNumSupportedLangIDs,
WDU_LANGID *pLangIDs,
BYTE bNumLangIDs);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
REMARKS
-
If
dwNumLangIDs is zero the function will return only the
number of supported language IDs (in pbNumSupportedLangIDs )
but will not update the language IDs array (pLangIDs ) with
the actual IDs. For this usage pLangIDs can be
NULL (since it is not referenced) but
pbNumSupportedLangIDs must not be NULL.
pbNumSupportedLangIDs can be NULL if the user
only wants to receive the list of supported language IDs and not the number
of supported IDs.
In this case bNumLangIDs cannot be zero and
pLangIDs cannot be NULL.
-
If the device does not support any language IDs the function will
return success. The caller should therefore check the value of
*pbNumSupportedLangIDs after the function returns.
-
If the size of the
pLangIDs array
(bNumLangIDs ) is smaller than the number of IDs supported
by the device (*pbNumSupportedLangIDs ), the function will
read and return only the first bNumLangIDs supported
language IDs.
PURPOSE
• Reads a string descriptor from a device by string index.
PROTOTYPE
DWORD DLLCALLCONV WDU_GetStringDesc(
WDU_DEVICE_HANDLE hDevice,
BYTE bStrIndex,
PBYTE pbBuf,
DWORD dwBufSize,
WDU_LANGID langID,
PDWORD pdwDescSize);
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
WD_STATUS_SUCCESS(0) on success, or
an appropriate error code otherwise [
B.8].
REMARKS
-
If the size of the
pbBuf buffer is smaller than the size of
the string descriptor (dwBufSize*pdwDescSize ), the returned
descriptor will be truncated to the provided buffer size
(dwBufSize ).