cancel
Showing results for 
Search instead for 
Did you mean: 

VID of the connected device

siddhipandare
Associate

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!

1 ACCEPTED SOLUTION

Accepted Solutions
FBL
ST Employee

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.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


View solution in original post

1 REPLY 1
FBL
ST Employee

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.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.