Skip to main content
Explorer
January 21, 2025
Solved

VID of the connected device

  • January 21, 2025
  • 1 reply
  • 1422 views

Hi, I’m working with an STM32G0 MCU and utilizing the USBPD and USB_DEVICE Middleware packages.

In my application, I need to detect if the connected device is running iOS. Since all Apple devices have the Vendor ID (VID) set to 0x5AC, I plan to use this as a distinguishing factor. However, I’m unable to locate where and how to retrieve this VID within the STM32 software framework. Is there a specific function or method available in the Middleware or USB stack that allows me to access the VID of a connected device? If not, could you guide me on where to look or how to implement this functionality?

siddhipandare_0-1737493757030.png

Thank you!

    This topic has been closed for replies.
    Best answer by FBL

    Hi @siddhipandare 

    When the STM32 is configured in device mode, it is not possible to detect directly the vendor ID of a connected host device because the USB device STM32 does not have access to the host's descriptors. Instead, the host (for example, a PC or an iOS device) queries the device STM32 for its descriptors.

    However, you can implement a workaround to exchange data between the host and the device. For example, you can use a custom USB class or extend an existing class (like CDC or HID) to send and receive data that includes the host's VID.

    Added to that, I'm not sure you would be able to detect the OS type using the VID.

    1 reply

    FBLAnswer
    Technical Moderator
    January 23, 2025

    Hi @siddhipandare 

    When the STM32 is configured in device mode, it is not possible to detect directly the vendor ID of a connected host device because the USB device STM32 does not have access to the host's descriptors. Instead, the host (for example, a PC or an iOS device) queries the device STM32 for its descriptors.

    However, you can implement a workaround to exchange data between the host and the device. For example, you can use a custom USB class or extend an existing class (like CDC or HID) to send and receive data that includes the host's VID.

    Added to that, I'm not sure you would be able to detect the OS type using the VID.