USB Serial Host Driver USB Interface (Windows Embedded CE 6.0)
1/6/2010
The following list shows details of the USB serial host driver USB interface:
It assumes that bInterfaceClass is equal to 0xFF.
It assumes one USB interface with one endpoint for bulk read transfers, one endpoint for bulk write transfers, and one optional endpoint for interrupt transfers. The USB serial host driver does not check for multiple bulk transfer endpoints.
It emulates data terminal ready (DTR) and request to send (RTS) status lines by issuing a class specific request that indicates the state of the output control lines on the host. The USB function client driver emulates a NULL modem cable, so the data carrier direct (DCD) and data set ready (DSR) states follow the USB serial host driver DTR state. In addition, the clear to send (CTS) state in the USB function client driver follows the RTS state in the USB serial host driver. In the USB serial host driver, the UsbClassVendorCommand function issues the request. The following code example shows the definition of UsbClassVendorCommand.
NTSTATUS UsbClassVendorCommand( IN PDEVICE_OBJECT PDevObj, IN UCHAR Request, IN USHORT Value, IN USHORT Index, IN PVOID Buffer, IN OUT PULONG BufferLen, IN BOOLEAN Read, IN ULONG Class );
The following table shows the descriptions for each parameter of UsbClassVendorCommand.
Parameter Description Wceusbsh.sys value PDevObj
Pointer to a device object.
PDevExt->DeviceObject
Request
Request field of the class specific or vendor specific command.
USB_COMM_SET_CONTROL_LINE_STATE
Value
Value field of the class specific or vendor specific command.
usState
- Specifies the control signal bitmask. The Value bitmask reserves D15 through D2.
- Set D1 equal to 1 to set the RTS state as active, and set D1 equal to 0 to set the RTS state as inactive.
- Set D0 equal to 1 to set the DTR state as active, and set D0 equal to 0 to set the DTR state as inactive.
Index
Index field of the class specific or vendor specific command.
PDevExt->UsbInterfaceNumber
Buffer
Pointer to a data buffer.
NULL
BufferLen
Length of the data buffer.
NULL
Read
Data direction flag.
FALSE
Class
TRUE if a class command, otherwise is a vendor command.
WCEUSB_CLASS_COMMAND
- Specifies the control signal bitmask. The Value bitmask reserves D15 through D2.
It uses an optional interrupt endpoint to indicate whether IN data is available. This endpoint also reports the state of the serial control lines. The following table describes the bitmask that reports the state of the serial control lines.
Bit Description D15 through D3
Reserved.
D2
Reports whether DSR is active. If equal to 1 then DSR is active, if equal to 0 then DSR is inactive.
D1
Reports whether CTS is active. If equal to 1 then CTS is active, if equal to 0, then CTS is inactive.
D0
Reports whether the host should read the IN endpoint. If equal to 1 then the host should read the IN endpoint. If equal to 0 then there is no data available.
When this bit is set, the USB serial host driver assigns a timeout value for reading the IN endpoint, then the USB serial host driver polls the IN endpoint while there is data or until the timeout expires. The default timeout value is 1280 milliseconds.
For information about configuring this timeout value, see USB Serial Host Driver Registry Settings.
USB Interface Programming Considerations
The following list shows details to consider while using the USB serial host driver:
- ActiveSync calls IOCTL_SERIAL_SET_DTR twice when it tries to connect. Handle this in the USB function client driver.
- It notifies the USB stack to cancel the read on the IN endpoint when InterruptTimeout expires. Reads on an IN endpoint take different amounts of time depending on the processing status of the USB stack. If you set the InterruptTimeout value too low, then the driver spends more time waiting for the read on the IN endpoint to cancel, instead of reading. If you set the InterruptTimeout value too high, then the driver spends more time polling for data. Using the interrupt endpoint prevents the USB host controller from polling the USB bus more than necessary, which can negatively affect performance on the PCI bus of the Windows-based desktop platform.
- It polls the upper layer protocols in the USB function client driver every second to maintain connectivity. Adjusting timing related settings such as InterruptTimeout could interfere with this polling.