This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Class specific requests in USB to Serial converter

Hi all,

Presently I'm working on USB to Serial device converter. For that I need to feed different class specific discriptors' data like Abstract Control Management Functional Discriptor, Call Management Functional Descriptor, Header Functional Descriptor and Union Functional Descriptor in enumeration process.

I've set a value of 0x07 in Abstract Control Management Functional Discriptor's bmCapabillities bitmap field, which indicates that my configuration supports SEND_BREAK, SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE, SET_COMM_FEATURE, GET_COMM_FEATURE, CLEAR_COMM_FEATURE and SERIAL_STATE requests.

When I connect realterm/hyperterminal to my virtual com port, I'm getting SET_LINE_CODING, GET_LINE_CODING and SET_CONTROL_LINE_STATE requests except SEND_BREAK, SET_COMM_FEATURE, GET_COMM_FEATURE, CLEAR_COMM_FEATURE and SERIAL_STATE.

So, just want to know that how I'll get these remained class specific requests while data transmission from USB to Serial or Serial to USB?

In USB to Serial converter, there is an interrupt endpoint(notification element) through which I need to pass status notifications to the host. How I can send status notifications to the Interrupt endpoint? Is there any format/sequence to send the notification? How many data I need to send through?

(Note : There isn't any exact information mentioned in USB Communication Device Class spec for data format/sequence and no. of bytes which I need to send through notification element/interrupt endpoint)

Thanks in advance.

Harshil

  • > So, just want to know that how I'll get these remained class specific requests while data transmission from USB to Serial or Serial to USB?

    Sound like you are working on Windows.
    For Windows,

    SEND_BREAK
    - ClearCommBreak(), SetCommBreak() - Win serial API
    - EscapeCommFunction( CLRBREAK / SETBREAK ) - Win serial API

    SET_COMM_FEATURE, GET_COMM_FEATURE, CLEAR_COMM_FEATURE
    You have to assign your device as MODEM class, instead of Ports setup class on your INF file.

    Class = Modem
    ClassGuid = {4d36e96d-e325-11ce-bfc1-08002be10318}



    > Is there any format/sequence to send the notification? How many data I need to send through?

    The format of notification is explained in this section of the CDC spec (usbcdc11.pdf)
    6.3 Notification Element Notifications

    Surely, it may be not so clear enough for the first read.
    Every notification is preceded by 8-bytes header, similar to a SETUP data of Request. And data, specific to the notification type, follows.
    SERIAL_STATE notification results in 10 bytes block.

      byte
        0:  0xA1   bmRequestType
        1:  0x20   bNotification (SERIAL_STATE)
        2:  0x00   wValue
        3:  0x00
        4:  xx     wIndex (Interface number, 16 bits, LSB first)
        5:  xx
        6:  0x02   wLength (Data length = 2 bytes, LSB first)
        7:  0x00
        8:  xx     UART State Bitmap (16bits, LSB first)
        9:  xx
    


    For the details of UART State Bitmap, see "6.3.5 SerialState" (usbcdc11.pdf)
    This 10 bytes block is sent over the interrupt IN endpoint of CDC Comm Management interface as single transfer.

    The send timing of SERIAL_STATE notification depends on the state change of each member on UART State Bitmap. The spec says as follows,

    For the consistent signals like carrier detect or transmission carrier, this will mean another notification will not be generated until there is a state change. For the irregular signals like break, the incoming ring signal, or the overrun error state, this will reset their values to zero and again will not send another notification until their state changes.

    Tsuneo

  • Tsuneo, first of all thanks a lot for your response!

    Now, I'm sending 10 bytes in SERIAL_STATE notification and also getting DCD and DSR's status(according to their bitmap values) in the realterm which I've connected to my Virtual COM port with hardware flow control ON. But whenever I send bBreak or any error bit as 1 in UART State Bitmap, I'm not getting any status in the same realterm.

    So, I do have few questions regading it :

    SERIAL_STATE is a notification of UART which I'm sending to the USB. I would like to know that how USB's serial driver usbser.sys will respond to all these states of UART which I'm sending to it whenever hardware flow control is ON?

    In case of hardware flow control is ON, is it possible to control data flow from USB to serial by sending UART's notification?

    Harshil

  • usbser.sys ignores hardware flow control (RTS/CTS, DTR/DSR) setting.
    This device driver is a limited one as a CDC-ACM / COM port driver.
    Not all features of these specs are supported.

    Not just observing it on RealTerm, monitor the COM port using PortMon, too.
    And then, you'll get "raw" response of usbser.sys

    PortMon
    technet.microsoft.com/.../bb896644

    PortMon reports these IOCTL_SERIAL_ requests.

    Serial Device Control Requests
    msdn.microsoft.com/.../ff547466(VS.85).aspx

    Tsuneo