This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USB CDC com port name change

Other Parts Discussed in Thread: MSP430F5659

Hi All,

I am working on USB CDC for MSP430F5659 controller. My hardware has HUB in between PC and my MSP. When i am connecting my device i am seeing the virtual Com port name appears.

My question is can we change the name which appears on connection by adding logic in MSP USB device stack code? or its not possible it is assigned in PC/host side?

Please confirm this.

Ex. on connection to PC it should show " DEVICE_XXXX" instead " Virtual Com Port" on PC Side.

Thanks in Advance.

Nitesh

 

  • Hi,

    I tried changing descriptor.c file its not changing the name.

    I think .inf file is creating the descriptor files. am i correct?

    How i can distinguish my device when two devices connected to PC if same driver is utilized for both?
    Is there any way i can read the device side info and that is used for the device identification when two same device is connected?

    We planned to use 4 byte serial number to distinguish when we connect 2 devices does this work or any other way just share the info.

    Thanking in advance
    Nitesh
  • The descriptors.c file contains the strings that the device reports to the OS. However, many drivers do not bother to show these strings.

    The TI USB stack already implements a serial number.
  • You can change the .INF file. At the end of the file is a section called [Strings]
    Modify these to say what you want.

    You will have to "Uninstall" the device driver in Windows Device Manager control panel, the plug your board back in and tell the Device Install wizard where your new .INF file is.

    Also check that abromStringDescriptor[] in your descriptors.c file has your information in it. You should be able to see that in Windows by right-clicking on the device in "Devices & Printers" screen, selecting properties, then hardware tab, then the properties button. Go to details tab and cycle through the list.
  • >How i can distinguish my device when two devices connected to PC if same driver is utilized for both? Is there any way i can read the device side info and that is used for the device identification when two same device is connected?

    There is. There is an API in Windows where you can query this information (in addition to creating an event listener to detect when device attached/detached). However, this is a Windows programming specific thing, and I don't know the details myself. You may find better luck with that portion on a Windows programming help site.
  • Brian Boorman said:
    There is. There is an API in Windows where you can query this information (in addition to creating an event listener to detect when device attached/detached). However, this is a Windows programming specific thing, and I don't know the details myself. You may find better luck with that portion on a Windows programming help site.

    I don't remember the source file name, but this can be found in TI MSP Debug stack source code, where program searching for all connected TI FET devices (VID / PID / ...) by port name (COMxx).

  • Hi,

    Thanks, 

    But i want to see display in device manager, when two devices connected to PC using serial number of the my device. 

    Can we achieve using .inf dynamically?

    Since driver is same for my devices i.e same VID and PID, So how we can attach the separate string when two different devices with different S/N is connected?

    Thanks,

    Nitesh 

  • Nitesh Padiyar77 said:
    But i want to see display in device manager, when two devices connected to PC using serial number of the my device. 

    Can we achieve using .inf dynamically?

    Since driver is same for my devices i.e same VID and PID, So how we can attach the separate string when two different devices with different S/N is connected?

    (If device is not some kind of special) for all CDC devices same Win driver (usbser.sys) is used and they will be displayed in device manager as COM virtual port. On device manager tabs can be found details about VID / PID / serial number ... for selected device.

    If I remember right, I already answer to you that you are looking at wrong place (inf file). You must implement this stuff (searching device with right VID / PID / serial number by port name COMxx, and if it is needed connection / disconnection detection, whatever) inside you PC application using as example source code from MSP Debug stack or / and web search.

  • Nitesh Padiyar77 said:

    But i want to see display in device manager, when two devices connected to PC using serial number of the my device. 

    Can we achieve using .inf dynamically?

    Device Manager displays the "FriendlyName" string on the hardware keys of virtual COM ports in the registry.
    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Enum\USB\VID_xxxx&PID_yyyy\<serial_number>\FriendlyName

    This hardware key is assigned to each VCP device by Windows at plug-in installation of the device. Windows make up FriendlyName using "device-description" string in INF file as its stem, appending COM port number after this stem.

    msp430_ti_signed.inf
    
    [DeviceList]
    ;; device-description, install-section-name and hw-id
    %DESCRIPTION0%=TIUSB, USB\Vid_2047&Pid_03ff&MI_00
    
    [Strings]
    DESCRIPTION0="TI MSP430 USB" 

    INF file specifies just VID/PID(/interface #) of the target device. You can't have unique INF for each device of the same VID/PID.


    FriendlyName is manually editable by registry editor (regedit, etc).
    Or by PC application. Here is hint for such application.

    In this topic on SiLabs forum, I posted C++ and C# code, which lists up COM ports with serial number, specifying VID/PID
    community.silabs.com/.../76271

    Using HDEVINFO(hDevInfoSet) and DEVINFO_DATA of the target device in this code, you may change FriendlyName string by calling this API.
    SetupDiSetDeviceRegistryProperty( SPDRP_FRIENDLYNAME )

    Tsuneo

  • Zrno Soli said:
    (If device is not some kind of special) for all CDC devices same Win driver (usbser.sys) is used and they will be displayed in device manager as COM virtual port. On device manager tabs can be found details about VID / PID / serial number ... for selected device.

    If I remember right, I already answer to you that you are looking at wrong place (inf file). You must implement this stuff (searching device with right VID / PID / serial number by port name COMxx, and if it is needed connection / disconnection detection, whatever) inside you PC application using as example source code from MSP Debug stack or / and web search.



    This is true if you are looking in Device Manager. On Windows 7 and up, there is a control panel called "Devices & Printers" which will show the friendly name from the .INF file. Therefore, you can identify your devices differently from other serial devices even though they all use usbser.sys driver.

    What Nitesh wanted, for each of his same type devices to have different strings, is not available via the .INF method.

    Tsuneo Chinzei said:
    FriendlyName is manually editable by registry editor (regedit, etc).


    This is a good point.

    To Nitesh - you will get some good ideas here, but remember that you are asking Window-specific questions on the MSP forum. If you run into problems implementing the Windows software, don't overlook the wealth of support available on Windows programming forums.

  • Yes,

    I understood, i can't display device serial number of the device if i connect two of my devices which has same VID/PID correct?

    What else i can do if i want at least distinguish two of my devices connected to same PC apart from com port number?

    can i see the details of the device in device manager i.e. to get device serial number using any USB host command during enumeration?

    Thanks in advance

    Nitesh 

  • Nitesh Padiyar77 said:
    I understood, i can't display device serial number of the device if i connect two of my devices which has same VID/PID correct?

    You can. But YOU have to write code in a windows application to query this information from the Windows API.

    Nitesh Padiyar77 said:
    can i see the details of the device in device manager

    You can see details of the device in device manager (right click on the device, select "Properties", and then select the "Details" tab on the pop-up dialog box.

    I don't understand what your question "i.e. to get device serial number using any USB host command during enumeration?" means.

    You can get device information after enumeration, but you have to write this into your Windows application.

    Take a look at this page from Microsoft for a tool that lets you see USB devices: https://msdn.microsoft.com/en-us/library/windows/hardware/ff560019(v=vs.85).aspx

    Anything you see there you can do in your own Windows application.

  • Hi,

    My question was displaying my device serial number with some name.

    ex: when my device connected to host it should be identified as "VT_DSA_XXXX" in device manager so that if two device with same VID and PID connected, user can identify the two device by their last 4 digit of the serial number. Other wise he will not able to distinguish which device he is communicating.

    This is just a thought, Now with all discussion i concluded that same VID/PID of both devices can't identified till the name assigned in device manager,

    and we can later get the device serial number using our specific command.

    Please confirm. 

    Nitesh

  • Nitesh Padiyar77 said:

    My question was displaying my device serial number with some name.

    ex: when my device connected to host it should be identified as "VT_DSA_XXXX" in device manager so that if two device with same VID and PID connected, user can identify the two device by their last 4 digit of the serial number. Other wise he will not able to distinguish which device he is communicating.

    If user (every time before using your device) need to open device manager, and check device name / serial number on some device manager tab, than I will not be this user. Your PC application should search for all attached devices (with your PID / VID) and give option to user for connecting to the right one with specific serial number.
    I don't see how including serial number to device name can improve anything.
  • I agree. In addition, you are really asking questions that are specific to the Windows software and how it operates it's USB stack and plug and play architecture. It has nothing to do with MSP430 specifically at this point.

    I will reiterate that you should be asking your "how to make Windows...." question on some forum dedicated to Windows programming, where there are plenty of people familiar with how all of that stuff works.
  • Thanks zrno and Brain,

    Sound good, may be i can make use of command to read my device serial number and that can be shown to user in application drop down to process further after device enumeration complete.

    Thanks,

    Nitesh

    .

**Attention** This is a public forum